Description Usage Arguments Details Value Note Author(s) References Examples
fmodelpcm
evaluates the (unnormalized) posterior density of the latent trait of a rating scale item response model with a given prior distribution, and computes the probability for each item and response category given the latent trait.
1 |
zeta |
Latent trait value. |
y |
Vector of length m for a single response pattern, or matrix of size s by m of a set of s item response patterns. In the latter case the posterior is computed by conditioning on the event that the response pattern is one of the s response patterns. Elements of |
cpar |
Vector of length r-1 of category "threshold" parameters. |
dpar |
Vector of length m of item "difficulty" parameters. |
prior |
Function that evaluates the prior distribution of the latent trait. The default is the standard normal distribution. |
... |
Additional arguments to be passed to |
The rating scale model is parameterized here as a special case of the partial credit model where
P(Y_{ij} = y|ζ_i) \propto \exp(yζ_i - ∑_{k=0}^yβ_{jk})
for y = 0, 1,…, r-1 where β_{jk} = δ_j + γ_k and γ_0 = 0. The parameters δ_j and γ_k are the 'difficulty' (dpar
) and 'threshold' (cpar
) parameters, respectively. This model was proposed by Andersen (1977) and Andrich (1978a, 1978b).
post |
The log of the unnormalized posterior distribution evaluated at |
prob |
Matrix of size m by 2 array of item response probabilities. |
The number of response categories (r) is inferred from the number of columns in dpar
, not from the maximum value in y
.
Because the rating scale model can be viewed as a special case of the partial credit model, the latter can be used with fmodelpcm
to specify more general models.
Timothy R. Johnson
Andersen, E. B. (1977). Sufficient statistics and latent trait models. Psychometrika, 42, 69-81.
Andrich, D. (1978a). A rating formulation for ordered response categories. Psychometrika, 43, 561-573.
Andrich, D. (1978b). Application of a psychometric rating scale model to ordered categories which are scored with successive integers. Applied Psychological Measurement, 2, 581-594.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | samp <- 5000 # samples from posterior distribution
burn <- 1000 # burn-in samples to discard
gamm <- c(0, 0)
delt <- rep(0, 5)
post <- postsamp(fmodelrsm, c(0,1,2,1,0), cpar = gamm, dpar = delt,
control = list(nbatch = samp + burn))
post <- data.frame(sample = 1:samp,
zeta = post$batch[(burn + 1):(samp + burn)])
with(post, plot(sample, zeta), type = "l") # trace plot of sampled realizations
with(post, plot(density(zeta, adjust = 2))) # density estimate of posterior distribution
with(posttrace(fmodelrsm, c(0,1,2,1,0), cpar = gamm, dpar = delt),
plot(zeta, post, type = "l")) # profile of log-posterior density
information(fmodelrsm, c(0,1,2,1,0), cpar = gamm, dpar = delt) # Fisher information
with(post, mean(zeta)) # posterior mean
postmode(fmodelrsm, c(0,1,2,1,0), cpar = gamm, dpar = delt) # posterior mode
with(post, quantile(zeta, probs = c(0.025, 0.975))) # posterior credibility interval
profileci(fmodelrsm, c(0,1,2,1,0),
cpar = gamm, dpar = delt) # profile likelihood confidence interval
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.