nplr {nplr} | R Documentation |
Function to Fit n-Parameter Logistic Regressions.
Description
This function computes a weighted n-parameters logistic regression, given x (typically compound concentrations) and y values (responses: optic densities, fluorescence, cell counts,...). See Details
.
Usage
nplr(x, y, useLog = TRUE, LPweight = 0.25, npars = "all",
method = c("res", "sdw", "gw"), silent = FALSE)
Arguments
x |
a vector of numeric values, e.g., a vector of drug concentrations. |
y |
a vector of numeric values, e.g., a vector of responses, typically provided as proportions of control. |
useLog |
Logical. Should x-values be Log10-transformed? Default is |
LPweight |
a coefficient to adjust the weights. |
npars |
a numeric value (or |
method |
a character string to specify which weight method to use. Options are |
silent |
Logical. Specify whether |
Details
The 5-parameter logistic regression is of the form:
y = B + (T - B)/[1 + 10^(b*(xmid - x))]^s
where B
and T
are the bottom and top asymptotes, respectively, b
and xmid
are the Hill slope and the x-coordinate at the inflection point, respectively, and s
is an asymmetric coefficient. This equation is sometimes referred to as the Richards' equation [1,2].
When specifying npars = 4
, the s
parameter is forced to be 1
, and the corresponding model is a 4-parameter logistic regression, symmetrical around its inflection point. When specifying npars = 3
or npars = 2
, two more constraints are added, forcing B
and T
to be 0
and 1
, respectively.
Weight methods:
The model parameters are optimized, simultaneously, using nlm, given a sum of squared errors function, sse(Y)
, to minimize:
sse(Y) = \Sigma [W.(Yobs - Yfit)^2 ]
where Yobs
, Yfit
, and W
are the vectors of observed values, fitted values, and weights, respectively.
In order to reduce the effect of possible outliers, the weights can be computed in different ways, specified in nplr
:
- residual weights,
"res"
: -
W = (1/residuals)^LPweight
where
residuals
andLPweight
are the squared error between the observed and fitted values, and a tuning parameter, respectively. Best results are generally obtained by settingLPweight = 0.25
(default value), while settingLPweight = 0
results in computing a non-weighted sum of squared errors. - standard weights,
"sdw"
: -
W = 1/Var(Yobs_r)
where
Var(Yobs_r)
is the vector of the within-replicates variances. - general weights,
"gw"
: -
W = 1/Yfit^LPweight
where
Yfit
are the fitted values. As for the residuals-weights method, settingLPweight = 0
results in computing a non-weighted sum of squared errors.
The standard weights
and general weights
methods are described in [3].
Value
An object of class nplr
.
slots
- x
the x values as they are used in the model. It can be
Log10(x)
ifuseLog
was set toTRUE
.- y
the y values.
- useLog
logical.
- npars
the best number of parameters if
npars="all"
, or the specified number of parameters otherwise.- LPweight
the weights tuning parameter.
- yFit
the y fitted values.
- xCurve
the x values generated to draw the curve. 200 points between the
min
andmax
of x.- yCurve
the fitted values used to draw the curve. These correspond to
xCurve
.- inflPoint
the inflection point x and y coordinates.
- goodness
the goodness-of-fit. The correlation between the fitted and the observed y values.
- stdErr
the mean squared error between the fitted and the observed y values.
- pars
the model parameters.
- AUC
the area under the curve estimated using both the trapezoid method and Simpson's rule.
Note
The data used in the examples are samples from the NCI-60 Growth Inhibition Data: https://wiki.nci.nih.gov/display/NCIDTPdata/NCI-60+Growth+Inhibition+Data, except for multicell.tsv which are simulated data.
Author(s)
Frederic Commo, Brian M. Bot
References
1- Richards, F. J. (1959). A flexible growth function for empirical use. J Exp Bot 10, 290-300.
2- Giraldo J, Vivas NM, Vila E, Badia A. Assessing the (a)symmetry of concentration-effect curves: empirical versus mechanistic models. Pharmacol Ther. 2002 Jul;95(1):21-45.
3- Motulsky HJ, Brown RE. Detecting outliers when fitting data with nonlinear regression - a new method based on robust nonlinear regression and the false discovery rate. BMC Bioinformatics. 2006 Mar 9;7:123.
See Also
convertToProp
, getEstimates
, plot.nplr
, nplrAccessors
Examples
# Using the PC-3 data
require(nplr)
path <- system.file("extdata", "pc3.txt", package = "nplr")
pc3 <- read.delim(path)
model <- nplr(x = pc3$CONC, y = pc3$GIPROP)
plot(model)