Skip to contents

A component is one model with its own population values, trials, tasks, generator and formula. simulate_components() simulates several of them for the same people, so that parameters of different models can be correlated across subjects, and fit_components() fits each on its own.

Usage

recovery_component(
  model,
  pars,
  n_trials,
  sds = NULL,
  tasks = NULL,
  task_col = "task",
  trial_design = NULL,
  generator = NULL,
  formula = NULL,
  name
)

Arguments

model

A bmmodel, built with the column names the fit will use.

pars, n_trials, sds, tasks, task_col, trial_design, generator

As in simulate_recovery(), for this component. pars and sds may be functions with no arguments, evaluated by simulate_components() under its seed.

formula

NULL, or the bmmformula fit_components() fits this component with. NULL uses recovery_formula() with the task column when there are tasks. A custom m3 needs it, and its built-in generator reads the activation formulas from it (see simulate_recovery()).

name

The component's name, which prefixes its terms: name = "m3" turns c_task1 into m3_c_task1. A single syntactic name without _ or ., unique within a set.

Value

A list of class bmmtools_component with the arguments as validated; tasks and task_col are NULL without tasks.

Details

What can be checked without drawing is checked here: the model, the number of trials, the tasks, that a generator exists and takes the trial design, the trial design against n_trials, the formula, and numeric pars and sds against the model. Correlations and covariates belong to the set and are given to simulate_components().

Examples

if (FALSE) { # \dontrun{
recovery_component(
  bmm::sdm(resp_error = "y"),
  pars = c(c = log(3), kappa = log(5)),
  n_trials = 60, sds = c(c = 0.4), name = "sdm"
)
} # }