Description Usage Arguments Details Value Note Author(s) See Also Examples
posttrace
computes the (unnormalized) log-posterior distribution of the latent trait of an item response model in a given interval.
1 2 |
fmodel |
Function with first 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 |
zeta |
Vector of values of the latent trait at which to compute the log-posterior density. By default this is a sequence of |
zmin |
Minimum value of the latent trait at which to compute the log-posterior density. |
zmax |
Maximum value of the latent trait at which to compute the log-posterior density. |
length |
Length of vector of latent trait values between |
... |
Additional arguments to be passed to |
The primary purpose of this function is in preparing data for plotting the profile of the posterior density or likelihood (if the prior is uniform) for the latent trait. This can be useful for visual inspection of the profile posterior/liklelihood for modes and curvature.
zeta |
Returns the argument |
post |
The log-posterior density at each each value of |
Note that the posterior is the unnormalized posterior distribution. The normalized posterior distribution can be approximated by a density estimate based on a sample of realizations generated using postsamp
.
Timothy R. Johnson
See postsamp
for simulating realizations from the posterior distribution to use to estimate the normalized posterior density.
1 2 3 4 5 6 7 8 9 10 11 12 | 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
# profile of log-likelihood distribution given a sum score of 3
tmp <- posttrace(fmodel3pl, patterns(5, 2, 3), apar = alph, bpar = beta, cpar = gamm,
prior = function(z) 1)
with(tmp, plot(zeta, post, type = "l"))
# profile of log-posterior distribution (normal prior) given a sum score of 3
tmp <- posttrace(fmodel3pl, patterns(5, 2, 3), apar = alph, bpar = beta, cpar = gamm)
with(tmp, plot(zeta, post, type = "l"))
|
Loading required package: mcmc
Loading required package: MHadaptive
Loading required package: MASS
Loading required package: numDeriv
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.