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 72321
Line 70... Line 70...
70
  used in the fit).  A warning will be given if the
70
  used in the fit).  A warning will be given if the
71
  variables found are not of the same length as those in \code{newdata}
71
  variables found are not of the same length as those in \code{newdata}
72
  if it was supplied.
72
  if it was supplied.
73
}
73
}
74
\examples{
74
\examples{
75
\testonly{od <- options(digits = 5)}
75
\dontshow{od <- options(digits = 5)}
76
require(graphics)
76
require(graphics)
77
 
77
 
78
fm <- nls(demand ~ SSasympOrig(Time, A, lrc), data = BOD)
78
fm <- nls(demand ~ SSasympOrig(Time, A, lrc), data = BOD)
79
predict(fm)              # fitted values at observed times
79
predict(fm)              # fitted values at observed times
80
## Form data plot and smooth line for the predictions
80
## Form data plot and smooth line for the predictions
Line 83... Line 83...
83
     main = "BOD data and fitted first-order curve",
83
     main = "BOD data and fitted first-order curve",
84
     xlim = c(0,7), ylim = c(0, 20) )
84
     xlim = c(0,7), ylim = c(0, 20) )
85
tt <- seq(0, 8, length = 101)
85
tt <- seq(0, 8, length = 101)
86
lines(tt, predict(fm, list(Time = tt)))
86
lines(tt, predict(fm, list(Time = tt)))
87
par(opar)
87
par(opar)
88
\testonly{options(od)}
88
\dontshow{options(od)}
89
}
89
}
90
\keyword{nonlinear}
90
\keyword{nonlinear}
91
\keyword{regression}
91
\keyword{regression}
92
\keyword{models}
92
\keyword{models}