Learn R Programming

ltbayes (version 0.3)

fmodelseq: Latent Trait Posterior for the Sequential Response Model

Description

fmodelseq evaluates the (unnormalized) posterior density of the latent trait of a sequential item response model with a given prior distribution, and computes the probability for each item and response category given the latent trait.

Usage

fmodelseq(zeta, y, bpar, prior = dnorm, ...)

Arguments

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. Element
bpar
Matrix of size m by r-1 of step "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 prior.

Value

  • postThe log of the unnormalized posterior distribution evaluated at zeta.
  • probMatrix of size m by 2 array of item response probabilities.

Details

The parameterization of the sequential model is such that $$P(Y_{ij} > y|Y_{ij} \ge y,\zeta_i) = 1/(1 + \exp(-(\zeta_i-\beta_{j,y+1})))$$ for $y = 0, 1, \dots, r-2$. This model is dicussed by Tutz (1990, 1997) and Verhelst, Glas, and de Vries (1997).

References

Tutz, G. (1990). Sequential item response models with an ordered response. British Journal of Mathematical and Statistical Psychology, 43, 39-55. Tutz, G. (1997). Sequential models for ordered responses. In W. J. van der Linden & R. K. Hambleton (Eds.), Handbook of item response theory (pp. 139-152). New York: Springer-Verlag. Verhelst, N. D., Glas, C. A. W., & de Vries, H. H. (1997). A steps model to analyze partial credit. In W. J. van der Linden & R. K. Hambleton (Eds.), Handbook of item response theory (pp. 123-138). New York: Springer-Verlag.

Examples

Run this code
samp <- 5000 # samples from posterior distribution
burn <- 1000 # burn-in samples to discard

beta <- matrix(0, 5, 2)

post <- postsamp(fmodelseq, c(0,1,2,1,0), 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(fmodelseq, c(0,1,2,1,0), bpar = beta),
	plot(zeta, post, type = "l")) # profile of log-posterior density

information(fmodelseq, c(0,1,2,1,0), bpar = beta) # Fisher information

with(post, mean(zeta)) # posterior mean
postmode(fmodelseq, c(0,1,2,1,0), bpar = beta) # posterior mode

with(post, quantile(zeta, probs = c(0.025, 0.975))) # posterior credibility interval
profileci(fmodelseq, c(0,1,2,1,0), bpar = beta) # profile likelihood confidence interval

Run the code above in your browser using DataLab