| Line 1... |
Line 1... |
| 1 |
% File src/library/stats/man/SSmicmen.Rd
|
1 |
% File src/library/stats/man/SSmicmen.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{SSmicmen}
|
6 |
\name{SSmicmen}
|
| 7 |
\encoding{UTF-8}
|
7 |
\encoding{UTF-8}
|
| 8 |
\title{Self-Starting Nls Michaelis-Menten Model}
|
8 |
\title{Self-Starting Nls Michaelis-Menten Model}
|
| Line 33... |
Line 33... |
| 33 |
\seealso{\code{\link{nls}}, \code{\link{selfStart}}
|
33 |
\seealso{\code{\link{nls}}, \code{\link{selfStart}}
|
| 34 |
}
|
34 |
}
|
| 35 |
\examples{
|
35 |
\examples{
|
| 36 |
PurTrt <- Puromycin[ Puromycin$state == "treated", ]
|
36 |
PurTrt <- Puromycin[ Puromycin$state == "treated", ]
|
| 37 |
SSmicmen(PurTrt$conc, 200, 0.05) # response only
|
37 |
SSmicmen(PurTrt$conc, 200, 0.05) # response only
|
| 38 |
Vm <- 200; K <- 0.05
|
38 |
local({ Vm <- 200; K <- 0.05
|
| 39 |
SSmicmen(PurTrt$conc, Vm, K) # response and gradient
|
39 |
SSmicmen(PurTrt$conc, Vm, K) # response _and_ gradient
|
| - |
|
40 |
})
|
| 40 |
print(getInitial(rate ~ SSmicmen(conc, Vm, K), data = PurTrt), digits = 3)
|
41 |
print(getInitial(rate ~ SSmicmen(conc, Vm, K), data = PurTrt), digits = 3)
|
| 41 |
## Initial values are in fact the converged values
|
42 |
## Initial values are in fact the converged values
|
| 42 |
fm1 <- nls(rate ~ SSmicmen(conc, Vm, K), data = PurTrt)
|
43 |
fm1 <- nls(rate ~ SSmicmen(conc, Vm, K), data = PurTrt)
|
| 43 |
summary(fm1)
|
44 |
summary(fm1)
|
| 44 |
## Alternative call using the subset argument
|
45 |
## Alternative call using the subset argument
|
| 45 |
fm2 <- nls(rate ~ SSmicmen(conc, Vm, K), data = Puromycin,
|
46 |
fm2 <- nls(rate ~ SSmicmen(conc, Vm, K), data = Puromycin,
|
| 46 |
subset = state == "treated")
|
47 |
subset = state == "treated")
|
| 47 |
summary(fm2)
|
48 |
summary(fm2) # The same indeed:
|
| - |
|
49 |
stopifnot(all.equal(coef(summary(fm1)), coef(summary(fm2))))
|
| 48 |
\dontshow{
|
50 |
|
| 49 |
require(graphics)
|
51 |
## Visualize the SSmicmen() Michaelis-Menton model parametrization :
|
| 50 |
|
52 |
|
| 51 |
xx <- seq(0, 5, len = 101)
|
53 |
xx <- seq(0, 5, len = 101)
|
| 52 |
yy <- 5 * xx/(1+xx)
|
54 |
yy <- 5 * xx/(1+xx)
|
| - |
|
55 |
stopifnot(all.equal(yy, SSmicmen(xx, Vm = 5, K = 1)))
|
| - |
|
56 |
require(graphics)
|
| 53 |
par(mar = c(0, 0, 3.5, 0))
|
57 |
op <- par(mar = c(0, 0, 3.5, 0))
|
| 54 |
plot(xx, yy, type = "l", axes = FALSE, ylim = c(0,6), xlim = c(-1, 5),
|
58 |
plot(xx, yy, type = "l", lwd = 2, ylim = c(-1/4,6), xlim = c(-1, 5),
|
| 55 |
xlab = "", ylab = "", lwd = 2,
|
59 |
ann = FALSE, axes = FALSE, main = "Parameters in the SSmicmen model")
|
| 56 |
main = "Parameters in the SSmicmen model")
|
60 |
mtext(quote(list(phi[1] == "Vm", phi[2] == "K")))
|
| 57 |
usr <- par("usr")
|
61 |
usr <- par("usr")
|
| 58 |
arrows(usr[1], 0, usr[2], 0, length = 0.1, angle = 25)
|
62 |
arrows(usr[1], 0, usr[2], 0, length = 0.1, angle = 25)
|
| 59 |
arrows(0, usr[3], 0, usr[4], length = 0.1, angle = 25)
|
63 |
arrows(0, usr[3], 0, usr[4], length = 0.1, angle = 25)
|
| 60 |
text(usr[2] - 0.2, 0.1, "x", adj = c(1, 0))
|
64 |
text(usr[2] - 0.2, 0.1, "x", adj = c(1, 0))
|
| 61 |
text(-0.1, usr[4], "y", adj = c(1, 1))
|
65 |
text( -0.1, usr[4], "y", adj = c(1, 1))
|
| 62 |
abline(h = 5, lty = 2, lwd = 0)
|
66 |
abline(h = 5, lty = 3)
|
| 63 |
arrows(-0.8, 2.1, -0.8, 0, length = 0.1, angle = 25)
|
67 |
arrows(-0.8, c(2.1, 2.9),
|
| 64 |
arrows(-0.8, 2.9, -0.8, 5, length = 0.1, angle = 25)
|
68 |
-0.8, c(0, 5 ), length = 0.1, angle = 25)
|
| 65 |
text(-0.8, 2.5, expression(phi[1]), adj = c(0.5, 0.5))
|
69 |
text( -0.8, 2.5, quote(phi[1]))
|
| 66 |
segments(1, 0, 1, 2.7, lty = 2, lwd = 0.75)
|
70 |
segments(1, 0, 1, 2.7, lty = 2, lwd = 0.75)
|
| 67 |
text(1, 2.7, expression(phi[2]), adj = c(0.5, 0))
|
71 |
text(1, 2.7, quote(phi[2]))
|
| 68 |
}
|
72 |
par(op)
|
| 69 |
}
|
73 |
}
|
| 70 |
\keyword{models}
|
74 |
\keyword{models}
|