fmodel3pl: Latent Trait Posterior of the Three-Parameter Binary Logistic...

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

Description

fmodel3pl evaluates the (unnormalized) posterior density of the latent trait of a three-parameter binary logistic item response model with given prior distribution, and computes the probabilities for each item and response category given the latent trait.

Usage

1
fmodel3pl(zeta, y, apar, bpar, cpar, 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 0 or 1.

apar

Vector of m "discrimination" parameters.

bpar

Vector of m "difficulty" parameters.

cpar

Vector of m lower asymptote (i.e., "guessing") 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 prior.

Details

The item response model is parameterized as

P(Y_{ij} = 1|ζ_i) = γ_j + (1 - γ_j) / (1 + \exp(-α_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), and ζ_i is the latent trait (zeta).

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

This function is designed to be called by other functions in the ltbayes package, but could be useful on its own. This function calls fmodel4pl since it is a special case.

Author(s)

Timothy R. Johnson

See Also

See fmodel1pl, fmodel2pl, and fmodel4pl for related models, and fmodel3pp for a probit variant of this model.

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
25
26
27
28
samp <- 5000 # samples from posterior distribution
burn <- 1000 # burn-in samples to discard

alph <- c(1.27,1.34,1.14,1,0.67)   # discrimination parameters
beta <- c(1.19,0.59,0.15,-0.59,-2) # difficulty parameters
gamm <- c(0.1,0.15,0.15,0.2,0.01)  # lower asymptote parameters

post <- postsamp(fmodel3pl, c(0,0,1,1,1), 
	apar = alph, bpar = beta, cpar = gamm,
	control = list(nbatch = samp + burn, scale = 3))

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(fmodel3pl, c(0,0,1,1,1), apar = alph, bpar = beta, cpar = gamm),
	plot(zeta, post, type = "l")) # profile of log-posterior density

information(fmodel3pl, c(0,0,1,1,1), apar = alph, bpar = beta, cpar = gamm) # Fisher information

with(post, mean(zeta)) # posterior mean
postmode(fmodel3pl, c(0,0,1,1,1), apar = alph, bpar = beta, cpar = gamm) # posterior mode

with(post, quantile(zeta, probs = c(0.025, 0.975))) # posterior credibility interval
profileci(fmodel3pl, c(0,0,1,1,1), apar = alph, 
	bpar = beta, cpar = gamm) # profile likelihood confidence interval

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

Related to fmodel3pl in ltbayes...