Description Usage Arguments Details Value Author(s) See Also Examples
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.
1 2 3 4 |
object |
an object of class |
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. |
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.
The results are returned structured in a data frame.
Alessio Crippa, alessio.crippa@ki.se
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)
})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.