Flash Sale | 50% off
Get 50% off unlimited learning

gap (version 1.2.2)

metareg: Fixed and random effects model for meta-analysis

Description

Given k=n studies with b1,...,bN being β's and se1,...,seN standard errors from regression, the fixed effects model uses inverse variance weighting such that w1=1/se12, ..., wN=1/seN2 and the combined β as the weighted average, βf=(b1w1+...+bNwN)/w, with w=w1+...+wN being the total weight, the se for this estimate is sef=1/w. A normal z-statistic is obtained as zf=βf/sef, and the corresponding p value pf=2pnorm(abs(zf)). For the random effects model, denote qw=w1(b1βf)2+...+wN(bNβf)2 and dl=max(0,(qw(k1))/(w(w12+...+wN2)/w)), corrected weights are obtained such that w1c=1/(1/w1+dl), ..., wNc=1/(1/wN+dl), totaling wc=w1c+...+wNc. The combined β and se are then βr=(b1w1c+...+bNwNc)/wc and ser=(1/wc), leading to a z-statistic zr=βr/ser and a p-value pr=2pnorm(abs(zr)). Moreover, a p-value testing for heterogeneity is pheter=pchisq(qw,k1,lower.tail=FALSE).

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"

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

I2 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

Examples

Run this code
# 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))
# }

Run the code above in your browser using DataLab