sim_learning()
simulates learning dynamics in a
normal-form game expected by an experienced weighted attraction (EWA)
model.
sim_learning(
game,
n_samples,
n_periods,
type = "EWA",
lambda = 1,
delta = 0.5,
rho = 0.5,
phi = 0.5,
A1_init = 0,
A2_init = 0,
N_init = 0,
plot_range_y = NULL
)
An object of normal_form
class defined by
normal_form()
.
A positive integer specifying the number of samples to be simulated.
A positive integer specifying how many times the game is played within each sample.
A character string to tell which learning models should be
simulated. The available options are "EWA"
,
"reinforcement"
(choice reinforcement), and "belief"
(belief based model). "reinforcement"
and "belief"
are
special cases of "EWA"
.
A positive real value representing the players' sensitivity to
attraction values of strategies. As lambda
gets larger, the choice
will be dependent on attraction values more heavily. As lambda
gets close to 0, a strategy will tend to be chosen randomly.
A real number between 0 and 1. This parameter controls how fast
attraction values of strategies that are not chosen are updated. If
delta = 0
, attraction is updated only for the strategy that is
selected at the given period (i.e., reinforcement learning is
implemented). If delta = 1
, attraction is updated equally for all
strategies (i.e., belief-based learning model is applied).
A real value between 0 and 1. This parameter controls the learning
speed. rho = 0
for "reinforcement" leaning and "belief" based
learning.
A real value between 0 and 1. This parameter controls how much
attraction values at the current period are constrained by the past
attraction values. If phi = 0
, the past attraction values are
ignored. phi = 1
for "reinforcement" leaning and "belief" based
learning.
An initial value of Player 1's attraction for each strategy.
An initial value of Player 2's attraction for each strategy.
An initial value of N.
Choose the range of vertical axis for plots. Available
choices are "fixed"
, "full"
and "free"
.
If plot_range_y = "free"
, the range of y-axis depends on
simulation results. If plot_range_y = "full"
, The range
defined in game
is used for each player, which can be different
between players. With "fixed"
, the same y-axis is used for both
players.
A list containing (1) a list of data frames of strategies chosen by each player, (2) a single long data frame of (1)'s data frames combined, (3) a list of each player's attraction values for each strategy (data frames), (4) a list of probability of each strategy being chosen (data frames), and (5) a plot of the simulation result (ggplot object).
Simulate plays of a normal-form game defined by
normal_form()
in a way expected by an EWA model.