Geoff. Livesey writes (in part):
___________________________________________________________________
I am wanting output the results of metareg to an excel file.
I can calculate certain P values as follows:
gen slope = _b[X]
gen slope_se =_se[X]
gen slope_t = slope/slope_se
gen slope_p = 2* ttail(df_r,abs(slope_t))
gen const =_b[_cons]
gen const_se =_se[_cons]
gen const_t = const/const_se
gen const_p = 2*ttail(df_r,abs(const_t))
gen Q_p = chi2tail(df_r,e(Q))
However, it is not clear to me how to calculate:
I2 - I can get this approximately via an inelegant route,
however I should like to know more and how to obtain this
information directly from that stored in e. How is this calculated? The
precise value given in the metareg immediately prior to the above
ereturn information is 0.695
P_Tau2 - Likewise, how is P for Tau2 derived from
information in the e store?
The precise value given in the metareg immediately prior to the above
ereturn information is 0.1836
Q_p - The value of P for Q I calculate is given by the formula above,
that is it works with this example but is the procedure correct? The
precise value given by metareg immediately prior to the above ereturn
information is 0.020.
_____________________________________________________________________
The code in metareg shows:
For I2:
scalar i2 = max( ( e(Q) - e(df_Q) ) / e(Q), 0)
For P_Tau2:
scalar pval = chi2tail(1, e(chi2_c))*0.5
if e(chi2_c) <=0 {
scalar `pval'= 1
}
Which can be written in one line as:
scalar pval = cond(e(chi2_c) <= 0, 1, chi2tail(1, e(chi2_c))*0.5)
For Q_p:
scalar pval = chi2tail(e(df_Q), e(Q))
Which indicates that you are using the wrong return value for df.
All the needed values are in the ereturn results.
Tom
-----------------------------------------
CONFIDENTIALITY NOTE: This e-mail message, including any
attachment(s), contains information that may be confidential,
protected by the attorney-client or other legal privileges, and/or
proprietary non-public information. If you are not an intended
recipient of this message or an authorized assistant to an intended
recipient, please notify the sender by replying to this message and
then delete it from your system. Use, dissemination, distribution,
or reproduction of this message and/or any of its attachments (if
any) by unintended recipients is not authorized and may be
unlawful.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/