Learn R Programming

DoseFinding (version 0.5-5)

DRMod and gDRMod methods: Methods for DRMod and gDRMod objects

Description

coef.(g)DRMod - Extract coefficients object, if wanted, the function can separate the coefficients into coefficients of the dose-response model and the additional linear coefficients. predict.(g)DRMod - Predict a DRMod or gDRMod object

intervals.(g)DRMod, vcov.(g)DRMod - Calculate (asymptotic) covariance matrix, confidence intervals for parameters in a DRMod or gDRMod object, based on standard asymptotic theory for nonlinear models, see Seber and Wild (2003).

plot.(g)DRMod - Plot a DRMod or gDRMod object. plot.(g)DRMod displays either the dose-response effect curve or the full dose-response curve for a particular selection of the additional covariates of a DRMod object. The plot function (invisibly) returns all information necessary for producing the display (when it is desired to have a more customized display). See the Value section for more details.

Usage

## S3 method for class 'DRMod':
coef(object, sep = FALSE, ...)
## S3 method for class 'gDRMod':
coef(object, ...)

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

## S3 method for class 'DRMod': vcov(object, data = getData(object), uGrad = NULL, ...) ## S3 method for class 'gDRMod': vcov(object, ...)

## S3 method for class 'DRMod': intervals(object, level = 0.95, data = getData(object), uGrad = NULL, ...) ## S3 method for class 'gDRMod': intervals(object, level = 0.95, ...)

## S3 method for class 'DRMod': plot(x, type = c("EffectCurve", "DRCurve"), addCovarVals = NULL, CI = FALSE, level = 0.95, plotData = c("means", "complData", "none"), display = TRUE, lenDose = 201, data = getData(x), uGrad, ...) ## S3 method for class 'gDRMod': plot(x, type = c("DRCurve", "EffectCurve"), CI = FALSE, level = 0.95, plotData = c("means", "meansCI", "none"), display = TRUE, lenDose = 201, ...)

Arguments

object
A DRMod or gDRMod object
x
A DRMod or gDRMod object
sep
Logical determining whether all coefficients should be returned in one numeric or separated in a list.
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).
level
Confidence level to be used
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.
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.
type
Character specifying the type of plot/prediction. If type = "EffectCurve", the effect curve is plotted/predicted. If type = "DRCurve" the dose-response curve is plotted/predicted for a particular value of the additional covariates
addCovarVals
If type = "DRCurve" (and addCovars != 1) one needs to specify the values of the other covariates (in a data.frame with one row!)
CI
Logical indicating whether confidence curve for the mean should be plotted
plotData
If addCovars = ~1 and type = "DRCurve" this determines, whether means or complete data or no data should be plotted within the plot of the dose-response curve
display
Determines whether the plot should be displayed or only data necessary for the plot should be produced.
lenDose
If doseSeq is not specified a equally spaced grid of lenDose values between placebo and the maximal dose in the study is used.
uGrad
Function to return the gradient of a user defined model, see Examples of the fitDRModel function.
...
Additional arguments, for plot.DRMod these are passed to the call of plot

Value

  • For predict.(g)DRMod: 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.

References

Seber, G.A.F and Wild, C.F. (2003). Nonlinear Regression, Wiley & Sons

See Also

fitDRModel

Examples

Run this code
## examples for predict method
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)

## examples for plot method
set.seed(123)
x <- rep(c(0,0.05,0.2,0.6,1), c(30,30,30,20,10))
y <- sigEmax(x, 0, 2, 0.2, 2)
age <- rnorm(120, 50, 10)
center <- as.factor(sample(c("C1","C2","C3"), 120, replace = TRUE))
y <- y + -0.03*age + 0.5*(center=="C1") + rnorm(120, 0, 1)
datfram <- data.frame(x, y, age, center)
fit <- fitDRModel(y ~ x, datfram, "sigEmax", addCovars = ~age+center)
# just plot effect curve
plot(fit, type = "EffectCurve")
# plot full dose-response curve, need values for covariates
op <- par()$mfrow
par(mfrow = c(1,2))
plot(fit, type = "DRCurve",
     addCovarVals = data.frame(age = 20, center = as.factor("C1")))
plot(fit, type = "DRCurve",
     addCovarVals = data.frame(age = 50, center = as.factor("C3")))
par(mfrow = op)
# plot full dose-response curve for covariates from datfram
plot(fit, type = "DRCurve",addCovarVals = datfram[1,3:4])

Run the code above in your browser using DataLab