metareg: Fixed and random effects model for meta-analysis

Description Usage Arguments Value References Note Author(s) Examples

View source: R/metareg.R

Description

Given k=n studies with b_1, ..., b_N being β's and se_1, ..., se_N standard errors from regression, the fixed effects model uses inverse variance weighting such that w_1=1/se_1^2, ..., w_N=1/se_N^2 and the combined β as the weighted average, β_f=(b_1*w_1+...+b_N*w_N)/w, with w=w_1+...+w_N being the total weight, the se for this estimate is se_f=√{1/w}. A normal z-statistic is obtained as z_f=β_f/se_f, and the corresponding p value p_f=2*pnorm(-abs(z_f)). For the random effects model, denote q_w=w_1*(b_1-β_f)^2+...+w_N*(b_N-β_f)^2 and dl=max(0,(q_w-(k-1))/(w-(w_1^2+...+w_N^2)/w)), corrected weights are obtained such that {w_1}_c=1/(1/w_1+dl), ..., {w_N}_c=1/(1/w_N+dl), totaling w_c={w_1}_c+...+{w_N}_c. The combined β and se are then β_r=(b_1*{w_1}_c+...+b_N*{w_N}_c)/w_c and se_r=sqrt(1/wc), leading to a z-statistic z_r=β_r/se_r and a p-value p_r=2*pnorm(-abs(z_r)). Moreover, a p-value testing for heterogeneity is p_{heter}=pchisq(q_w,k-1,lower.tail=FALSE).

Usage

1
metareg(data, N, verbose="Y", prefixb="b", prefixse="se")

Arguments

data

Data frame to be used

N

Number of studies

verbose

A control for screen output

prefixb

Prefix of estimate; default value is "b"

prefixse

Prefix of standard error; default value is "se"

The function accepts a wide format data with estimates as b1,...,bN and standard errors as se1,...,seN. More generally, they can be specified by prefixes in the function argument.

Value

The returned value is a data frame with the following variables:

p_f

P value (fixed effects model)

p_r

P value (random effects model)

beta_f

regression coefficient

beta_r

regression coefficient

se_f

standard error

se_r

standard error

z_f

z value

z_r

z value

p_heter

heterogeneity test p value

i2

I^2 statistic

k

No of tests used

eps

smallest double-precision number

References

JPT Higgins, SG Thompson, JJ Deeks, DG Altman. Measuring inconsistency in meta-analyses. BMJ 327:557-60

Note

Adapted from a SAS macro

Author(s)

Shengxu Li, Jing Hua Zhao

Examples

1
2
3
4
5
6
7
8
## Not run: 
abc <- data.frame(chromosome=1,rsn='abcd',startpos=1234,
                  b1=1,se1=2,p1=0.1,b2=2,se2=6,p2=0,b3=3,se3=8,p3=0.5)
metareg(abc,3)
abc2 <- data.frame(b1=c(1,2),se1=c(2,4),b2=c(2,3),se2=c(4,6),b3=c(3,4),se3=c(6,8))
print(metareg(abc2,3))

## End(Not run)

Example output

gap version 1.1-17

Meta-analysis of 3 studies:

 p_f= 0.5152782 
 p_r= 0.5152782 
 beta_f= 1.201183 
 beta_r= 1.201183 
 se_f= 1.846154 
 se_r= 1.846154 
 z_f= 0.650641 
 z_r= 0.650641 
 p_heter= 0.9615572 
 i2= 0 
 k= 3 
 eps= 2.220446e-16 

where

 p_f=P value (fixed effects model)  
 p_r=P value (random effects model) 
 beta_f=regression coefficient      
 beta_r=regression coefficient      
 se_f=standard error                
 se_r=standard error                
 z_f=z value                        
 z_r=z value                        
 p_heter=heterogeneity test p value 
 i2=I^2                             
 k=No of tests used                 
 eps=smallest double-precision number

Meta-analysis of 3 studies:

 p_f= 0.4320349 
 p_r= 0.4320349 
 beta_f= 1.346939 
 beta_r= 1.346939 
 se_f= 1.714286 
 se_r= 1.714286 
 z_f= 0.7857143 
 z_r= 0.7857143 
 p_heter= 0.9358252 
 i2= 0 
 k= 3 
 eps= 2.220446e-16 

Meta-analysis of 3 studies:

 p_f= 0.4052736 
 p_r= 0.4052736 
 beta_f= 2.557377 
 beta_r= 2.557377 
 se_f= 3.072885 
 se_r= 3.072885 
 z_f= 0.8322397 
 z_r= 0.8322397 
 p_heter= 0.9717191 
 i2= 0 
 k= 3 
 eps= 2.220446e-16 

where

 p_f=P value (fixed effects model)  
 p_r=P value (random effects model) 
 beta_f=regression coefficient      
 beta_r=regression coefficient      
 se_f=standard error                
 se_r=standard error                
 z_f=z value                        
 z_r=z value                        
 p_heter=heterogeneity test p value 
 i2=I^2                             
 k=No of tests used                 
 eps=smallest double-precision number
    beta_f     se_f       z_f   beta_r     se_r   p_heter i2 k          eps
1 1.346939 1.714286 0.7857143 1.346939 1.714286 0.9358252  0 3 2.220446e-16
2 2.557377 3.072885 0.8322397 2.557377 3.072885 0.9717191  0 3 2.220446e-16

gap documentation built on Nov. 25, 2017, 5:04 p.m.