simulate_bandit2arm: Simulate two-armed bandit task data

Description Usage Arguments Value Examples

View source: R/simulate_bandit2arm.R

Description

This function allows users to simulate behavior of n_subj individuals performing the two-armed bandit task.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
simulate_bandit2arm(
  seed.value = 528,
  n_subj = 100,
  n_tr = 200,
  x1_mean = 1,
  x1_sd = 1,
  x2_mean = 0,
  x2_sd = 1,
  trials.unique = TRUE
)

Arguments

n_subj

number of subjects. Defaults to 100.

n_tr

number of trials. Defaults to 200.

x1_mean

mean value of the re-parameterized variable for beta. Defaults to 1.

x1_sd

standard deviation of the re-parameterized variable for beta. Defaults to 1.

x2_mean

mean value of the re-parameterized variable for alpha. Defaults to 0.

x2_sd

standard deviation of the re-parameterized variable for beta. Deafults to 1.

seed_value

user-specified random value that stores data information for replication. Defaults to 528.

trials_unique

keep only the unique trials where an individual made a choice. Defaults to TRUE.

Value

A list containing the two-arm bandit dataset, the number of simulated subjects, the 'true' values for parameter 1 (x1) and the 'true' values for parameter 2 (x2). The dataset contains the trial number (Trial), the expected value (Value), the choice probability (Pr), the presented stimuli (Option), the chosen stimuli (Action), and the given reward (Reward).

Examples

1
2
3
4
5
# Simulate 50 subjects performing 100 trials of the two-armed bandit task
  data <- simulate_bandit2arm(n_subj = 50, n_tr = 100)

# View generated simulated dataset of participant 10
  View(data$bandit2arm[[10]])

psuthaharan/bandit2arm documentation built on Jan. 26, 2021, 1:36 a.m.