sim_rtmpt_data_SBC  R Documentation 
Simulate data from an RTMPT model
Description
Simulate data from RTMPT models using rtmpt_model
objects. The difference to sim_rtmpt_data
is that here only scalars are allowed. This makes it usable for
simulationbased calibration (SBC; Talts et al., 2018). You can specify the random seed, number of subjects, number of trials, and some
parameters (same as prior_params
from fit_rtmpt
).
Usage
sim_rtmpt_data_SBC(model, seed, n.subj, n.trials, params = NULL)
Arguments
model 
A list of the class rtmpt_model .

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 prior_params from
fit_rtmpt and has the same defaults. It is not recommended to use the defaults since they lead to many probabilities close or
equal to 0 and/or 1 and to RTs close or equal to 0 . Allowed parameters are:

mean_of_exp_mu_beta : This is the expected exponential rate (E(exp(beta)) = E(lambda) ) and
1/mean_of_exp_mu_beta is the expected process time (1/E(exp(beta)) = E(tau) ). The default
mean is set to 10 , such that the expected process time is 0.1 seconds.

var_of_exp_mu_beta : The groupspecific variance of the exponential rates. Since
exp(mu_beta) is Gamma distributed, the rate of the distribution is just mean divided by variance and
the shape is the mean times the rate. The default is set to 100 .

mean_of_mu_gamma : This is the expected mean parameter of the encoding and response execution times,
which follow a normal distribution truncated from below at zero, so E(mu_gamma) < E(gamma) . The default is 0 .

var_of_mu_gamma : The groupspecific variance of the mean parameter. Its default is 10 .

mean_of_omega_sqr : This is the expected residual variance (E(omega^2) ). The default is 0.005 .

var_of_omega_sqr : The variance of the residual variance (Var(omega^2) ). The default is
0.01 . The default of the mean and variance is equivalent to a shape and rate of 0.0025 and
0.5 , respectivly.

df_of_sigma_sqr : degrees of freedom for the individual variance of the response executions. The
individual variance follows a scaled inverse chisquared distribution with df_of_sigma_sqr degrees of freedom and
omega^2 as scale. 2 is the default and it should be an integer.

sf_of_scale_matrix_SIGMA : The original scaling matrix (S) of the (scaled) inverse Wishart distribution for the process
related parameters is an identity matrix S=I . sf_of_scale_matrix_SIGMA is a scaling factor, that scales this
matrix (S=sf_of_scale_matrix_SIGMA*I ). Its default is 1 .

sf_of_scale_matrix_GAMMA : The original scaling matrix (S) of the (scaled) inverse Wishart distribution for the encoding and
motor execution parameters is an identity matrix S=I . sf_of_scale_matrix_GAMMA is a scaling factor that scales
this matrix (S=sf_of_scale_matrix_GAMMA*I ). Its default is 1 .

prec_epsilon : This is epsilon in the paper. It is the precision of mu_alpha and all xi (scaling parameter
in the scaled inverse Wishart distribution). Its default is also 1 .

add_df_to_invWish : If P is the number of parameters or rather the size of the scale matrix used in the (scaled)
inverse Wishart distribution then add_df_to_invWish is the number of degrees of freedom that can be added to it. So
DF = P + add_df_to_invWish . The default for add_df_to_invWish is 1 , such that the correlations are uniformly
distributed within [1, 1] .

Value
A list of the class rtmpt_sim
containing

data
: the data.frame with the simulated data,

gen_list
: a list containing lists of the grouplevel and subjectspecific parameters for the processrelated parameters and the motorrelated
parameters, and the trialspecific probabilities, processtimes, and motortimes,

specs
: some specifications like the model, seed number, etc.,
Author(s)
Raphael Hartmann
References
Talts, S., Betancourt, M., Simpson, D., Vehtari, A., & Gelman, A. (2018). Validating Bayesian inference algorithms with simulationbased calibration. arXiv preprint arXiv:1804.06788.
Examples
########################################################################################
# DetectGuess variant of the TwoHigh Threshold model.
# The encoding and motor execution times are assumed to be different for each response.
########################################################################################
mdl_2HTM < "
# targets
do+(1do)*g ; 0
(1do)*(1g) ; 1
# lures
(1dn)*g ; 0
dn+(1dn)*(1g) ; 1
# do: detect old; dn: detect new; g: guess
"
model < to_rtmpt_model(mdl_file = mdl_2HTM)
params < list(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 < rtmpt:::sim_rtmpt_data_SBC(model, seed = 123, n.subj = 40,
n.trials = 30, params = params)