| Line 1... |
Line 1... |
| 1 |
% File src/library/stats/man/SSasympOrig.Rd
|
1 |
% File src/library/stats/man/SSasympOrig.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{SSasympOrig}
|
6 |
\name{SSasympOrig}
|
| 7 |
\encoding{UTF-8}
|
7 |
\alias{SSasympOrig}
|
| 8 |
\title{Self-Starting Nls Asymptotic Regression Model through the Origin}
|
8 |
\title{Self-Starting Nls Asymptotic Regression Model through the Origin}
|
| - |
|
9 |
\encoding{UTF-8}
|
| 9 |
\usage{
|
10 |
\usage{
|
| 10 |
SSasympOrig(input, Asym, lrc)
|
11 |
SSasympOrig(input, Asym, lrc)
|
| 11 |
}
|
12 |
}
|
| 12 |
\alias{SSasympOrig}
|
- |
|
| 13 |
\arguments{
|
13 |
\arguments{
|
| 14 |
\item{input}{a numeric vector of values at which to evaluate the model.}
|
14 |
\item{input}{a numeric vector of values at which to evaluate the model.}
|
| 15 |
\item{Asym}{a numeric parameter representing the horizontal asymptote.}
|
15 |
\item{Asym}{a numeric parameter representing the horizontal asymptote.}
|
| 16 |
\item{lrc}{a numeric parameter representing the natural logarithm of
|
16 |
\item{lrc}{a numeric parameter representing the natural logarithm of
|
| 17 |
the rate constant.}
|
17 |
the rate constant.}
|
| 18 |
}
|
18 |
}
|
| 19 |
\description{
|
19 |
\description{
|
| 20 |
This \code{selfStart} model evaluates the asymptotic regression
|
20 |
This \code{\link{selfStart}} model evaluates the asymptotic regression
|
| 21 |
function through the origin and its gradient. It has an
|
21 |
function through the origin and its gradient. It has an
|
| 22 |
\code{initial} attribute that will evaluate initial estimates of the
|
22 |
\code{initial} attribute that will evaluate initial estimates of the
|
| 23 |
parameters \code{Asym} and \code{lrc} for a given set of data.
|
23 |
parameters \code{Asym} and \code{lrc} for a given set of data.
|
| 24 |
}
|
24 |
}
|
| 25 |
\value{
|
25 |
\value{
|
| Line 33... |
Line 33... |
| 33 |
\seealso{\code{\link{nls}}, \code{\link{selfStart}}
|
33 |
\seealso{\code{\link{nls}}, \code{\link{selfStart}}
|
| 34 |
}
|
34 |
}
|
| 35 |
\examples{\donttest{
|
35 |
\examples{\donttest{
|
| 36 |
Lob.329 <- Loblolly[ Loblolly$Seed == "329", ]
|
36 |
Lob.329 <- Loblolly[ Loblolly$Seed == "329", ]
|
| 37 |
SSasympOrig(Lob.329$age, 100, -3.2) # response only
|
37 |
SSasympOrig(Lob.329$age, 100, -3.2) # response only
|
| 38 |
Asym <- 100; lrc <- -3.2
|
38 |
local({ Asym <- 100; lrc <- -3.2
|
| 39 |
SSasympOrig(Lob.329$age, Asym, lrc) # response and gradient
|
39 |
SSasympOrig(Lob.329$age, Asym, lrc) # response and gradient
|
| - |
|
40 |
})
|
| 40 |
getInitial(height ~ SSasympOrig(age, Asym, lrc), data = Lob.329)
|
41 |
getInitial(height ~ SSasympOrig(age, Asym, lrc), data = Lob.329)
|
| 41 |
## Initial values are in fact the converged values
|
42 |
## Initial values are in fact the converged values
|
| 42 |
fm1 <- nls(height ~ SSasympOrig(age, Asym, lrc), data = Lob.329)
|
43 |
fm1 <- nls(height ~ SSasympOrig(age, Asym, lrc), data = Lob.329)
|
| 43 |
summary(fm1)
|
44 |
summary(fm1)
|
| 44 |
}
|
45 |
}
|
| 45 |
\dontshow{
|
46 |
|
| 46 |
require(graphics)
|
47 |
## Visualize the SSasympOrig() model parametrization :
|
| 47 |
|
48 |
|
| 48 |
xx <- seq(0, 5, len = 101)
|
49 |
xx <- seq(0, 5, len = 101)
|
| 49 |
yy <- 5 * (1- exp(-xx/(2*log(2))))
|
50 |
yy <- 5 * (1- exp(-xx * log(2)))
|
| - |
|
51 |
stopifnot( all.equal(yy, SSasympOrig(xx, Asym = 5, lrc = log(log(2)))) )
|
| - |
|
52 |
|
| - |
|
53 |
require(graphics)
|
| 50 |
par(mar = c(0, 0, 3.5, 0))
|
54 |
op <- par(mar = c(0, 0, 3.5, 0))
|
| 51 |
plot(xx, yy, type = "l", axes = FALSE, ylim = c(0,6), xlim = c(-1, 5),
|
55 |
plot(xx, yy, type = "l", axes = FALSE, ylim = c(0,5), xlim = c(-1/4, 5),
|
| 52 |
xlab = "", ylab = "", lwd = 2,
|
56 |
xlab = "", ylab = "", lwd = 2,
|
| 53 |
main = "Parameters in the SSasympOrig model")
|
57 |
main = quote("Parameters in the SSasympOrig model"~~ f[phi](x)))
|
| - |
|
58 |
mtext(quote(list(phi[1] == "Asym", phi[2] == "lrc")))
|
| 54 |
usr <- par("usr")
|
59 |
usr <- par("usr")
|
| 55 |
arrows(usr[1], 0, usr[2], 0, length = 0.1, angle = 25)
|
60 |
arrows(usr[1], 0, usr[2], 0, length = 0.1, angle = 25)
|
| 56 |
arrows(0, usr[3], 0, usr[4], length = 0.1, angle = 25)
|
61 |
arrows(0, usr[3], 0, usr[4], length = 0.1, angle = 25)
|
| 57 |
text(usr[2] - 0.2, 0.1, "x", adj = c(1, 0))
|
62 |
text(usr[2] - 0.2, 0.1, "x", adj = c(1, 0))
|
| 58 |
text(-0.1, usr[4], "y", adj = c(1, 1))
|
63 |
text( -0.1, usr[4], "y", adj = c(1, 1))
|
| 59 |
abline(h = 5, lty = 2, lwd = 0)
|
64 |
abline(h = 5, lty = 3)
|
| 60 |
arrows(-0.8, 2.1, -0.8, 0, length = 0.1, angle = 25)
|
65 |
axis(2, at = 5*c(1/2,1), labels= expression(frac(phi[1],2), phi[1]), pos=0, las=1)
|
| 61 |
arrows(-0.8, 2.9, -0.8, 5, length = 0.1, angle = 25)
|
66 |
arrows(c(.3,.7), 5/2,
|
| 62 |
text(-0.8, 2.5, expression(phi[1]), adj = c(0.5, 0.5))
|
67 |
c(0, 1 ), 5/2, length = 0.08, angle = 25)
|
| 63 |
segments(1, 2.525, 1, 3.5, lty = 2, lwd = 0.75)
|
68 |
text( 0.5, 5/2, quote(t[0.5]))
|
| 64 |
arrows(0.2, 3.0, 0, 3.0, length = 0.08, angle = 25)
|
69 |
text( 1 +.4, 5/2,
|
| 65 |
arrows(0.8, 3.0, 1, 3.0, length = 0.08, angle = 25)
|
70 |
quote({f(t[0.5]) == frac(phi[1],2)}~{} \%=>\% {}~~{t[0.5] == frac(log(2), e^{phi[2]})}),
|
| 66 |
text(0.5, 3.0, expression(t[0.5]), adj = c(0.5, 0.5))
|
71 |
adj = c(0, 0.5))
|
| 67 |
}
|
72 |
par(op)
|
| 68 |
}
|
73 |
}
|
| 69 |
\keyword{models}
|
74 |
\keyword{models}
|