| SSsigmoidal_drift | R Documentation |
Creates initial coefficient estimates for a selfStart wrapper around
sigmoidal_drift(), for use with stats::nls(): a 4-parameter sigmoid
(A, B, xmid, slope) with a linear drift slope_B at its ending asymptote
from the onset fraction drift_fraction.
SSsigmoidal_drift(t, A, B, xmid, slope, slope_B, drift_fraction, shape)
t |
A numeric vector of the predictor variable (time). |
A |
A numeric parameter for the starting asymptote of the response variable. |
B |
A numeric parameter for the ending asymptote of the response variable. |
xmid |
A numeric parameter for the time at the inflection point (the
steepest point) of the curve, in units of the predictor variable |
slope |
A numeric parameter for the response rate |
slope_B |
A numeric parameter for the linear drift rate |
drift_fraction |
A numeric fraction of the primary amplitude |
shape |
Character; the 4-parameter sigmoidal shape. One of
|
x ~ SSsigmoidal_drift(t, A, B, xmid, slope, slope_B, drift_fraction = 0.95, shape = "gompertz")
drift_fraction should be written as a constant, and shape is a string
constant ("symmetric" when omitted); neither is estimated. The hinge at
the drift onset is not differentiable, so algorithm = "port" with
control = nls.control(warnOnly = TRUE) is recommended.
Starting estimates seed the sigmoid as for SSgompertz(), resolve the
drift onset from that seed, and regress the residual past the onset on
time to seed slope_B and correct the asymptote B.
Any parameter may be held constant by writing a value in place of its name
in the formula, e.g.
x ~ SSsigmoidal_drift(t, A = 0, B, xmid, slope, slope_B, drift_fraction = 0.95) fixes the starting asymptote at A = 0. Fixed
parameters are excluded from estimation and are not returned by
stats::coef().
A numeric vector of predicted values the same length as the
predictor variable t.
sigmoidal_drift(), analyse_kinetics(), stats::nls(),
stats::selfStart(), SSlogistic(), SSgompertz(),
SSexponential_drift()
## create a Gompertz curve with late linear drift and random noise
set.seed(13)
t <- 1:120
x <- sigmoidal_drift(
t, A = 10, B = 100, xmid = 40, slope = 4,
slope_B = -0.4, drift_fraction = 0.95, shape = "gompertz"
) + rnorm(length(t), 0, 2)
data <- data.frame(t, x)
## fit with the drift onset held at 95% of the amplitude
model <- nls(
x ~ SSsigmoidal_drift(
t, A, B, xmid, slope, slope_B,
drift_fraction = 0.95, shape = "gompertz"
),
data = data,
algorithm = "port",
control = nls.control(warnOnly = TRUE)
)
summary(model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.