Learn R Programming

DoseFinding (version 0.1-3)

predict.DRMod: Predict a DRMod object.

Description

Predict a DRMod object

Usage

## S3 method for class 'DRMod':
predict(object, type = c("fullModel", "EffectCurve"),
        newdata = NULL, doseSeq = NULL, addCovarVals,
        se.fit = FALSE, lenSeq = 101,
        data = getData(object), uGrad = NULL,...)

Arguments

object
A DRMod object
type
Predictions for for the full dose-response model or only the Effect Curve?
newdata
Data frame containing values where to predict when using type="fullModel", if missing use the data, where the model was fitted on.
doseSeq
Numeric specifying doses where to predict in case of type="EffectCurve", if missing use lenSeq equally spaced values between smallest and largest dose in the data.
addCovarVals
Data frame with one row specifying values for the additional covariates when type = "fullModel"
se.fit
Logical determining, whether standard deviations for the predicted mean should be calculated.
lenSeq
If doseSeq is not specified a equally spaced grid of "lenSeq" values between placebo and the maximal dose in the study is used.
data
Data frame containing the variables on which the DRMod object was fitted (this needs to be handed over if DRMod object does not contain the data on which is was fitted).
uGrad
Function to return the gradient of a user defined model, see Examples of the fitDRModel function.
...
Additional arguments

Value

  • Either a numeric consisting out of the predictions (when se.fit = FALSE), or a list with elements, fit, se.fit, residual.scale and df, containing predicted mean, associated (asymptotic) standard deviation, the residual sum of squares and the degrees of freedom of the fit.

See Also

fitDRModel

Examples

Run this code
data(IBScovars)
fm <- fitDRModel(resp ~ dose, IBScovars, "emax", addCovars = ~ gender)

# predict only effect relative to placebo at 0, 1, 2, 3, 4
predict(fm, type = "EffectCurve", doseSeq = 0:4)
# add standard deviation for effect
predict(fm, type = "EffectCurve", doseSeq = 0:4, se.fit = TRUE)

# predict full model, specify where to predict via newdata
preddat <- data.frame(dose = 0:4, gender = as.factor(rep(1, 5)))
predict(fm, type = "fullModel", newdata = preddat)
# add standard deviation for predictions
predict(fm, type = "fullModel", newdata = preddat, se.fit = TRUE)

Run the code above in your browser using DataLab