metareg {gap}R Documentation

Fixed and random effects model for meta-analysis

Description

Fixed and random effects model for meta-analysis

Usage

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,...,bNb1,...,bN and standard errors as se1,...,seNse1,...,seN. More generally, they can be specified by prefixes in the function argument.

Details

Given k=nk=n studies with b1,...,bNb_1, ..., b_N being β\beta's and se1,...,seNse_1, ..., se_N standard errors from regression, the fixed effects model uses inverse variance weighting such that w1=1/se12w_1=1/se_1^2, ..., wN=1/seN2w_N=1/se_N^2 and the combined β\beta as the weighted average, βf=(b1w1+...+bNwN)/w\beta_f=(b_1*w_1+...+b_N*w_N)/w, with w=w1+...+wNw=w_1+...+w_N being the total weight, the se for this estimate is sef=1/wse_f=\sqrt{1/w}. A normal z-statistic is obtained as zf=βf/sefz_f=\beta_f/se_f, and the corresponding p value pf=2pnorm(abs(zf))p_f=2*pnorm(-abs(z_f)). For the random effects model, denote qw=w1(b1βf)2+...+wN(bNβf)2q_w=w_1*(b_1-\beta_f)^2+...+w_N*(b_N-\beta_f)^2 and dl=max(0,(qw(k1))/(w(w12+...+wN2)/w))dl=max(0,(q_w-(k-1))/(w-(w_1^2+...+w_N^2)/w)), corrected weights are obtained such that w1c=1/(1/w1+dl){w_1}_c=1/(1/w_1+dl), ..., wNc=1/(1/wN+dl){w_N}_c=1/(1/w_N+dl), totaling wc=w1c+...+wNcw_c={w_1}_c+...+{w_N}_c. The combined β\beta and se are then βr=(b1w1c+...+bNwNc)/wc\beta_r=(b_1*{w_1}_c+...+b_N*{w_N}_c)/w_c and ser=(1/wc)se_r=\sqrt(1/w_c), leading to a z-statistic zr=βr/serz_r=\beta_r/se_r and a p-value pr=2pnorm(abs(zr))p_r=2*pnorm(-abs(z_r)). Moreover, a p-value testing for heterogeneity is pheter=pchisq(qw,k1,lower.tail=FALSE)p_{heter}=pchisq(q_w,k-1,lower.tail=FALSE).

Value

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

Note

Adapted from a SAS macro, 23-7-2009 MRC-Epid JHZ

Author(s)

Shengxu Li, Jing Hua Zhao

References

Higgins JP, Thompson SG, Deeks JJ, Altman DG (2003). “Measuring inconsistency in meta-analyses.” BMJ, 327(7414), 557-60. ISSN 0959-8138 (Print) 0959-8138, doi:10.1136/bmj.327.7414.557.

Examples

## 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)


[Package gap version 1.5-3 Index]