Description Usage Arguments Details Value Author(s) References See Also Examples
fmodelgrl
evaluates the (unnormalized) posterior density of the latent trait of a logistic graded 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 |
apar |
Vector of length m of "discrimination" parameters. |
bpar |
Matrix of size m by r-1 of "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 parameterization of the graded response model used here is
P(Y_{ij} ≥ y|ζ_i) = 1/(1 + \exp(-α_j(ζ_i-β_{jy})))
for y = 1,…,r-1, where α_j and β_{jk} are the "discrimination" and "difficulty" parameters, respectively, for the k-th cumulative item response function. Note that the difficulty parameters must meet the constraint that β_{j,k+1} ≥ β_{jk} for k = 1,…,r-1 so that all item response probabilities are non-negative. This model was first proposed by Samejima (1969, 1972).
post |
The log of the unnormalized posterior distribution evaluated at |
prob |
Matrix of size m by 2 array of item response probabilities. |
Timothy R. Johnson
Samejima, F. (1969). Estimation of ability using a response pattern of graded scores. Psychometrikka Monograph, No. 17.
Samejima, F. (1972). A general model for free-response data. Psychometrika Monograph, No. 18.
See fmodelgrp
for the probit variant of this model.
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 27 28 29 30 | samp <- 5000 # samples from posterior distribution
burn <- 1000 # burn-in samples to discard
alph <- rep(1, 3) # discrimination parameters
beta <- matrix(c(-1,1), 3, 2, byrow = TRUE) # difficulty parameters
post <- postsamp(fmodelgrl, c(0,1,2),
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(fmodelgrl, c(0,1,2),
apar = alph, bpar = beta),
plot(zeta, post, type = "l")) # profile of log-posterior density
information(fmodelgrl, c(0,1,2),
apar = alph, bpar = beta) # Fisher information
with(post, mean(zeta)) # posterior mean
postmode(fmodelgrl, c(0,1,2),
apar = alph, bpar = beta) # posterior mode
with(post, quantile(zeta, probs = c(0.025, 0.975))) # posterior credibility interval
profileci(fmodelgrl, c(0,1,2), 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.