fmodelpcm: Latent Trait Posterior for the Partial Credit Model

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

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

Usage

1
fmodelpcm(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. Elements of y should be integers from 0 to r-1 where r is the number of response categories.

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 prior.

Details

The parameterization of the partial credit model used here is

P(Y_{ij} = y|ζ_i) \propto \exp(yζ_i - ∑_{k=0}^yβ_{jk})

for y = 0, 1,…, r-1 where β_{j0} = 0. The β_{jk} are the item "difficulty" parameters and ζ_i is the latent trait. This model was proposed by Masters (1982).

Value

post

The log of the unnormalized posterior distribution evaluated at zeta.

prob

Matrix of size m by 2 array of item response probabilities.

Note

The number of response categories (r) is inferred from the number of columns in bpar, not from the maximum value in y.

Author(s)

Timothy R. Johnson

References

Masters, G. N. (1982). A Rasch model for partial credit scoring. Psychometrika, 47, 149-174.

See Also

For the rating scale model as a special case use the function fmodelrsm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
samp <- 5000 # samples from posterior distribution
burn <- 1000 # burn-in samples to discard

beta <- matrix(0, 5, 2)

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

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

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

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

ltbayes documentation built on May 2, 2019, 12:40 p.m.

Related to fmodelpcm in ltbayes...