Step 2: Generating fake data for parameter and model recovery
rcv_d(
estimate,
data,
colnames,
behrule,
id = NULL,
models,
funcs = NULL,
priors = NULL,
settings = NULL,
algorithm,
lowers,
uppers,
control,
...
)An S3 object of class multiRL.recovery.
simulateA List containing, for each model, the parameters used to
simulate the data.
recoveryA List containing, for each model, the parameters estimated
as optimal by the algorithm.
Estimate method that you want to use, see estimate
A data frame in which each row represents a single trial, see data
Column names in the data frame, see colnames
The agent’s implicitly formed internal rule, see behrule
The ID of the subject whose experimental structure (e.g., trial order) will be used as the template for generating all simulated data. Defaults to the first subject found in the input data.
Reinforcement Learning Models
The functions forming the reinforcement learning model, see funcs
Prior probability density function of the free parameters, see priors
Other model settings, see settings
Algorithm packages that multiRL supports, see algorithm
Lower bound of free parameters in each model.
Upper bound of free parameters in each model.
Settings manage various aspects of the iterative process, see control
Additional arguments passed to internal functions.
# recovery
recovery.MLE <- multiRL::rcv_d(
estimate = "MLE",
data = multiRL::TAB,
colnames = list(
object = c("L_choice", "R_choice"),
reward = c("L_reward", "R_reward"),
action = "Sub_Choose"
),
behrule = list(
cue = c("A", "B", "C", "D"),
rsp = c("A", "B", "C", "D")
),
id = 1, models = list(multiRL::TD, multiRL::RSTD, multiRL::Utility),
priors = list(
list(
alpha = function(x) {stats::rbeta(n = 1, shape1 = 2, shape2 = 2)},
beta = function(x) {stats::rexp(n = 1, rate = 1)}
),
list(
alphaN = function(x) {stats::rbeta(n = 1, shape1 = 2, shape2 = 2)},
alphaP = function(x) {stats::rbeta(n = 1, shape1 = 2, shape2 = 2)},
beta = function(x) {stats::rexp(n = 1, rate = 1)}
),
list(
alpha = function(x) {stats::rbeta(n = 1, shape1 = 2, shape2 = 2)},
beta = function(x) {stats::rexp(n = 1, rate = 1)},
gamma = function(x) {stats::rbeta(n = 1, shape1 = 2, shape2 = 2)}
)
),
settings = list(name = c("TD", "RSTD", "Utility")),
algorithm = "NLOPT_GN_MLSL",
lowers = list(c(0, 0), c(0, 0, 0), c(0, 0, 0)),
uppers = list(c(1, 5), c(1, 1, 5), c(1, 5, 1)),
control = list(core = 10, sample = 100, iter = 100)
)