dr4pl: Fitting 4 Parameter Logistic (4PL) models to dose-response...

Description Usage Arguments Details Value Methods (by class) Author(s) See Also Examples

View source: R/main.R

Description

This function fits a 4PL model to dose-response data. Users can obtain fitted parameter estimates as return values. Using auxiliary functions provided by this R package, users can plot a fitted dose-response curve and obtain confidence intervals of true parameters. In addition, the goodness-of-fit test for model adequacy of the 4PL models can be performed when replicates are available for each dose level.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
dr4pl(...)

## S3 method for class 'formula'
dr4pl(formula, data = list(), init.parm = NULL,
  trend = "auto", method.init = "Mead", method.robust = "squared",
  method.optim = "Nelder-Mead", use.Hessian = FALSE, level = 0.9999,
  failure.message = FALSE, upperl = NULL, lowerl = NULL, ...)

## S3 method for class 'data.frame'
dr4pl(data, dose, response, init.parm = NULL,
  trend = "auto", method.init = "Mead", method.robust = "squared",
  method.optim = "Nelder-Mead", use.Hessian = FALSE, level = 0.9999,
  failure.message = FALSE, upperl = NULL, lowerl = NULL, ...)

## Default S3 method:
dr4pl(dose, response, init.parm = NULL,
  trend = "auto", method.init = "Mead", method.robust = "squared",
  method.optim = "Nelder-Mead", use.Hessian = FALSE, level = 0.9999,
  failure.message = FALSE, upperl = NULL, lowerl = NULL, ...)

Arguments

...

Further arguments to be passed to constrOptim.

formula

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.

data

Data frame containing variables in the model.

init.parm

Either Null or a Vector of initial parameters to be optimized in the model.

  • UpperLimit: θ[1]

  • IC50/EC50: θ[2]

  • Slope: θ[3]

  • LowerLimit: θ[4]

dr4pl assumes θ[1]>θ[4]. Note that when using upperl and lowerl, the user may need to set this parameter because the estimated parameters may not be within the feasible region.

trend

Indicator of whether a dose-response curve is a decreasing θ[3]<0 or increasing curve θ[3]>0. The default is "auto" which indicates that the trend of the curve is automatically determined by data. The option "decreasing" will impose a restriction θ[3]<=0 while the option "increasing" will impose a restriction θ[3]>=0 in an optimization process.

method.init

Method of obtaining initial values of the parameters. If this parameter is left unassigned, a default "Mead" method will be used. Assign "logistic" to use the logistic method.

method.robust

Parameter to select loss function for the robust estimation method to be used to fit a model. The argument NULL indicates the sum of squares loss, "absolute" indicates the absolute deviation loss, "Huber" indicates Huber's loss and "Tukey" indicates Tukey's biweight loss.

method.optim

Method of optimization of the loss function specified by method.robust. This function argument is directly passed to the function constrOptim which is provided in the base package of R.

use.Hessian

Indicator of whether the Hessian matrix (TRUE) or the gradient vector is used in the Hill bounds.

level

Confidence level to be used in Hill bounds computation.

failure.message

Indicator of whether a message indicating attainment of the Hill bounds and possible resolutions will be printed to the console (TRUE) or hidden (FALSE).

upperl

Either NULL or a numeric vector of length 4 that specifies the upper limit for the initial parameters of c(θ[1],θ[2],θ[3],θ[4]) during the optimization process. By default no upperl is assumed. If the user wants to constain only some parameter values, set desired numeric bound in the appropriate position and fill Inf to impose no upper bounds on other values. All upperl values must be greater than corresponding initalized parameters.

lowerl

Either NULL or a numeric vector of length 4 that specifies the lower limit for the initial parameters of c(θ[1],θ[2],θ[3],θ[4]) during the optimization process. By default no lowerl is assumed. If the user wants to constain only some parameter values, set desired numeric bound in the appropriate position and fill -Inf to impose no lower bounds on other values. All lowerl values must be greater than corresponding initalized parameters.

dose

Vector of dose levels

response

Vector of responses

Details

This function fits a 4 parameter logistic (4PL) model to dose-response data. A formula of the model is

θ[1]+(θ[4]-θ[1])/(1+(z/θ[2])^θ[3])

method.init specifies an initialization method to get initial parameter estimates based on data. The currently supported initialization methods are "logistic" and 'Mead'. For further details, see the vignette.

method.optim specifies an optimization method to be used in "constrOptim" function. The currently supported optimization techniques include "Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN" and "Brent". For further details, see the help page of optim.

method.robust chooses a robust estimation method among 4 methods. The method of estimation is usually identified by the loss function of the method. This package supports 4 types of loss functions: sum-of-squares loss, absolute deviation loss, Huber's loss and Tukey's biweight loss. Each of loss function is explained in detail in the vignette.

Value

A 'dr4pl' object for which "confint", "gof", "print" and "summary" methods are implemented. For details, see the help page of each method. For example, type ?confint.dr4pl to obtain the confidence intervals of parameters of the 'dr4pl' object.

Methods (by class)

Author(s)

Hyowon An, ahwbest@gmail.com

Justin T. Landis, jtlandis314@gmail.com

Aubrey G. Bailey, aubreybailey@gmail.com

See Also

confint.dr4pl, gof.dr4pl, print.dr4pl, summary.dr4pl

Examples

 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
  ##Assign method.init = "logistic" to use logistic method of estimation.
  ##default method
  a <- dr4pl(dose = sample_data_1$Dose,
             response = sample_data_1$Response,
             method.init = "logistic")
  plot(a)

  ##Use default or Assign method.init = "Mead" to use Mead's method of estimation.
  # Use method.robust to select desired loss function
  # formula method
  b <- dr4pl(formula = Response~Dose, 
             data = sample_data_4,
             method.init = "Mead", 
             method.robust = "Tukey" )
  plot(b)
  
  #data.frame method
  c <- dr4pl(data = sample_data_10,
             dose = Dose,
             response = Response)
  plot(c)

  ##compatable with ggplot
  library(ggplot2) #load ggplot2
  c <- dr4pl(Response~Dose, 
             data = drc_error_2, 
             method.optim = "CG", 
             trend = "decreasing" )
  d <- plot(c, x.breaks = c(.00135, .0135, .135, 1.35, 13.5))
  d + theme_grey()

Example output

Warning messages:
1: Transformation introduced infinite values in continuous x-axis 
2: Transformation introduced infinite values in continuous x-axis 
Warning messages:
1: Transformation introduced infinite values in continuous x-axis 
2: Transformation introduced infinite values in continuous x-axis 

dr4pl documentation built on Oct. 7, 2019, 5:05 p.m.