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.
nplr(x, y, useLog = TRUE, LPweight = 0.25, npars = "all",
method = c("res", "sdw", "gw"), silent = FALSE)An object of class nplr.
a vector of numeric values, e.g., a vector of drug concentrations.
a vector of numeric values, e.g., a vector of responses, typically provided as proportions of control.
Logical. Should x-values be Log10-transformed? Default is TRUE; set to FALSE if x is already in Log10.
a coefficient to adjust the weights. \(LPweight = 0\) will compute a non-weighted np-logistic regression.
a numeric value (or "all") to specify the number of parameters to use in the model. If "all", the logistic model will be tested with 2 to 5 parameters, and the best option will be returned. See Details.
a character string to specify which weight method to use. Options are "res" (Default), "sdw", "gw". See Details.
Logical. Specify whether warnings and/or messages should be silenced. Default is FALSE.
the x values as they are used in the model. It can be Log10(x) if useLog was set to TRUE.
the y values.
logical.
the best number of parameters if npars="all", or the specified number of parameters otherwise.
the weights tuning parameter.
the y fitted values.
the x values generated to draw the curve. 200 points between the min and max of x.
the fitted values used to draw the curve. These correspond to xCurve.
the inflection point x and y coordinates.
the goodness-of-fit. The correlation between the fitted and the observed y values.
the mean squared error between the fitted and the observed y values.
the model parameters.
the area under the curve estimated using both the trapezoid method and Simpson's rule.
Frederic Commo, Brian M. Bot
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:
"res":$$ W = (1/residuals)^LPweight $$
where residuals and LPweight are the squared error between the observed and fitted values, and a tuning parameter, respectively. Best results are generally obtained by setting \(LPweight = 0.25\) (default value), while setting \(LPweight = 0\) results in computing a non-weighted sum of squared errors.
"sdw":$$ W = 1/Var(Yobs_r) $$
where Var(Yobs_r) is the vector of the within-replicates variances.
"gw":$$ W = 1/Yfit^LPweight $$
where Yfit are the fitted values. As for the residuals-weights method, setting \(LPweight = 0\) results in computing a non-weighted sum of squared errors.
The standard weights and general weights methods are described in [3].
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.
convertToProp, getEstimates, plot.nplr, nplrAccessors
# 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)
Run the code above in your browser using DataLab