Examples for 'stats::predict.nls'


Predicting from Nonlinear Least Squares Fits

Aliases: predict.nls

Keywords: nonlinear regression models

### ** Examples

## Don't show: 
od <- options(digits = 5)
## End(Don't show)
require(graphics)

fm <- nls(demand ~ SSasympOrig(Time, A, lrc), data = BOD)
predict(fm)              # fitted values at observed times
[1]  7.8874 12.5250 15.2517 16.8549 17.7975 18.6776
## Form data plot and smooth line for the predictions
opar <- par(las = 1)
plot(demand ~ Time, data = BOD, col = 4,
     main = "BOD data and fitted first-order curve",
     xlim = c(0,7), ylim = c(0, 20) )
tt <- seq(0, 8, length.out = 101)
lines(tt, predict(fm, list(Time = tt)))
plot of chunk example-stats-predict.nls-1
par(opar)
## Don't show: 
options(od)
## End(Don't show)

[Package stats version 4.2.3 Index]