predict.dosresmeta: Predicted Values from dosresmeta Models

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

Description

This method function computes predictions from fitted dose-response models represented in objects of class "dosresmeta", optionally for a new set of exposure levels. Predictions are optionally accompanied by confidence intervals and/or standard errors for the predictions.

Usage

1
2
3
4
## S3 method for class 'dosresmeta'
predict(object, newdata, xref, expo = FALSE, xref_vec,
  ci.incl = TRUE, se.incl = FALSE, xref_pos = 1, delta, order = FALSE,
  ci.level = 0.95, ...)

Arguments

object

an object of class dosreseta.

newdata

an optional data frame or matrix in which to look for variables values with which to predict from dose-response models.

xref

an optional scalar to indicate which levels should serve as referent for the predicted relative risks. See details.

expo

logical switch indicating if the prediction should be on the exponential scale.

xref_vec

an optional numeric to indicate the referent (vector) for the predicted relative risks. See details.

ci.incl

logical switch indicating if confidence intervals need to be included.

se.incl

logical switch indicating if standard errors need to be included.

xref_pos

an optional scalar to indicate the position of the referent for the predicted relative risks. See details.

delta

an optional scalar to specify to predict the linear trend related to that increase.

order

logical to indicate if the predictions need to be sorted by exposure levels.

ci.level

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

...

further arguments passed to or from other methods.

Details

The method function predict produces predicted values from dosresmeta objects. When more than one study is included in the analysis, estimated predictions are only based on the fixed part of the model.

If newdata is omitted, the predictions are based on the data used for the fit. If xref is provided, it must be equal to one of the modeled values. If not provided, the minimum modeled referent value will be used as referent for the predicted relative risks

If newdata is specified, it should include all the variables used to model the dose-response relation. Again, if specified, xref must be equal to one of the value in the newdata. If omitted, the minimum value for the newdara will be used as referent.

Only for the linear trend it is possible to specify the predicted increase of risk correspongind to an increase equal to delta argument.

By default (order = TRUE), the predictions are sorted by exposure levels to facilitate understanding and possible graphical presentation of the results.

Value

The results are returned structured in a data frame.

Author(s)

Alessio Crippa, alessio.crippa@ki.se

See Also

dosresmeta, predict

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
## Load data and run the linear and quadratic models
data("alcohol_cvd")
lin <- dosresmeta(formula = logrr ~ dose, type = type, id = id,
                  se = se, cases = cases, n = n, data = alcohol_cvd) 
quadr <- dosresmeta(formula = logrr ~ dose + I(dose^2), type = type, id = id,
                    se = se, cases = cases, n = n, data = alcohol_cvd) 

## Predicted linear trend (on RR scale)
predict(lin, delta = 12, expo = TRUE)

## Predicted modeled data from quadratic model (on RR scale)
predict(quadr, expo = TRUE)

## Plot predicted dose-response relation
with(predict(quadr, order = TRUE, expo = TRUE), {
   plot(dose, pred, log = "y", type = "l",
        xlim = c(0, 45), ylim = c(.4, 2))
   lines(dose,  ci.lb, lty = 2)
   lines(dose, ci.ub, lty = 2)
   rug(dose, quiet = TRUE)
})

## Prediction for new values from quadratic model (on RR scale)
newdata <- data.frame(dose = seq(0, 50, 5))
predict(quadr, newdata, expo = TRUE)

## Loading data
data("ari")

mod <- dosresmeta(y ~ dose + I(dose^2), id = id, sd = sd,
 n = n, data = ari, covariance = "smd")

## Smoothed plot
newdata <- data.frame(dose = seq(0, 30, 1))
with(predict(mod, newdata), {
   plot(dose, pred, type = "l", ylim = c(0, .6))
   lines(dose,  ci.lb, lty = 2)
   lines(dose, ci.ub, lty = 2)
   rug(dose, quiet = TRUE)
})

dosresmeta documentation built on May 2, 2019, 6:30 a.m.