postmode: Posterior Mode of the Posterior Distribution of the Latent...

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

Description

postmode numerically computes the posterior mode for a specified posterior distribution of the latent of an item response model.

Usage

1
postmode(fmodel, y, zmin = -5, zmax = 5, ...)

Arguments

fmodel

Function with first argument zeta which returns a list of the (unnormalized) natural logarithm of the posterior distribution evaluted at zeta and a m by r matrix of item category response probabilities. These must be named post and prob, respectively. The posterior should assume an (improper) uniform prior for zeta, and will impose this proper if fmodel has a prior argument.

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.

zmin

Minimum value of ζ to use in searching for the mode.

zmax

Maximum value of ζ to use in searching for the mode.

...

Additional arguments to pass to fmodel or optimize.

Details

This is basically wrapper for optimize to find the maximum of a log-posterior or log-likelihood function of a latent trait. Note that this is the MAP estimator, and also the MLE if the prior distribution is uniform.

Value

zeta

The value of ζ that maximizes the posterior distribution.

post

The value of the log-posterior distribution at the mode.

Warning

Finding the mode is not guaranteed. Inspection of the profile of the posterior (perhaps by using posttrace) is recommended to verify that zmin and zmax are set appropriately. Problems can arise for posterior distributions that are multimodal or where no (finite) mode exists.

Author(s)

Timothy R. Johnson

See Also

See optimize for information on using this function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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

# MAP estimate given a sum score of 3
postmode(fmodel3pl, patterns(5, 2, 3), apar = alph, bpar = beta, cpar = gamm)

# MLE given a sum score of 3
postmode(fmodel3pl, patterns(5, 2, 3), apar = alph, bpar = beta, cpar = gamm,
	prior = function(z) 1)

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

Related to postmode in ltbayes...