Learn R Programming

metafor (version 1.9-2)

predict.rma: Compute Predicted Values for 'rma' Objects

Description

The function computes predicted values, corresponding standard errors, confidence intervals, and (approximate) credibility intervals for objects of class "rma".

Usage

## S3 method for class 'rma':
predict(object, newmods, intercept=object$intercept, addx=FALSE,
        level=object$level, digits=object$digits, transf=FALSE, targs, \dots)

Arguments

object
an object of class "rma".
newmods
optional vector or matrix specifying the values of the moderator values for which the predicted values should be calculated. See Details.
intercept
logical specifying whether the intercept term should be included when calculating the predicted values for newmods.
addx
logical specifying whether the values of the moderator variables should be added to the returned object. See Examples.
level
numerical value between 0 and 100 specifying the confidence and credibility interval level (the default is to take the value from the object).
digits
integer specifying the number of decimal places to which the printed results should be rounded (the default is to take the value from the object).
transf
optional argument specifying the name of a function that should be used to transform the predicted values and interval bounds (e.g., transf=exp). Defaults to FALSE, which means that no transformation is used.
targs
optional arguments needed by the function specified under transf.
...
other arguments.

Value

  • An object of class "predict.rma". The object is a list containing the following components:
  • predpredicted value(s).
  • secorresponding standard error(s).
  • ci.lblower bound of the confidence interval(s).
  • ci.ubupper bound of the confidence interval(s).
  • cr.lblower bound of the credibility interval(s) (only random/mixed-effects models).
  • cr.ubupper bound of the credibility interval(s) (only random/mixed-effects models).
  • Xthe moderator value(s) used to calculate the predicted values (only when addx=TRUE).
  • ...some additional elements/values.
  • The "predict.rma" object is formated and printed with print.predict.rma.

Details

For the fixed-effects model, predict(object) returns the estimated (average) outcome in the set of studies included in the meta-analysis. This is the same as the estimated intercept in the fixed-effects model. For the random-effects model, predict(object) returns the estimated (average) outcome in the hypothetical population of studies from which the set of studies included in the meta-analysis are assumed to be a random selection. This is the same as the estimated intercept in the random-effects model. For models including one or more moderators, predict(object) returns the estimated (average) outcomes for values of the moderator(s) equal to those of the $k$ studies included in the meta-analysis (i.e., the fitted values for the $k$ studies). For models including $q$ moderator variables, new moderator values for $k_{new}$ new studies can be specified by setting newmods equal to an $k_{new} \times q$ matrix with the corresponding new moderator values. If the original model includes an intercept, then it should not be explicitly specified under newmods, as it will be added by default (unless one sets intercept=FALSE). Also, any factors in the original model get turned into the appropriate contrast variables within the rma function, so that newmods should actually include the values for the contrast variables. Examples are shown below. For random/mixed-effects models, an approximate credibility interval is also calculated. The interval estimates where level % of the true outcomes fall in the hypothetical population of studies. Note that this interval is calculated under the assumption that the value of $\tau^2$ is known (and not estimated). A proper method for calculating a credibility interval that accounts for the uncertainty in the estimate of $\tau^2$ will be implemented in the future.

References

Hedges, L. V., & Olkin, I. (1985). Statistical methods for meta-analysis. San Diego, CA: Academic Press. Raudenbush, S. W. (2009). Analyzing effect sizes: Random effects models. In H. Cooper, L. V. Hedges, & J. C. Valentine (Eds.), The handbook of research synthesis and meta-analysis (2nd ed., pp. 295--315). New York: Russell Sage Foundation. Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. Journal of Statistical Software, 36(3), 1--48. http://www.jstatsoft.org/v36/i03/.

See Also

fitted.rma, blup.rma.uni

Examples

Run this code
### load BCG vaccine data
data(dat.bcg)

### meta-analysis of the log relative risks using a random-effects model
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg,
           measure="RR", data=dat.bcg, method="REML")

### average relative risk with 95\% CI
predict(res, transf=exp)

### mixed-effects model with absolute latitude as a moderator
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, mods = ~ ablat,
           measure="RR", data=dat.bcg, method="REML")

### predicted average relative risks for given absolute latitude values
predict(res, transf=exp, addx=TRUE)

### predicted average relative risks for 10-60 degrees absolute latitude
predict(res, newmods=c(10, 20, 30, 40, 50, 60), transf=exp)

### mixed-effects model with two moderators (absolute latitude and publication year)
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, mods = ~ ablat + year,
           measure="RR", data=dat.bcg, method="REML")

### predicted average relative risks for 10 and 60 degrees latitude in 1950 and 1980
predict(res, newmods=cbind(c(10,60,10,60),c(1950,1950,1980,1980)), transf=exp, addx=TRUE)

### mixed-effects model with two moderators (one of which is a factor)
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, mods= ~ ablat + factor(alloc),
           measure="RR", data=dat.bcg, method="REML")

### examine how the factor was actually coded for the studies in the dataset
predict(res, addx=TRUE)

### predictd average relative risks at 30 degrees for the three factor levels
### note: the contrast (dummy) variables need to specified explicitly here
predict(res, newmods=c(30, 0, 0), addx=TRUE)   # for alternate  allocation
predict(res, newmods=c(30, 1, 0), addx=TRUE)   # for random     allocation
predict(res, newmods=c(30, 0, 1), addx=TRUE)   # for systematic allocation

Run the code above in your browser using DataLab