fit_rtmpt  R Documentation 
Given model and data, this function calls an altered version of the C++ program by Klauer and Kellen (2018) to sample from
the posterior distribution via a MetropolisGibbs sampler and storing it in an mcmc.list called samples
.
Posterior predictive checks developed by Klauer (2010), deviance information criterion (DIC; Spiegelhalter et al., 2002),
99% and 95% highest density intervals (HDI) together with the median will be provided for the main parameters in a list
called diags
. Optionally, the indices
widely applicable information criterion (WAIC; Watanabe, 2010; Vehtari et al., 2017) and
leaveoneout crossvalidation (LOO; Vehtari et al., 2017) can be saved. Additionally the loglikelihood (LogLik
) can also be stored.
Some specifications of the function call are also saved in specs
.
fit_rtmpt( model, data, n.chains = 4, n.iter = 5000, n.burnin = 200, n.thin = 1, Rhat_max = 1.05, Irep = 1000, prior_params = NULL, indices = FALSE, save_log_lik = FALSE, old_label = FALSE )
model 
A list of the class 
data 
Optimally, a list of class 
n.chains 
Number of chains to use. Default is 4. Must be larger than 1 and smaller or equal to 16. 
n.iter 
Number of samples per chain. Default is 5000. 
n.burnin 
Number of warmup samples. Default is 200. 
n.thin 
Thinning factor. Default is 1. 
Rhat_max 
Maximal Potential scale reduction factor: A lower threshold that needs to be reached before the actual sampling starts. Default is 1.05 
Irep 
Every

prior_params 
Named list with prior parameters. All parameters have default values, that lead to uninformative priors. Vectors are not allowed. Allowed parameters are:

indices 
Model selection indices. If set to 
save_log_lik 
If set to 
old_label 
If set to 
A list of the class rtmpt_fit
containing
samples
: the posterior samples as an mcmc.list
object,
diags
: some diagnostics like deviance information criterion, posterior predictive checks for the frequencies and latencies,
potential scale reduction factors, and also the 99% and 95% HDIs and medians for the grouplevel parameters,
specs
: some model specifications like the model, arguments of the model call, and information about the data transformation,
indices
(optional): if enabled, WAIC and LOO,
LogLik
(optional): if enabled, the loglikelihood matrix used for WAIC and LOO.
summary
includes posterior mean and median of the main parameters.
Raphael Hartmann
Hartmann, R., Johannsen, L., & Klauer, K. C. (2020). rtmpt: An R package for fitting responsetime extended multinomial processing tree models. Behavior Research Methods, 52(3), 1313–1338.
Hartmann, R., & Klauer, K. C. (2020). Extending RTMPTs to enable equal process times. Journal of Mathematical Psychology, 96, 102340.
Klauer, K. C. (2010). Hierarchical multinomial processing tree models: A latenttrait approach. Psychometrika, 75(1), 7098.
Klauer, K. C., & Kellen, D. (2018). RTMPTs: Process models for responsetime distributions based on multinomial processing trees with applications to recognition memory. Journal of Mathematical Psychology, 82, 111130.
Spiegelhalter, D. J., Best, N. G., Carlin, B. P., & Van Der Linde, A. (2002). Bayesian measures of model complexity and fit. Journal of the royal statistical society: Series b (statistical methodology), 64(4), 583639.
Vehtari, A., Gelman, A., & Gabry, J. (2017). Practical Bayesian model evaluation using leaveoneout crossvalidation and WAIC. Statistics and Computing, 27(5), 14131432.
Watanabe, S. (2010). Asymptotic equivalence of Bayes cross validation and widely applicable information criterion in singular learning theory. Journal of Machine Learning Research, 11(Dec), 35713594.
#################################################################################### # DetectGuess variant of the TwoHigh Threshold model. # The encoding and motor execution times are assumed to be equal for each response. #################################################################################### mdl_2HTM < " # targets do+(1do)*g (1do)*(1g) # lures (1dn)*g dn+(1dn)*(1g) # do: detect old; dn: detect new; g: guess " model < to_rtmpt_model(mdl_file = mdl_2HTM) data_file < system.file("extdata/data.txt", package="rtmpt") data < read.table(file = data_file, header = TRUE) data_list < to_rtmpt_data(raw_data = data, model = model) # This might take some time rtmpt_out < fit_rtmpt(model = model, data = data_list, Rhat_max = 1.1) rtmpt_out # Type ?SimData for another working example.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.