View source: R/process_simulate_list.R
simulate_list | R Documentation |
This function is responsible for generating synthetic (fake) data using random numbers. For all parameters except the last one, their values are drawn from a uniform distribution within their respective specified ranges.
The last parameter, representing the temperature (tau
) in the soft-max
function, is drawn from an exponential distribution. If its upper
bound
is set to 1, it implies tau
is sampled from Exp(1)
(an exponential
distribution with a rate parameter of 1). If its lower
bound is set
to 1, this means that after tau
is randomly generated, it is shifted
to the right by adding 1 (i.e., tau+1
), establishing a minimum value.
simulate_list(
data,
id = 1,
obj_func,
n_params,
n_trials,
lower,
upper,
iteration = 10,
seed = 123
)
data |
[data.frame] This data should include the following mandatory columns:
|
id |
[vector] Specifies which subject's data to use. In parameter and model recovery analyses, the specific subject ID is often irrelevant. Although the experimental trial order might have some randomness for each subject, the sequence of reward feedback is typically pseudo-random. The default value for this argument is default: |
obj_func |
[function] The objective function that the optimization algorithm package accepts.
This function must strictly take only one argument, |
n_params |
[integer] The number of free parameters in your model. |
n_trials |
[integer] The total number of trials in your experiment. |
lower |
[vector] Lower bounds of free parameters |
upper |
[vector] Upper bounds of free parameters |
iteration |
[integer] This parameter determines how many simulated datasets are created for subsequent model and parameter recovery analyses. |
seed |
[integer] Random seed. This ensures that the results are reproducible and remain the same each time the function is run. default: |
a list with fake data generated by random free parameters
## Not run:
list_simulated <- binaryRL::simulate_list(
data = binaryRL::Mason_2024_G2,
obj_func = binaryRL::RSTD,
n_params = 3,
n_trials = 360,
lower = c(0, 0, 1),
upper = c(1, 1, 1),
iteration = 100
)
df_recovery <- binaryRL::recovery_data(
list = list_simulated,
fit_model = binaryRL::RSTD,
model_name = "RSTD",
n_params = 3,
n_trials = 360,
lower = c(0, 0, 1),
upper = c(1, 1, 5),
iteration = 100,
nc = 1,
algorithm = "L-BFGS-B"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.