drm: Fitting dose-response models

Description Usage Arguments Details Value Author(s)

Description

A general model fitting function for analysis of various types of dose-response data.

Usage

1
2
3
4
5
6
  drm(formula, curveid, pmodels, weights, data = NULL, subset, fct, 
  type = c("continuous", "binomial", "Poisson", "negbin1", "negbin2", "event", "ssd"), 
  bcVal = NULL, bcAdd = 0, 
  start, na.action = na.omit, robust = "mean", logDose = NULL, 
  control = drmc(), lowerl = NULL, upperl = NULL, separate = FALSE, 
  pshifts = NULL, varcov = NULL)

Arguments

formula

a symbolic description of the model to be fit. Either of the form 'response ~ dose' or as a data frame with response values in first column and dose values in second column.

curveid

a numeric vector or factor containing the grouping of the data.

pmodels

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 nonlinear function.

weights

a numeric vector containing weights. For continuous/quantitative responses, inverse weights are multiplied inside the squared errors; this means that weights should have the same unit as the response (see the details below). For binomial reponses weights provide information about the total number of binary observations used to obtain the response (which is a proportion): 1/2 and 10/20 lead to different analyses due to the different totals (2 vs. 20) even though the proportion in both cases is 0.5.

data

an optional data frame containing the variables in the model.

subset

an optional vector specifying a subset of observations to be used in the fitting process.

fct

a list with three or more 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 as well as information used for calculation of ED values. Currently available functions include, among others, the four- and five-parameter log-logistic models LL.4, LL.5 and the Weibull model W1.4. Use getMeanFunctions for a full list.

type

a character string specifying the distribution of the data (parameter estimation will depend on the assumed distribution as different log likelihood functions will be used). The default is "continuous", corresponding to assuming a normal distribution. The choices "binary" and "event" imply a binomial and multinomial distribution, respectively. The choice "ssd" is for fitting a species sensitivity distribution.

bcVal

a numeric value specifying the lambda parameter to be 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.

start

an optional numeric vector containing starting values for all mean parameters in the model. Overrules any self starter function.

na.action

a function for treating mising values ('NA's). Default is 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"), metric trimming ("trimmed"), metric winsorizing ("winsor") and Tukey's biweight ("tukey").

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 the base 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.

lowerl

a numeric vector of lower limits for all parameters in the model (the default corresponds to minus infinity for all parameters).

upperl

a numeric vector of upper limits for all parameters in the model (the default corresponds to plus infinity for all parameters).

separate

logical value indicating whether curves should be fit separately (independent of each other).

pshifts

a matrix of constants to be added to the matrix of parameters. Default is no shift for all parameters.

varcov

an optional user-defined known variance-covariance matrix for the responses. Default is the identity matrix (NULL), corresponding to independent response values with a common standard deviation, which will be estimated from the data.

Details

This function relies on the general optimiser function optim for the minimisation of negative log likelihood function. For a continuous response this reduces to least squares estimation, which is carried out by minimising the following sums of squares

∑_{i=1}^N [(y_i-f_i) / w_i]^2

where y_i, f_i, and w_i correspond to the observed response value, expected mean value, and the weight, respectively, for the ith observation (from 1 to N).

Response values are assumed to be mutually independent unless the argument varcov is specified (in which case the correlation structure is assumed to be completely known).

For robust estimation MAD (median absolute deviance) is used to estimate the residual variance.

Setting lowerl and/or upperl automatically invokes constrained optimisation.

The columns of a data frame argument to pmodels are automatically converted into factors. This does not happen if a list is specified.

Control arguments may be specified using the function drmc.

Value

An object of (S3) class 'drc'.

Author(s)

Christian Ritz and Jens C. Streibig


DoseResponse/drc documentation built on May 7, 2021, 4:55 p.m.