| Line 1... |
Line 1... |
| 1 |
% File src/library/stats/man/SSasympOff.Rd
|
1 |
% File src/library/stats/man/SSasympOff.Rd
|
| 2 |
% Part of the R package, https://www.R-project.org
|
2 |
% Part of the R package, https://www.R-project.org
|
| 3 |
% Copyright 1995-2010 R Core Team
|
3 |
% Copyright 1995-2017 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| 6 |
\name{SSasympOff}
|
6 |
\name{SSasympOff}
|
| 7 |
\encoding{UTF-8}
|
7 |
\encoding{UTF-8}
|
| 8 |
\title{Self-Starting Nls Asymptotic Regression Model with an Offset}
|
8 |
\title{Self-Starting Nls Asymptotic Regression Model with an Offset}
|
| Line 35... |
Line 35... |
| 35 |
attached as an attribute named \code{gradient}.
|
35 |
attached as an attribute named \code{gradient}.
|
| 36 |
}
|
36 |
}
|
| 37 |
\author{\enc{José}{Jose} Pinheiro and Douglas Bates}
|
37 |
\author{\enc{José}{Jose} Pinheiro and Douglas Bates}
|
| 38 |
\seealso{\code{\link{nls}}, \code{\link{selfStart}};
|
38 |
\seealso{\code{\link{nls}}, \code{\link{selfStart}};
|
| 39 |
\code{example(SSasympOff)} gives graph showing the \code{SSasympOff}
|
39 |
\code{example(SSasympOff)} gives graph showing the \code{SSasympOff}
|
| 40 |
parametrization, where \eqn{\phi_1}{phi_1} is \code{Asymp},
|
40 |
parametrization.
|
| 41 |
\eqn{\phi_3}{phi_3} is \code{c0}.% , and \eqn{t_{0.5}} is FIXME
|
- |
|
| 42 |
}
|
41 |
}
|
| 43 |
\examples{
|
42 |
\examples{
|
| 44 |
CO2.Qn1 <- CO2[CO2$Plant == "Qn1", ]
|
43 |
CO2.Qn1 <- CO2[CO2$Plant == "Qn1", ]
|
| 45 |
SSasympOff(CO2.Qn1$conc, 32, -4, 43) # response only
|
44 |
SSasympOff(CO2.Qn1$conc, 32, -4, 43) # response only
|
| 46 |
Asym <- 32; lrc <- -4; c0 <- 43
|
45 |
local({ Asym <- 32; lrc <- -4; c0 <- 43
|
| 47 |
SSasympOff(CO2.Qn1$conc, Asym, lrc, c0) # response and gradient
|
46 |
SSasympOff(CO2.Qn1$conc, Asym, lrc, c0) # response and gradient
|
| - |
|
47 |
})
|
| 48 |
getInitial(uptake ~ SSasympOff(conc, Asym, lrc, c0), data = CO2.Qn1)
|
48 |
getInitial(uptake ~ SSasympOff(conc, Asym, lrc, c0), data = CO2.Qn1)
|
| 49 |
## Initial values are in fact the converged values
|
49 |
## Initial values are in fact the converged values
|
| 50 |
fm1 <- nls(uptake ~ SSasympOff(conc, Asym, lrc, c0), data = CO2.Qn1)
|
50 |
fm1 <- nls(uptake ~ SSasympOff(conc, Asym, lrc, c0), data = CO2.Qn1)
|
| 51 |
summary(fm1)
|
51 |
summary(fm1)
|
| 52 |
\dontshow{
|
- |
|
| 53 |
require(graphics)
|
- |
|
| 54 |
|
52 |
|
| - |
|
53 |
## Visualize the SSasympOff() model parametrization :
|
| - |
|
54 |
|
| 55 |
xx <- seq(0.5, 5, len = 101)
|
55 |
xx <- seq(0.25, 8, by=1/16)
|
| 56 |
yy <- 5 * (1 - exp(-(xx - 0.5)/(2*log(2))))
|
56 |
yy <- 5 * (1 - exp(-(xx - 3/4)*0.4))
|
| - |
|
57 |
stopifnot( all.equal(yy, SSasympOff(xx, Asym = 5, lrc = log(0.4), c0 = 3/4)) )
|
| - |
|
58 |
require(graphics)
|
| 57 |
par(mar = c(0, 0, 4.0, 0))
|
59 |
op <- par(mar = c(0, 0, 4.0, 0))
|
| 58 |
plot(xx, yy, type = "l", axes = FALSE, ylim = c(0,6), xlim = c(-1, 5),
|
60 |
plot(xx, yy, type = "l", axes = FALSE, ylim = c(-.5,6), xlim = c(-1, 8),
|
| 59 |
xlab = "", ylab = "", lwd = 2,
|
61 |
xlab = "", ylab = "", lwd = 2,
|
| 60 |
main = "Parameters in the SSasympOff model")
|
62 |
main = "Parameters in the SSasympOff model")
|
| - |
|
63 |
mtext(quote(list(phi[1] == "Asym", phi[2] == "lrc", phi[3] == "c0")))
|
| 61 |
usr <- par("usr")
|
64 |
usr <- par("usr")
|
| 62 |
arrows(usr[1], 0, usr[2], 0, length = 0.1, angle = 25)
|
65 |
arrows(usr[1], 0, usr[2], 0, length = 0.1, angle = 25)
|
| 63 |
arrows(0, usr[3], 0, usr[4], length = 0.1, angle = 25)
|
66 |
arrows(0, usr[3], 0, usr[4], length = 0.1, angle = 25)
|
| 64 |
text(usr[2] - 0.2, 0.1, "x", adj = c(1, 0))
|
67 |
text(usr[2] - 0.2, 0.1, "x", adj = c(1, 0))
|
| 65 |
text(-0.1, usr[4], "y", adj = c(1, 1))
|
68 |
text( -0.1, usr[4], "y", adj = c(1, 1))
|
| 66 |
abline(h = 5, lty = 2, lwd = 0)
|
69 |
abline(h = 5, lty = 3)
|
| 67 |
arrows(-0.8, 2.1, -0.8, 0, length = 0.1, angle = 25)
|
70 |
arrows(-0.8, c(2.1, 2.9),
|
| 68 |
arrows(-0.8, 2.9, -0.8, 5, length = 0.1, angle = 25)
|
71 |
-0.8, c(0 , 5 ), length = 0.1, angle = 25)
|
| 69 |
text(-0.8, 2.5, expression(phi[1]), adj = c(0.5, 0.5))
|
72 |
text (-0.8, 2.5, quote(phi[1]))
|
| 70 |
segments(0.5, 0, 0.5, 3, lty = 2, lwd = 0.75)
|
73 |
segments(3/4, -.2, 3/4, 1.6, lty = 2)
|
| 71 |
text(0.5, 3.1, expression(phi[3]), adj = c(0.5, 0))
|
74 |
text (3/4, c(-.3, 1.7), quote(phi[3]))
|
| 72 |
segments(1.5, 2.525, 1.5, 3, lty = 2, lwd = 0.75)
|
75 |
arrows(c(1.1, 1.4), -.15,
|
| 73 |
arrows(0.7, 2.65, 0.5, 2.65, length = 0.08, angle = 25)
|
76 |
c(3/4, 7/4), -.15, length = 0.07, angle = 25)
|
| - |
|
77 |
text (3/4 + 1/2, -.15, quote(1))
|
| - |
|
78 |
segments(c(3/4, 7/4, 7/4), c(0, 0, 2), # 5 * exp(log(0.4)) = 2
|
| 74 |
arrows(1.3, 2.65, 1.5, 2.65, length = 0.08, angle = 25)
|
79 |
c(7/4, 7/4, 3/4), c(0, 2, 0), lty = 2, lwd = 2)
|
| 75 |
text(1.0, 2.65, expression(t[0.5]), adj = c(0.5, 0.5))
|
80 |
text( 7/4 +.1, 2./2, quote(phi[1]*e^phi[2]), adj = c(0, .5))
|
| 76 |
}
|
81 |
par(op)
|
| 77 |
}
|
82 |
}
|
| 78 |
\keyword{models}
|
83 |
\keyword{models}
|