saving statistics from mcmcsum

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
Post Reply
ElvinaBurkholder
Posts: 1
Joined: Tue May 19, 2020 2:34 am

saving statistics from mcmcsum

Post by ElvinaBurkholder »

Am trying to save some mcmc statistics in a table output from stata…and it is not quite working.
Am using estout after using mcmcsum.
I am running this code and I am getting the right ess(effective sample size) which I believe results from the mcmcsum but do not get any values for the quantiles of the chain. The other statistics (b,se,ci_l,ci_u) are fine too.

quietly runmlwin V1 cons, level2 (clid:cons) level1 (serialno:) discrete(distribution(binomial) link(logit) denominator(cons) pql2) nopause
quietly runmlwin V1 cons, level2 (clid:cons) level1 (serialno:) discrete(distribution(binomial) link(logit) denominator(cons)) mcmc(burnin(500) chain(10000)) initsprevious nopause
estimates store model
mcmcsum
estout model, cells(b se ci_l ci_u ess p50 p97_5 p2_5) stats(N), using "G:\rv1g09May9\paper 2\output5.xls"

Can anyone spot what I am doing wrong? Or suggest an alternative?
ChrisCharlton
Posts: 1213
Joined: Mon Oct 19, 2009 10:34 am

Re: saving statistics from mcmcsum

Post by ChrisCharlton »

estimates store (https://www.stata.com/help.cgi?estimates_store) saves the current model results from a returned eclass (see https://www.stata.com/help.cgi?ereturn), however mcmcsum returns the results as an rclass (see https://www.stata.com/help.cgi?return). What you are actually saving are the results from the runmlwin command. Some of these have slightly different names or might not exist compared to the output from mcmcsum, for example the quantiles are returned in e(quantiles) rather than r(p97_5), r(p_50) and r(p2_5). If you want to save the results from the mcmcsum command to an Excel spreadsheet then you should be able to do this using the put excel command (see https://www.stata.com/help.cgi?putexcel).
Post Reply