Description Usage Arguments Details Value Note Author(s) References Examples
fmodelnrm
evaluates the (unnormalized) posterior density of the latent trait of the nominal response model with given prior distribution, and computes the probabilities for each item and response category given the latent trait.
1 |
zeta |
Latent trait value. |
y |
Matrix of size s by m of response patterns such that the posterior is computed by conditioning on the event that the response pattern is one of the s response patterns. For conditioning on a single response pattern s = 1 and so the matrix is 1 by m. Elements of |
apar |
Matrix of size m by r of "slope" parameters. |
bpar |
Matrix of size m by r of "intercept" 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 prior distribution. |
The nominal response model is parameterized here as
P(Y_{ij} = y|ζ_i) \propto \exp(α_{jy}ζ_i + β_{jy})
where Y_{ij} = 0, 1,…,r-1 and α_{jk} and β_{jk} are the "slope" (apar
) and "intercept" (bpar
) parameters, respectively. The nominal response model is also sometimes called the nominal categories model and was first proposed by Bock (1972).
post |
The log of the unnormalized posterior distribution evaluated at |
prob |
Matrix of size m by 2 array of item response probabilities. |
When estimating the item parameters, constraints on α_{jk} and β_{jk} are necessary for identification, such as α_{j0} = 0 and β_{j0} = 0, but these are not reflected here since a variety of constraints can be used.
Timothy R. Johnson
Bock, R. D. (1972). Estimating item parameters and latent ability when responses are scored in two or more nominal categories. Psychometrika, 37, 29-51.
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
alph <- matrix(c(-1, 0, 1), 5, 3, byrow = TRUE)
beta <- matrix(0, 5, 3)
post <- postsamp(fmodelnrm, c(0,1,2,1,0),
apar = alph, bpar = beta, 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(fmodelnrm, c(0,1,2,1,0), apar = alph, bpar = beta),
plot(zeta, post, type = "l")) # profile of log-posterior density
information(fmodelnrm, c(0,1,2,1,0), apar = alph, bpar = beta) # Fisher information
with(post, mean(zeta)) # posterior mean
postmode(fmodelnrm, c(0,1,2,1,0), apar = alph, bpar = beta) # posterior mode
with(post, quantile(zeta, probs = c(0.025, 0.975))) # posterior credibility interval
profileci(fmodelnrm, c(0,1,2,1,0),
apar = alph, bpar = beta) # profile likelihood confidence interval
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.