mareg: Meta-Regression

Description Usage Arguments Details Value References See Also Examples

View source: R/MAc.R

Description

Meta-regression function for a single or multiple predictor model. This function is a wrapper for the rma() function in the metafor package (Viechtbauer, W, 2010). Please see https://CRAN.R-project.org/package=metafor for details or for more advanced functionality with the rma() function.

Usage

1
mareg(formula, var, data, ztor = FALSE, method = "REML",  subset,  ...)

Arguments

formula

This is a formula based function, similar to other functions in R (e.g., lm), where the criterion variable (e.g., r or z') is dependent on ('~') the predictor variables (e.g., moderators). The formula for two moderators would take this form: mareg(r ~ mod1 + mod2, var.r, data), where r is the criterion variable predicted by mod1 and mod2. The variance (var) of each r is var.r in this case.

var

Variance of r or z'.

data

Aggregated data.frame (see agg function for setting up the dataset for these analyses) with id, es (r or z'), var (variance of r or z') for each study.

method

Default is REML (Restricted-Maximal Likelihood), which is the standard random effects method. For fixed effects, use FE. Other options are specified in the metafor package manual ('rma' function).

ztor

Default is FALSE. If TRUE, this assumes z' (Fisher's z) was used in the es argument and the analyist would like z' to be converted to r (for interpretive purposes) after analyzing in z'.

subset

an optional vector specifying a subset of observations to be used in the fitting process.

...

Additional arguments to be passed to rma().

Details

See Wolfgang Viechtbauer (2010). metafor: Meta-Analysis Package for R. R package version 1.1-0. for the details of the rma() function. https://CRAN.R-project.org/package=metafor

Value

estimate

Unstandardized regression coefficient estimate.

se

Standard error of the estimate coefficient.

z

z-value.

ci.l

Lower 95% confidence interval.

ci.u

Upper 95% confidence interval.

Pr(>|z|)

p-value (significance level).

QE

Q-error. Measure of error in the model.

QE.df

Degrees of freedom for Q-error.

QEp

Q-error p-value (for homogeneity).

QM

Q-model. Measure of model fit.

QM.df

Degrees of freedom for Q-model.

QMp

Q-between p-value (for homogeneity). QM and QMp provide the test of whether the moderator variable(s) account for significant variance among effect sizes.

References

Wolfgang Viechtbauer (2010). metafor: Meta-Analysis Package for R. R package version 1.1-0. https://CRAN.R-project.org/package=metafor

See Also

wd, plotcon

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# install metafor
# install.packages('metafor', dependencies = TRUE)

# Sample data
id<-c(1:20)
n<-c(10,20,13,22,28,12,12,36,19,12,36,75,33,121,37,14,40,16,14,20)
r<-c(.68,.56,.23,.64,.49,-.04,.49,.33,.58,.18,-.11,.27,.26,.40,.49,
.51,.40,.34,.42,.16)
mod1<-c(1,2,3,4,1,2,8,7,5,3,9,7,5,4,3,2,3,5,7,1)
dat<-data.frame(id,n,r,mod1)
dat$var.r <- var_r(dat$r, dat$n) # MAc function to derive variance
dat$z <- r_to_z(dat$r)  # MAc function to convert to Fisher's z (z')
dat$var.z <- var_z(dat$n)  # MAc function for variance of z'
dat$mods2 <- factor(rep(1:2, 10))
dat



# Examples

# Random Effects
mareg(r~ mod1 + mods2, var = var.r, method = "REML",  data = dat)

# Fixed Effects
mareg(r~ mod1 + mods2, var = var.r, method = "FE",  data = dat)  

Example output

   id   n     r mod1      var.r           z       var.z mods2
1   1  10  0.68    1 0.03211264  0.82911404 0.142857143     1
2   2  20  0.56    2 0.02479710  0.63283319 0.058823529     2
3   3  13  0.23    3 0.07474987  0.23418947 0.100000000     1
4   4  22  0.64    4 0.01659867  0.75817374 0.052631579     2
5   5  28  0.49    1 0.02138696  0.53606034 0.040000000     1
6   6  12 -0.04    2 0.09061841 -0.04002135 0.111111111     2
7   7  12  0.49    8 0.05249527  0.53606034 0.111111111     1
8   8  36  0.33    7 0.02268741  0.34282825 0.030303030     2
9   9  19  0.58    5 0.02446472  0.66246271 0.062500000     1
10 10  12  0.18    3 0.08511361  0.18198269 0.111111111     2
11 11  36 -0.11    9 0.02788418 -0.11044692 0.030303030     1
12 12  75  0.27    7 0.01161506  0.27686382 0.013888889     2
13 13  33  0.26    5 0.02716780  0.26610841 0.033333333     1
14 14 121  0.40    4 0.00588000  0.42364893 0.008474576     2
15 15  37  0.49    3 0.01604022  0.53606034 0.029411765     1
16 16  14  0.51    2 0.04211169  0.56272977 0.090909091     2
17 17  40  0.40    3 0.01809231  0.42364893 0.027027027     1
18 18  16  0.34    5 0.05214422  0.35409253 0.076923077     2
19 19  14  0.42    7 0.05217823  0.44769202 0.090909091     1
20 20  20  0.16    1 0.04997133  0.16138670 0.058823529     2
Loading 'metafor' package (version 2.0-0). For an overview 
and introduction to the package please type: help(metafor).

Call:
mareg.default(formula = r ~ mod1 + mods2, var = var.r, data = dat,     method = "REML")

  intrcpt       mod1     mods22  
 0.570902  -0.040419  -0.002163  

Call:
mareg.default(formula = r ~ mod1 + mods2, var = var.r, data = dat,     method = "FE")

  intrcpt       mod1     mods22  
 0.570907  -0.040420  -0.002158  

MAc documentation built on May 1, 2019, 10:55 p.m.