simulate_twochoiceRL: Simulate behavior in a two-choice decision task

Description Usage Arguments Value Examples

View source: R/simulate_twochoiceRL.R

Description

This function allows users to simulate behavior of n_subj individuals performing a two-choice task.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
simulate_twochoiceRL(
  seed_value = 528,
  n_subj = 100,
  n_tr = 200,
  mean_x = c(1, 0),
  stdev_x = c(1, 1),
  mean_payoff = c(1, -1),
  stdev_payoff = c(2, 2),
  trials_unique = TRUE,
  progress_bar = TRUE
)

Arguments

seed_value

user-specified random value that ensures replication of results. Defaults to 528.

n_subj

number of subjects. Defaults to 100.

n_tr

number of trials. Defaults to 200.

mean_x

mean of the distribution that we are sampling from for the re-parameterized parameters. Defaults to 1 and 0 for x1 and x2, respectively.

stdev_x

standard deviation of the distribution that we are sampling from for the re-parameterized parameters. Defaults to 1 and 1 for x1 and x2, respectively.

mean_payoff

mean payoff for both choices. Defaults to 1 and -1 for choice 1 and choice 2, respectively.

stdev_payoff

standard deviation payoff for both choices. Defaults to 2 and 2 for choice 1 and choice 2, respectively.

trials_unique

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

progress_bar

track completion time of estimation. Defaults to TRUE.

Value

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

Examples

1
2
3
4
5
# Simulate 100 subjects performing 200 trials of a two-choice decision task
  data_sim <- simulate_twochoiceRL(n_subj = 100, n_tr = 200)

# View behavioral data of subject 100
  View(data_sim$twochoiceRL[[100]])

psuthaharan/twochoiceRL documentation built on Dec. 22, 2021, 9:56 a.m.