priorPredictive {TreeBUGS} | R Documentation |
Prior Predictive Samples
Description
Samples full data sets (i.e., individual response frequencies) or group-level MPT parameters based on prior distribution for group-level parameters.
Usage
priorPredictive(
prior,
eqnfile,
restrictions,
numItems,
level = "data",
N = 1,
M = 100,
nCPU = 4
)
Arguments
prior |
a named list defining the priors. For the traitMPT, the
default is |
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 |
restrictions |
Specifies which parameters should be (a) constant (e.g.,
|
numItems |
vector with the number of items per MPT tree (either named or assigned to alphabetically ordered tree labels) |
level |
either |
N |
number of participants per replication |
M |
number of prior predictive samples (i.e., data sets with |
nCPU |
number of CPUs used for parallel sampling. For large models and many participants, this may require a lot of memory. |
Value
a list of M
matrices with individual frequencies
(rows=participants, columns=MPT categories). A single matrix is returned if
M=1
or level="parameter"
.
Examples
eqnfile <- system.file("MPTmodels/2htm.eqn",
package = "TreeBUGS"
)
### beta-MPT:
prior <- list(
alpha = "dgamma(1,.1)",
beta = "dgamma(1,.1)"
)
### prior-predictive frequencies:
priorPredictive(prior, eqnfile,
restrictions = list("g=.5", "Do=Dn"),
numItems = c(50, 50), N = 10, M = 1, nCPU = 1
)
### prior samples of group-level parameters:
priorPredictive(prior, eqnfile,
level = "parameter",
restrictions = list("g=.5", "Do=Dn"),
M = 5, nCPU = 1
)
### latent-trait MPT
priorPredictive(
prior = list(
mu = "dnorm(0,1)", xi = "dunif(0,10)",
df = 3, V = diag(2)
),
eqnfile, restrictions = list("g=.5"),
numItems = c(50, 50), N = 10, M = 1, nCPU = 1
)