fit_drtmpt | R Documentation |
Given model and data, this function a Hamiltonian MCMC sampler and stores the samples 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
leave-one-out cross-validation (LOO; Vehtari et al., 2017) can be saved. Additionally the log-likelihood (LogLik
) can also be stored.
Some specifications of the function call are also saved in specs
.
fit_drtmpt(
model,
data,
n.chains = 4,
n.iter = 1000,
n.phase1 = 1000,
n.phase2 = 2000,
n.thin = 1,
Rhat_max = 1.1,
Irep = 1000,
prior_params = NULL,
flags = NULL,
control = NULL
)
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 1000. |
n.phase1 |
Number of samples for phase 1 (adaptation phase). Default is 1000. |
n.phase2 |
Number of samples for phase 2. Default is 2000. |
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:
|
flags |
Either NULL or a list of
|
control |
Either NULL or a list of
|
A list of the class drtmpt_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 group-level 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 log-likelihood matrix used for WAIC and LOO.
summary
includes posterior mean and median of the main parameters.
Raphael Hartmann
Klauer, K. C. (2010). Hierarchical multinomial processing tree models: A latent-trait approach. Psychometrika, 75(1), 70-98.
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), 583-639.
Vehtari, A., Gelman, A., & Gabry, J. (2017). Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC. Statistics and Computing, 27(5), 1413-1432.
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), 3571-3594.
####################################################################################
# Detect-Guess variant of the Two-High Threshold model.
# The encoding and motor execution times are assumed to be equal for each response.
####################################################################################
mdl_2HTM <- "
# targets
do+(1-do)*g
(1-do)*(1-g)
# lures
(1-dn)*g
dn+(1-dn)*(1-g)
# do: detect old; dn: detect new; g: guess
"
model <- to_drtmpt_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_drtmpt_data(raw_data = data, model = model)
# This might take some time
drtmpt_out <- fit_drtmpt(model = model, data = data_list, Rhat_max = 1.1)
drtmpt_out
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.