Last chance! 50% off unlimited learning
Sale ends in
This selfStart
model evaluates the Weibull model for growth
curve data and its gradient. It has an initial
attribute that
will evaluate initial estimates of the parameters Asym
, Drop
,
lrc
, and pwr
for a given set of data.
SSweibull(x, Asym, Drop, lrc, pwr)
a numeric vector of values at which to evaluate the model.
a numeric parameter representing the horizontal asymptote on
the right side (very small values of x
).
a numeric parameter representing the change from
Asym
to the y
intercept.
a numeric parameter representing the natural logarithm of the rate constant.
a numeric parameter representing the power to which x
is raised.
a numeric vector of the same length as x
. It is the value of
the expression Asym-Drop*exp(-exp(lrc)*x^pwr)
. If all of
the arguments Asym
, Drop
, lrc
, and pwr
are
names of objects, the gradient matrix with respect to these names is
attached as an attribute named gradient
.
This model is a generalization of the SSasymp
model in
that it reduces to SSasymp
when pwr
is unity.
Ratkowsky, David A. (1983), Nonlinear Regression Modeling, Dekker. (section 4.4.5)
# NOT RUN {
Chick.6 <- subset(ChickWeight, (Chick == 6) & (Time > 0))
SSweibull(Chick.6$Time, 160, 115, -5.5, 2.5) # response only
local({ Asym <- 160; Drop <- 115; lrc <- -5.5; pwr <- 2.5
SSweibull(Chick.6$Time, Asym, Drop, lrc, pwr) # response _and_ gradient
})
getInitial(weight ~ SSweibull(Time, Asym, Drop, lrc, pwr), data = Chick.6)
## Initial values are in fact the converged values
fm1 <- nls(weight ~ SSweibull(Time, Asym, Drop, lrc, pwr), data = Chick.6)
summary(fm1)
## Data and Fit:
plot(weight ~ Time, Chick.6, xlim = c(0, 21), main = "SSweibull() fit to Chick.6")
ux <- par("usr")[1:2]; x <- seq(ux[1], ux[2], length.out=250)
lines(x, do.call(SSweibull, c(list(x=x), coef(fm1))), col = "red", lwd=2)
As <- coef(fm1)[["Asym"]]; abline(v = 0, h = c(As, As - coef(fm1)[["Drop"]]), lty = 3)
# }
Run the code above in your browser using DataLab