Learn R Programming

ltbayes (version 0.3)

fmodelrsm: Latent Trait Posterior of the Rating Scale Model

Description

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.

Usage

fmodelrsm(zeta, y, cpar, dpar, 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
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 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 rating scale model is parameterized here as a special case of the partial credit model where $$P(Y_{ij} = y|\zeta_i) \propto \exp(y\zeta_i - \sum_{k=0}^y\beta_{jk})$$ for $y = 0, 1,\dots, r-1$ where $\beta_{jk} = \delta_j + \gamma_k$ and $\gamma_0 = 0$. The parameters $\delta_j$ and $\gamma_k$ are the 'difficulty' (dpar) and 'threshold' (cpar) parameters, respectively. This model was proposed by Andersen (1977) and Andrich (1978a, 1978b).

References

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.

Examples

Run this code
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

Run the code above in your browser using DataLab