Fit a Hierarchical Beta-MPT Model
Fits a Beta-MPT model (Smith & Batchelder, 2010) based on a standard MPT model file (.eqn) and individual data table (.csv).
betaMPT( eqnfile, data, restrictions, covData, transformedParameters, corProbit = FALSE, alpha = "dgamma(1,.1)T(1,)", beta = "dgamma(1,.1)T(1,)", n.iter = 20000, n.adapt = 2000, n.burnin = 2000, n.thin = 5, n.chains = 3, dic = FALSE, ppp = 0, modelfilename, parEstFile, posteriorFile, autojags = NULL, ... )
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 α of the group-level
beta distributions (in JAGS syntax). Default: Truncated gamma distributions for
α and β with shape 1 and rate .1 and truncated to be larger than 1 (seeplotPrior.
A named vector can be used to specify separate hyperpriors for each MPT
parameter (if unnamed, the order of parameters is determined by the default
order as shown by |
beta |
Hyperprior for β of group-level distributions, see |
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 |
modelfilename |
Name that the modelfile that is made by the function to work with JAGS should get. 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 rguments to be passed to the JAGS sampling function
(i.e., to |
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
a list of the class betaMPT
with the objects:
summary
: MPT tailored summary. Use summary(fittedModel)
mptInfo
: info about MPT model (eqn and data file etc.)
runjags
: the object returned from the MCMC sampler.
Note that the object fittedModel$runjags
is an
runjags object, whereas
fittedModel$runjags$mcmc
is a mcmc.list
as used by the coda package (mcmc)
Daniel W. Heck, Nina R. Arnold, Denis Arnold
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.
Smith, J. B., & Batchelder, W. H. (2010). Beta-MPT: Multinomial processing tree models for addressing individual differences. Journal of Mathematical Psychology, 54, 167-183.
## 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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.