Learn R Programming

drc (version 0.8-2)

multdrc: Fitting multiple dose-response curves

Description

'multdrc' fits non-linear regression models to multiple dose-response curves.

Usage

multdrc(formula, curve, collapse, weights, data=NULL, boxcox = FALSE, 
bcAdd = 0, varPower = FALSE, startVal, fct = l4(), na.action = na.fail, 
robust="mean", type = "continuous", cm = NULL, logDose = NULL, control = mdControl())

Arguments

formula
a symbolic description of the model to be fit. Either of the form 'response $~$ dose' or as a data frame with response value in first column and dose in second column.
curve
a numeric vector or factor containing the grouping of the data.
collapse
a data frame with a many columns as there are parameters in the non-linear function. Or a list containing a formula for each parameter in the non-linear function.
weights
a numeric vector containing weights.
data
an optional data frame containing the variables in the model.
boxcox
logical or numeric. If TRUE the optimal Box-Cox transformation is applied to the model. If FALSE (the default) no Box-Cox transformation is applied. If numeric the specified value is used in the Box-Cox transformation.
bcAdd
a numeric value specifying the constant to be added on both sides prior to Box-Cox transformation. The default is 0.
varPower
logical. If TRUE the variance is modelled as a power function of the mean. If FALSE (the default) no variance modelling is applied.
startVal
an optional numeric vector containing start values for all parameters in the model. Overrules any self starter function.
fct
a list with three or 5 elements specifying the non-linear function, the accompanying self starter function, the names of the parameter in the non-linear function and, optionally, the first and second derivatives.
na.action
a function which indicates what should happen when the data contain 'NA's. The default is 'na.fail'. To omit 'NA's use 'na.omit'.
robust
a character string specifying the rho function for robust estimation. Default is non-robust least squares estimation ("mean"). Available robust methods are: median estimation ("median"), least median of squares ("lms"), least trimmed squares ("lts"),
type
a character string specifying the data type: binomial and continuous are the only options currently.
cm
character string or numeric value specifying the level in curve corresponding to control measurements.
logDose
a numeric value or NULL. If log doses value are provided the base of the logarithm should be specified (exp(1) for the natural logarithm and 10 for 10-logarithm).
control
a list of arguments controlling constrained optimisation (zero as boundary), maximum number of iteration in the optimisation, relative tolerance in the optimisation, warnings issued during the optimisation.

Value

  • An object of class 'drc'.

Details

This function uses the function 'optim' for the minimisation. The control arguments are specified using the function mdControl. If the argument boxcox is TRUE it may be necessary to constrain the optimisation (using mdControl) in order to comply with the requirement of non-negative values for the Box-Cox transformation. Alternatively a constant can be added in the Box-Cox transformation (using bcAdd). The residuals available will be based on the transformed response values. If varPower is TRUE then 'robust="mean"'. Also if "boxcox=TRUE" then 'varPower=FALSE'. For robust estimation MAD (median abslolute deviance) is used to estimate the residual variance.

See Also

The function nls can also be used for nonlinear regression.

Examples

Run this code
## Fitting response MEANLR to dose MM in the data set FA 
## (type ?FA to learn about the data set)
model1 <- multdrc(MEANLR~MM, data=FA)
summary(model1)

## Fitting a 5-parameter logistic model
model2 <- multdrc(FA, fct = l5())
summary(model2)

## Fitting a 4-parameter logistic model
## with Box-Cox transformation
model3 <- multdrc(FA, boxcox = TRUE)  
summary(model3)

## Example using 'varPower' argument 
## Modelling variance as power of mean
model4 <- multdrc(FA, varPower = TRUE)
summary(model4)

## Example using 'logDose' argument
logdose <- c(-8.045757, -7.568636, -7.086186, -6.607303, -6.130768, -5.653647, -5.180456, -4.698970)
response <- c(7.941, 16.619, 11.021, 19.767, 30.487, 64.434, 74.422, 52.472)
model5 <- multdrc(response~logdose, logDose=10)
plot(model5, conLevel=-9)  # the default level is too high

rm(model1, model2, model3, model4)

Run the code above in your browser using DataLab