predict.mixmeta: Predicted Values from mixmeta Models

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/predict.mixmeta.R

Description

This method function computes predictions from fitted univariate or multivariate meta-analytical models represented in objects of class "mixmeta", optionally for a new set of predictor values in meta-regression models. Predictions are optionally accompanied by standard errors, confidence intervals or the entire (co)variance matrix of the predicted outcomes.

Usage

1
2
3
## S3 method for class 'mixmeta'
predict(object, newdata, se=FALSE, ci=FALSE, vcov=FALSE, ci.level=0.95,
  format, aggregate="stat", na.action=na.pass, ...)

Arguments

object

an object of class "mixmeta".

newdata

An optional data frame in which to look for variables values with which to predict from meta-regression models.

se

logical switch indicating if standard errors must be included.

ci

logical switch indicating if confidence intervals must be included.

vcov

logical switch indicating if the (co)variance matrix must be included.

ci.level

a numerical value between 0 and 1, specifying the confidence level for the computation of confidence intervals.

format

the format for the returned results. See Value.

aggregate

when format="matrix" and se or ci are required, the results may be aggregated by statistic or by outcome. See Value

na.action

a function which indicates what should happen when the data contain NAs. The default to the value saved in object. See Note.

...

further arguments passed to or from other methods.

Details

The method function predict produces predicted values from mixmeta objects, obtained by evaluating the original call to mixmeta in the frame newdata. For both fixed and random-effects models, estimated predictions are only based on the fixed part of the model, ignoring study-specific deviations, differently from blup.

If newdata is omitted, the predictions are based on the data used for the fit. In that case how to handle predictions for units removed from estimation due to invalid missing pattern is determined by the na.action argument used in mixmeta to produce object. If na.action=na.omit, units excluded from estimation will not appear, whereas if na.action=na.exclude they will appear, with values set to NA for all the outcomes. This step is performed by napredict. See Notes.

Value

The results may be aggregated in matrices (the default), or returned as lists, depending on the argument format. For multivariate models, the aggregation is ruled by the argument aggregate, and the results may be grouped by statistic or by outcome. If vcov=TRUE, lists are always returned.

Note

The definition of missing in model frames used for estimation in mixmeta is different than that commonly adopted in other regression models such as lm or glm. See info on missing values in mixmeta.

Author(s)

Antonio Gasparrini <antonio.gasparrini@lshtm.ac.uk> and Francesco Sera <francesco.sera@lshtm.ac.uk>

References

Sera F, Armstrong B, Blangiardo M, Gasparrini A (2019). An extended mixed-effects framework for meta-analysis.Statistics in Medicine. 2019;38(29):5429-5444. [Freely available here].

See Also

See blup for best linear unbiased predictions. See the default method predict. See mixmeta-package for an overview of the package and modelling framework.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# RUN THE MODEL
model <- mixmeta(cbind(PD,AL) ~ pubyear, S=berkey98[5:7], data=berkey98)

# PREDICTED FROM YEAR 1985 TO 1987, WITH LABELS
newdata <- data.frame(pubyear=1985:1987, row.names=1985:1987)

# AVERAGED OUTOCOMES AND SE
predict(model, newdata, se=TRUE)

# SAME AS ABOVE, AGGREGATED BY OUTCOME
predict(model, newdata, se=TRUE, aggregate="outcome")

# WITH VCOV, FORCED TO A LIST
predict(model, newdata, se=TRUE, vcov=TRUE, aggregate="outcome")

gasparrini/mixmeta documentation built on Oct. 17, 2021, 11 a.m.