Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Using -estout- with multiply-imputed data: how to report r2 and r2_a
From
[email protected] (Yulia Marchenko, StataCorp LP)
To
[email protected]
Subject
Re: st: Using -estout- with multiply-imputed data: how to report r2 and r2_a
Date
Wed, 02 Mar 2011 15:22:39 -0600
Nic <[email protected]> uses the user-written command -mibeta- with another
user-written command -estout- and is having trouble accessing some of the
estimation results:
> I am trying to create some tables using -estout- which compare several OLS
> models. I'd like to include 'R-Square' and 'Adjusted R-Square' in the
> summary statistics. Acock (A Gentle Introduction to Stata, 2010) says to use
> the -mibeta- command written by Julia Marchenko. This does indeed produce
> the results in Stata's screen output, but I cannot figure out how to get the
> -estout- package to include these summary statistics in its output. Here is
> my .do file (as used on a previously multiply-imputed data set):
>
> -----
> eststo clear
> eststo: quietly mibeta d1 g c* s*, fisherz miopts(post)
> eststo: quietly mibeta d1 g c* s* f*, fisherz miopts(post)
> eststo: quietly mibeta d1 g c* s* f* e*, fisherz miopts(post)
> esttab using table7.csv, cells("b(fmt(3)) se(fmt(2)) p(fmt(3)star)")
> drop(_cons) noobs stardetach starlevels(* 0.05) nonumbers mlabels("Model 1"
> "Model 2" "Model 3") stats(r2 r2_a, labels("R-Square" "Adjusted R-Square"))
> ----
> I think I have figured out that -eststo- will not work with -mibeta- unless
> the 'miopts(post)' option is used. Without this option, my tables would not
> include any data at all (i.e., the b, se, and p would all be blank). I can
> now produce a table with b, se, and p for all the models, but the r2 and
> r2_a are still blank. I believe this means that they are not being 'posted'?
-mibeta- is a wrapper for -mi estimate: regress-. It does not save any
additional estimation results other than those saved by -mi estimate:
regress-; see "Saved results" in -help mibeta-. The -mi estimate- command
does not store matrices -e(b)- and -e(V)- by default. Multiple-imputation
(MI) estimates and their VCE are stored in -e(b_mi)- and -e(V_mi)-,
respectively. You can use the -post- option with -mi estimate- to post
multiple-imputation results to -e(b)- and -e(V)-. As Nic already found out,
this option can be specified with -mibeta- as -miopts(post)-. Scalars -e(r2)-
and -e(r2_a)- are not saved by -mi estimate- and thus cannot be accessed after
-mibeta-.
> So my question is: is it possible to use the -estout- package to report the
> r2 and r2_a summary statistics for multiply-imputed data? If so, how?
I'll consider adding an option to -mibeta- to store the e(r2) and e(r2_a)
scalars in the future. Meanwhile, the current version of mibeta.ado can be
modified to accommodate this. The easiest way to do this is to add the
following line:
mata: st_numscalar("e(`var')", st_numscalar("`m'"))
to the end of the _di_stats subprogram in mibeta.ado (between lines 146 and
147). This will instruct -mibeta- to store the mean estimates of R2 and
adjusted R2 in -e(r2_1)- and -e(r2_2)-, respectively. The location of the
current version of mibeta.ado can be found by typing:
. which mibeta.ado
Nic's specification of the -stats()- option in -esttab- would then change to
. esttab ..., ... stats(r2_1 r2_2, labels("R-Square" "Adjusted R-Square"))
I'll send Nic the modified mibeta.ado privately.
As a side note, you should be careful when using the -post- option with -mi
estimate: <command>-. It does provide a way to access some of
<command>-specific postestimation tools but not all of them may be applicable
within multiple-imputation context. This is one of the reasons why -mi
estimate- does not allow them by default. Remember, with or without -post-,
the results are still multiple-imputation results.
For example, along with coefficients and standard errors Nic is also accessing
p-values. P-values, as reported by -mi estimate-, are computed using MI
degrees of freedom, which are specific to each coefficient and are saved in
the -e(df_mi)- matrix. Unless -esttab- has a special logic to accommodate
coefficient-specific degrees of freedom, the degrees of freedom and p-values
reported by -esttab- by default will not, in general, correspond to the
results from -mi estimate-.
-- Yulia
[email protected]
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/