rl_define_arms | R Documentation |
Define the Arm Structure
rl_define_arms(arm_input, num_arms, num_trials)
arm_input |
A list of arm definitions where each element contains a data
frame with columns 'probability', 'magnitude', 'alternative', and 'trial'
describing, respectively, the |
num_arms |
(numeric) The number of arms in the task. |
num_trials |
(numeric) The number of trials to simulate. |
Each "arm" is a data frame with the following parameters:
probability
: Either a numeric vector the same length as the number of
simulated trials or a single number between zero and one to define the
probability a reinforcement will be delivered.
magnitude
: Either a numeric vector the same length as the number of
simulated trials or a single number defining the magnitude of the
reinforcement to be delivered with probability probability
if this arm is
chosen.
alternative
: Either a numeric vector the same length as the number of
simulated trials or a single number defining the magnitude of the
reinforcement to be delivered with probability (1 - probability)
if this
arm is chosen.
trial
: A numeric vector describing the trial in which the probabilistic
reinforcement structure defined by the arguments probability
,
magnitude
, and alternative
applies.
# Define an arm that, when selected, leads to a 25% probability of receiving # positive reinforcement with magnitude 1 or zero for the first 75 trials and # a negative reinforcement with magnitude 1 or zero with 75% probability for # the second 75 trials. rl_define_arms( list( data.frame( probability = rep(0.25, 150), magnitude = c(rep(1, 75), rep(-1, 75)), alternative = 0, trial = 1:150 ) ), num_arms = 1, num_trials = 150 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.