Description Usage Arguments Details Value Warning Author(s) See Also Examples
postsamp
implements Markov chain Monte Carlo (MCMC) algorithms to simulate realizations from the posterior distribution of the latent trait of an item response model. The distribution is conditional on a single response vector or a subset of response vectors.
1 |
fmodel |
Function with first argument |
y |
A m-dimensional vector or a s by m matrix of item responses, where in the latter case the posterior is computed by conditioning on the event that the response pattern is one of the s response patterns in |
method |
The sampler used. Currently the options are a random-walk Metropolis sampler ( |
control |
List of options for the sampler. See the help file for the sampler used for details. For |
... |
Additional arguments to be pased to |
This function uses MCMC samplers from the mcmc and MHadaptive packages, using the functions metrop
and Metro_Hastings
for random-walk (method = 'metrop'
) and adaptive random-walk (method = 'adapt'
) Metropolis samplers, respectively. Default options are used by postsamp
except that the default burn-in samples is set to zero and the number of samples is set to 1000.
out |
List of the output from the sampler. See the help file for the sampler specified in |
Sampling from the posterior distribution of the latent trait of an item response model typically exhibits quick convergence and efficient mixing. However as with any MCMC algorithm it is important to check the performance of the algorithm. In some cases adjustment of the scale of the proposal density may be necessary to achieve a suitable acceptance rate.
Timothy R. Johnson
See metrop
and Metro_Hastings
for details on the samplers.
1 2 3 4 5 6 7 8 9 10 11 | # simulating 10000 realizations from the posterior distribution from
# a partial credit model using a non-adaptive Metropolis algorithm
zeta <- postsamp(fmodelpcm, c(0,1,2,1,0), bpar = matrix(0, 5, 2),
control = list(nbatch = 10000))
plot(zeta$batch, type = "l") # trace plot
# simulating 10000 realizations from the posterior distribution from
# a partial credit model using an adaptive Metropolis algorithm
zeta <- postsamp(fmodelpcm, c(0,1,2,1,0), bpar = matrix(0, 5, 2),
control = list(iterations = 10000), method = 'adapt')
plot(zeta$trace, type = "l") # trace plot
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.