Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: How to calculate P values and I2 from estore after metareg?


From   Roger Harbord <[email protected]>
To   [email protected]
Subject   Re: st: RE: How to calculate P values and I2 from estore after metareg?
Date   Wed, 21 Mar 2007 08:29:43 +0000

Many thanks Tom.

Just to clarify that when e(df_r) is set, it's the same as e(df_Q). It's
deliberately not set if you specify the "z" option to turn off the
Knapp-Hartung variance adjustment and associated use of t-tests instead
of  z-tests for the coefficients,  as it's setting e(df_r) that makes
-ereturn display- report t and F rather than z and chi2.

STB-42 concerned the original version of -metareg-, written by Stephen
Sharp. I've finally got around to drafting an article on the update to
-metareg- and hope to submit it to Stata Journal before too long.

Roger.

Steichen, Thomas J. wrote:
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


*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index