Define the Arm Structure

rl_define_arms(arm_input, num_arms, num_trials)

Arguments

arm_input

A list of arm definitions where each element contains a data frame with columns 'probability', 'magnitude', 'alternative', and 'trial' describing, respectively, the probability of receiving a reward magnitude with the alternative for each trial.

num_arms

(numeric) The number of arms in the task.

num_trials

(numeric) The number of trials to simulate.

Details

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.

Examples


# 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
)
#> <quosure>
#> expr: ^list(data.frame(probability = rep(0.25, 150), magnitude = c(rep(1,
#>           75), rep(-1, 75)), alternative = 0, trial = 1:150))
#> env:  0x7fb8c616fb48