betaMPT {TreeBUGS} | R Documentation |
Fit a Hierarchical Beta-MPT Model
Description
Fits a Beta-MPT model (Smith & Batchelder, 2010) based on a standard MPT model file (.eqn) and individual data table (.csv).
Usage
betaMPT(
eqnfile,
data,
restrictions,
covData,
transformedParameters,
corProbit = FALSE,
alpha = "dgamma(1, 0.1)T(1,)",
beta = "dgamma(1, 0.1)T(1,)",
n.iter = 20000,
n.adapt = 2000,
n.burnin = 2000,
n.thin = 5,
n.chains = 3,
dic = FALSE,
ppp = 0,
monitorIndividual = TRUE,
modelfilename,
parEstFile,
posteriorFile,
autojags = NULL,
...
)
Arguments
eqnfile |
The (relative or full) path to the file that specifies the MPT
model (standard .eqn syntax). Note that category labels must start with a
letter (different to multiTree) and match the column names of |
data |
The (relative or full) path to the .csv file with the data (comma separated; category labels in first row). Alternatively: a data frame or matrix (rows=individuals, columns = individual category frequencies, category labels as column names) |
restrictions |
Specifies which parameters should be (a) constant (e.g.,
|
covData |
Data that contains covariates, for which correlations with
individual MPT parameters will be sampled. Either the path to a .csv file
(comma-separated: rows=individuals in the same order as |
transformedParameters |
list with parameter transformations that should
be computed based on the posterior samples of the group-level means (e.g.,
for testing parameter differences: |
corProbit |
whether to use probit-transformed MPT parameters to compute
correlations (probit-values of |
alpha |
Hyperprior for the shape parameters |
beta |
Hyperprior for |
n.iter |
Number of iterations per chain (including burnin samples). See
|
n.adapt |
number of adaption samples to adjust MCMC sampler in JAGS. The sampler will be more efficient if it is tuned well. However, MCMC sampling will still give correct results even if the warning appears: "Adaptation incomplete." (this just means that sampling efficiency could be better). |
n.burnin |
Number of samples for burnin (samples will not be stored and removed from n.iter) |
n.thin |
Thinning rate. |
n.chains |
number of MCMC chains (sampled in parallel). |
dic |
whether to compute DIC using
|
ppp |
number of samples to compute posterior predictive p-value (see
|
monitorIndividual |
whether to store MCMC samples of the MPT
parameters |
modelfilename |
name of the generated JAGS model file. Default is to write this information to the tempdir as required by CRAN standards. |
parEstFile |
Name of the file to with the estimates should be stored (e.g., "parEstFile.txt") |
posteriorFile |
path to RData-file where to save the model including
MCMC posterior samples (an object named |
autojags |
JAGS first fits the MPT model as usual and then draws MCMC
samples repeatedly until convergence. For this, the function
|
... |
further arguments to be passed to the JAGS sampling function
(i.e., to |
Details
Note that, in the Beta-MPT model, correlations of individual MPT
parameters with covariates are sampled. Hence, the covariates do not affect
the estimation of the actual Beta-MPT parameters. Therefore, the correlation
of covariates with the individual MPT parameters can equivalently be
performed after fitting the model using the sampled posterior parameter
values stored in betaMPT$mcmc
Value
a list of the class betaMPT
with the objects:
-
summary
: MPT tailored summary. Usesummary(fittedModel)
-
mptInfo
: info about MPT model (eqn and data file etc.) -
runjags
: the object returned from the MCMC sampler. Note that the objectfittedModel$runjags
is an runjags object, whereasfittedModel$runjags$mcmc
is amcmc.list
as used by the coda package (mcmc)
Author(s)
Daniel W. Heck, Nina R. Arnold, Denis Arnold
References
Heck, D. W., Arnold, N. R., & Arnold, D. (2018). TreeBUGS: An R package for hierarchical multinomial-processing-tree modeling. Behavior Research Methods, 50, 264–284. doi:10.3758/s13428-017-0869-7
Smith, J. B., & Batchelder, W. H. (2010). Beta-MPT: Multinomial processing tree models for addressing individual differences. Journal of Mathematical Psychology, 54, 167-183. doi:10.1016/j.jmp.2009.06.007
Examples
## Not run:
# fit beta-MPT model for encoding condition (see ?arnold2013):
EQNfile <- system.file("MPTmodels/2htsm.eqn", package = "TreeBUGS")
d.encoding <- subset(arnold2013, group == "encoding", select = -(1:4))
fit <- betaMPT(EQNfile, d.encoding,
n.thin = 5,
restrictions = list("D1=D2=D3", "d1=d2", "a=g")
)
# convergence
plot(fit, parameter = "mean", type = "default")
summary(fit)
## End(Not run)