SSlogis
Fitting a Logistic Curve
Description
Computes the logistic function, its gradient, and starting values for fitting a logistic function to data. This is a selfStart function.
Usage
SSlogis(input, Asym, xmid, scal)
Arguments
input |
a numeric vector of values at which to evaluate the model.
|
Asym |
a numeric value representing the upper asymptote (the limit as input increases to Inf).
The lower asymptote is zero.
|
xmid |
a numeric parameter representing the input value at the inflection point of the curve.
The value of SSlogis is Asym/2 at input=xmid.
|
scal |
a positive numeric scale parameter. The larger scal is, the larger input must be to reach
a given distance from the upper asymptote.
|
Details
Because it a selfStart function, SSlogis has an attribute called "initial", which
is a function that nls can call to compute reasonable starting values for fitting a logistic
function to the input data.
Value
returns a numeric vector of the same length as input.
It is the value of the expression Asym/(1+exp((xmid-input)/scal)).
If all of the arguments Asym, xmid, and scal
are names of objects, as opposed to expressions or explicit numerical values,
the gradient (Jacobian) matrix with respect to these names is attached as an
attribute named gradient.
Note
This is primarily intended for use in formulae given to the nls function or similar functions.
See Also
Examples
SSlogis(seq(10,20,by=2), Asym=2, xmid=15, scal=1.3)
with(list(Asymptote=2, Inflection=15, Scale=1.3),
SSlogis(seq(10,20,by=2), Asymptote, Inflection, Scale))
nls(Y ~ SSlogis(X, Asymptote, Inflection, Scale),
data=data.frame(X=11:20, Y=sort(sin(11:20)+1)))