rcv_d {binaryRL}R Documentation

Step 2: Generating fake data for parameter and model recovery

Description

This function fits multiple sets of simulated data using a loop. You need to provide a list of simulation functions, fitting functions, and parameter bounds. If you prefer to handle the process manually, you can use the internal functions 'simulate_list' and 'recovery_data'.

For more information, please refer to the GitHub repository: https://github.com/yuki-961004/binaryRL

Usage

rcv_d(
  data,
  id = 1,
  n_trials = 288,
  simulate_models = list(TD, RSTD, Utility),
  simulate_lower = list(c(0, 0), c(0, 0, 0), c(0, 0, 0)),
  simulate_upper = list(c(1, 1), c(1, 1, 1), c(1, 1, 1)),
  fit_models = list(TD, RSTD, Utility),
  fit_lower = list(c(0, 0), c(0, 0, 0), c(0, 0, 0)),
  fit_upper = list(c(1, 1), c(1, 1, 1), c(1, 1, 1)),
  model_names = c("TD", "RSTD", "Utility"),
  funcs = NULL,
  initial_params = NA,
  initial_size = 50,
  iteration_s = 10,
  iteration_f = 10,
  seed = 1,
  nc = 1,
  algorithm
)

Arguments

data

[data.frame] raw data. This data should include the following mandatory columns:

  • 1. L-BFGS-B (from 'stats::optim');

  • 2. Simulated Annealing ('GenSA');

  • 3. Genetic Algorithm ('GA');

  • 4. Differential Evolution ('DEoptim');

  • 5. Particle Swarm Optimization ('pso');

  • 6. Bayesian Optimization ('mlrMBO');

  • 7. Covariance Matrix Adapting Evolutionary Strategy ('cmaes');

  • 8. Nonlinear Optimization ('nloptr')

id

[vector] Specifies which subject is being analyzed. In recovery analyses, individual subject information is not needed; trials from the same experimental procedure can be used across all "subjects". Therefore, 'id' can be set to '1'. For example, 'id = 1'.

n_trials

[integer] number of total trials

simulate_models

[list] A collection of functions used to generate simulated data.

simulate_lower

[list] The lower bounds for simulate models

simulate_upper

[list] The upper bounds for simulate models

fit_models

[list] A collection of functions applied to fit models to the data.

fit_lower

[list] The lower bounds for model fit models

fit_upper

[list] The upper bounds for model fit models

model_names

[list] the names of fit modals

funcs

[vector] A character vector containing the names of all user-defined functions required for the computation.

initial_params

[vector] Initial values for the free parameters. These need to be set only when using L-BFGS-B. Other algorithms automatically generate initial values. for 'L-BFGS-B', 'GenSA', set 'initial = c(0, 0, ...)'

initial_size

[integer] Initial values for the free parameters. These need to be set only when using L-BFGS-B. Other algorithms automatically generate initial values. for 'Bayesian', 'GA', set 'initial = 50'

iteration_s

[integer] the number of iteration in simulation (simulate)

iteration_f

[integer] the number of iteration in algorithm (fit)

seed

[integer] random seed. This ensures that the results are reproducible and remain the same each time the function is run. default: 'seed = 123'

nc

[integer] Number of CPU cores to use for parallel computation.

algorithm

[character] Choose an algorithm package from 'L-BFGS-B', 'GenSA', 'GA', 'DEoptim', 'PSO', 'Bayesian', 'CMA-ES'. In addition, any algorithm from the 'nloptr' package is also supported. If your chosen 'nloptr' algorithm requires a local search, you need to input a character vector. The first element represents the algorithm used for global search, and the second element represents the algorithm used for local search.

Value

A list where each element is a data.frame. Each data.frame within this list records the results of fitting synthetic data (generated by Model A) with Model B.


[Package binaryRL version 0.8.3 Index]