Page 1 of 1

saving statistics from mcmcsum

Posted: Fri May 29, 2020 4:03 am
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?

Re: saving statistics from mcmcsum

Posted: Tue Jun 16, 2020 12:07 pm
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).