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

 From "G Livesey" To "'STATALIST'" Subject st: How to calculate P values and I2 from estore after metareg? Date Tue, 20 Mar 2007 11:20:14 -0000

```Dear Statalist colleagues

Can someone help with what may be somewhat basic questions about metareg

or calculating information from the e store?

I am wanting output the results of metareg to an excel file.
This is to avoid error created by transferring information manually.
xml_tab does not do all that is wanted so I am looking to do something
else.
If I can calculate the wanted values from information stored in e then I
can accumulate
The wanted values from several runs of metareg and output the
information via xmlsave.

Information not returned immediately from the e store, and which have to
be derived are:

I2 (Isquared),
P-value(s) for trend(s)
P-value(s) for any constant(s).
P-value for Q
P-value for tau2

An example of a metareg command used is:

metareg  Y X , wsse(Z)  knapphartung reml lrtau2

Used with a very small dataset example (Y, X, Z) of interest, the
subsequent command ereturn list gives:

ereturn list

scalars:
e(N) =  5
e(tau2) =  .1835974028291436
e(df_m) =  1
e(Q) =  9.833370680444618
e(df_Q) =  3
e(df_r) =  3
e(qKH) =  .9240880161523819
e(remll) =  -2.922534398865104
e(remll_c) =  -4.774354927921407
e(chi2_c) =  3.703641058112606

macros:
e(cmd) : "metareg"
e(depvar) : "Y"
e(predict) : "metareg_p"
e(tau2_method) : "REML"
e(wsse) : "Z"
e(properties) : "b V"

matrices:
e(b) :  1 x 2
e(V) :  2 x 2

functions:
e(sample)

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.

I have a copy of the related technical bulletin on order. However it has
not yet arrived and may be beyond me to interpret it when it arrives.

I do hope someone is able to help.

With my thanks,

Geoff. Livesey

PS copy of metareg table:

Meta-regression	Number of studies =        5

Fit of model without heterogeneity (tau2=0):	Q (3 df)          =
9.83337
Prob > Q          =    0.020
Proportion of variation due to heterogeneity	I-squared         =
0.695

REML estimate of between-study variance:	tau2              =
0.1836

Y       	Coef.   	Std. Err.      t	P>t     [95%
Conf. Interval]

X     	.113846   	.0372789     3.05	0.055    -.0047921
2324842
_cons    	1.008651   	.4453188     2.27	0.108
-.4085525    2.425854

Likelihood-ratio test of tau2=0: chibar2(01) =	3.70  Prob > chibar2 =
0.027

________________________________________________________________________
_____________________

Geoffrey Livesey B.Sc., Ph.D., R.P.H.Nutr.

Member of Virtual Consulting Group, Professional Biosciences
Consultants, Web site www.v-c-g.co.uk Member of SENSE. Professional
Nutrition Consultants. www.sense-nutrition.org.uk Registered Public
Health Nutritionist P294.

INDEPENDENT NUTRITION LOGIC (INLogic) Ltd
NUTRITION RESEARCH MANAGEMENT AND CONSULTANCY
VAT Reg. No. GB 731 9065 38
Registered in England No 4991400

Tel:        +44-1953-606689
Mobile:   +44-7990-964609
Fax:       +44-1953-600218

E:         glivesey@inlogic.co.uk

A:         Pealerswell House
21 Bellrope Lane
Wymondham
Norfolk
NR18 OQX
United Kingdom

W:        www.inlogic.co.uk

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