Roy Levy posted on Monday, September 27, 2010 - 10:53 pm
I am fitting a latent variable model for discrete data (akin to an IRT model) using MCMC and would like to save all the MCMCdraws. I believe I have figured out how to save the draws for the model parameters through the command
PLOT: TYPE = PLOT2;
and then consulting the .gph file. Is there a way to save the draws for the subjects' latent variables (i.e., the factors)?
You would need to use the PLAUSIBLE option of the DATA IMPUTATION command.
Roy Levy posted on Tuesday, September 28, 2010 - 7:11 pm
Thanks for directing me to this feature. However, that seems to provide summary statistics for each subject (i.e., the mean, median, sd, and 2.5% and 97.5%). I am looking for a process that saves each draw. For example, when running 1000 MCMC iterations, I would like to have access to each of the 1000 drawn values for the factor for each subject. Is that available?
No, it gives that in a special file. It also gives the scores for each person in the file named in SAVE.
The PLAUSIBLE option is used to specify the name of the file where summary statistics for the imputed plausible values for the latent variables will be saved and to specify that plausible values will be saved in the files named using the SAVE option.
Roy Levy posted on Friday, October 01, 2010 - 1:18 am
Thanks for pointing me towards the SAVE option in the DATA IMPUTATION command. I think thatís pretty close to what Iím after, though not exactly what I have in mind. To make it concrete, I am running a single chain with 300 iterations. I would like to get exactly those 300 iterations for the factor scores for each subject. In the DATA IMPUTATION command, I specified the following options:
I see that the last column in each of the 300 impute.*.out files has the imputed value for the factor for each subject. But I do not think the (300) imputed values for each subjectís factor are the same as the (300) values for the subject that are used during the MCMC estimation. When I take the mean of a subjectís 300 imputed values, I do not get the exact same value that appears in the latent.dat file. Likewise for the other summaries that appear in the latent.dat file. My interpretation is that (for each subject) the 300 imputed values are draws from that subjectís posterior distribution for the latent factor, but they are a different set of 300 draws than those that were drawn during Gibbs sampling. Is that correct, or have I misunderstood? If I am correct, is there a way to get the draws for the latent factor (for each subject) that were part of the Gibbs sampling?
You are correct that the latent variable scores are not from the 300 iterations you did. They are instead obtained from new MCMC iterations beyond the 300. The thought is that we want to obtain the latent variable scores using parameter values that we are confident have reached their convergence and are as good as possible. There is not a way to output the scores from your first 300 iterations.
Roy Levy posted on Friday, October 01, 2010 - 10:51 pm