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