View source: R/simulate_rtmpt.R
sim_ertmpt_data | R Documentation |
Simulate data from RT-MPT models using ertmpt_model
objects.
You can specify the random seed, number of subjects, number of trials per tree, and some
parameters (mainly the same as prior_params
from fit_ertmpt
).
sim_ertmpt_data(model, seed, n.subj, n.trials, params = NULL)
model |
A list of the class |
seed |
Random seed number. |
n.subj |
Number of subjects. |
n.trials |
Number of trials per tree. |
params |
Named list of parameters from which the data will be generated. This must be the same named list as
|
A list of the class ertmpt_sim
containing
data
: the data.frame with the simulated data,
gen_list
: a list containing lists of the group-level and subject-specific parameters for the process-related parameters and the motor-related
parameters, and the trial-specific probabilities, process-times, and motor-times,
specs
: some specifications like the model, seed number, etc.,
Raphael Hartmann
########################################################################################
# Detect-Guess variant of the Two-High Threshold model.
# The encoding and motor execution times are assumed to be different for each response.
########################################################################################
mdl_2HTM <- "
# targets
do+(1-do)*g ; 0
(1-do)*(1-g) ; 1
# lures
(1-dn)*g ; 0
dn+(1-dn)*(1-g) ; 1
# do: detect old; dn: detect new; g: guess
"
model <- to_ertmpt_model(mdl_file = mdl_2HTM)
# random group-level parameters
params <- list(mean_of_mu_alpha = 0,
#var_of_mu_alpha = 1
mean_of_exp_mu_beta = 10,
var_of_exp_mu_beta = 10,
mean_of_mu_gamma = 0.5,
var_of_mu_gamma = 0.0025,
mean_of_omega_sqr = 0.005,
var_of_omega_sqr = 0.000025,
df_of_sigma_sqr = 10,
sf_of_scale_matrix_SIGMA = 0.1,
sf_of_scale_matrix_GAMMA = 0.01,
prec_epsilon = 10,
add_df_to_invWish = 5)
sim_dat <- sim_ertmpt_data(model, seed = 123, n.subj = 40, n.trials = 30, params = params)
# fixed group-level parameters
params <- list(mean_of_mu_alpha = 0,
mean_of_exp_mu_beta = 10,
mean_of_mu_gamma = 0.5,
mean_of_omega_sqr = 0.005,
df_of_sigma_sqr = 10,
sf_of_scale_matrix_SIGMA = 0.1,
sf_of_scale_matrix_GAMMA = 0.01,
prec_epsilon = 10,
add_df_to_invWish = 5,
SIGMA = diag(9), # independent process-related params
GAMMA = diag(2)) # independent motor time params
sim_dat <- sim_ertmpt_data(model, seed = 123, n.subj = 40, n.trials = 30, params = params)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.