Description Usage Arguments Details Value Note Author(s) References See Also Examples
fmodel4pp
evaluates the (unnormalized) posterior density of the latent trait of a four-parameter binary probit item 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 |
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 m "discrimination" parameters. |
bpar |
Vector of m "difficulty" parameters. |
cpar |
Vector of m lower asymptote parameters. |
dpar |
Vector of m upper asymptote parameters. |
prior |
Function that evaluates the prior distribution of the latent trait. The default is a standard normal distribution. |
... |
Additional arguments to be passed to |
The item response model is parameterized as
P(Y_{ij} = 1|ζ_i) = γ_j + (δ_j - γ_j)Φ(α_j(ζ_i - β_j)),
where α_j is the discrimination parameter (apar
), β_j is the difficulty parameter (bpar
), 0 ≤ γ_j < 1 is the lower asymptote parameter (cpar
), 0 < δ_j ≤ 1 is the upper asymptote parameter (dpar
), ζ_i is the latent trait (zeta
), and Φ is the distribution function of the standard normal distribution. This model is a variant of the logistic model discussed by Barton and Lord (1981).
post |
The log of the unnormalized posterior distribution evaluated at |
prob |
Matrix of size m by 2 array of item response probabilities. |
This function is designed to be called by other functions in the ltbayes package, but could be useful on its own.
Timothy R. Johnson
Barton, M. A. & Lord, R. M. (1981). An upper asymptote for the three-parameter logistic item-response model. New Jersey: Educational Testing Service.
See fmodel1pp
, fmodel2pp
, and fmodel3pp
for related models, and fmodel4pl
for the logistic 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 31 32 | samp <- 5000 # samples from posterior distribution
burn <- 1000 # burn-in samples to discard
alph <- rep(1, 5) # discrimination parameters
beta <- -2:2 # difficulty parameters
gamm <- rep(0.1, 5) # lower asymptote parameters
delt <- rep(0.9, 5) # upper asymptote parameters
post <- postsamp(fmodel4pp, c(1,1,0,0,0),
apar = alph, bpar = beta, 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(fmodel4pp, c(1,1,0,0,0),
apar = alph, bpar = beta, cpar = gamm, dpar = delt),
plot(zeta, post, type = "l")) # profile of log-posterior density
information(fmodel4pp, c(1,1,0,0,0),
apar = alph, bpar = beta, cpar = gamm, dpar = delt) # Fisher information
with(post, mean(zeta)) # posterior mean
postmode(fmodel4pp, c(1,1,0,0,0),
apar = alph, bpar = beta, cpar = gamm, dpar = delt) # posterior mode
with(post, quantile(zeta, probs = c(0.025, 0.975))) # posterior credibility interval
profileci(fmodel4pp, c(1,1,0,0,0), apar = alph,
bpar = beta, 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.