The R Project SVN R

Rev

Rev 68948 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 68948 Rev 73628
Line 1... Line 1...
1
% File src/library/stats/man/SSgompertz.Rd
1
% File src/library/stats/man/SSgompertz.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-2007 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{SSgompertz}
6
\name{SSgompertz}
7
\title{Self-Starting Nls Gompertz Growth Model}
7
\title{Self-Starting Nls Gompertz Growth Model}
8
\usage{
8
\usage{
Line 32... Line 32...
32
\author{Douglas Bates}
32
\author{Douglas Bates}
33
\seealso{\code{\link{nls}}, \code{\link{selfStart}}
33
\seealso{\code{\link{nls}}, \code{\link{selfStart}}
34
}
34
}
35
\examples{
35
\examples{
36
DNase.1 <- subset(DNase, Run == 1)
36
DNase.1 <- subset(DNase, Run == 1)
37
SSgompertz(log(DNase.1$conc), 4.5, 2.3, 0.7)   # response only
37
SSgompertz(log(DNase.1$conc), 4.5, 2.3, 0.7)  # response only
38
Asym <- 4.5; b2 <- 2.3; b3 <- 0.7
38
local({  Asym <- 4.5; b2 <- 2.3; b3 <- 0.7
39
SSgompertz(log(DNase.1$conc), Asym, b2, b3) # response and gradient
39
  SSgompertz(log(DNase.1$conc), Asym, b2, b3) # response _and_ gradient
-
 
40
})
40
print(getInitial(density ~ SSgompertz(log(conc), Asym, b2, b3),
41
print(getInitial(density ~ SSgompertz(log(conc), Asym, b2, b3),
41
                 data = DNase.1), digits = 5)
42
                 data = DNase.1), digits = 5)
42
## Initial values are in fact the converged values
43
## Initial values are in fact the converged values
43
fm1 <- nls(density ~ SSgompertz(log(conc), Asym, b2, b3),
44
fm1 <- nls(density ~ SSgompertz(log(conc), Asym, b2, b3),
44
           data = DNase.1)
45
           data = DNase.1)
45
summary(fm1)
46
summary(fm1)
-
 
47
plot(density ~ log(conc), DNase.1, # xlim = c(0, 21),
-
 
48
     main = "SSgompertz() fit to DNase.1")
-
 
49
ux <- par("usr")[1:2]; x <- seq(ux[1], ux[2], length.out=250)
-
 
50
lines(x, do.call(SSgompertz, c(list(x=x), coef(fm1))), col = "red", lwd=2)
-
 
51
As <- coef(fm1)[["Asym"]]; abline(v = 0, h = 0, lty = 3)
-
 
52
axis(2, at= exp(-coef(fm1)[["b2"]]), quote(e^{-b[2]}), las=1, pos=0)
46
}
53
}
47
\keyword{models}
54
\keyword{models}