[R] predict

Kay Cichini Kay.Cichini at uibk.ac.at
Fri Mar 26 13:04:39 CET 2010


hello,

sorry to have hassled you with this - in the end it is all quite simple and
after digging deeper into the help files, also of predict.lm, i finally
managed to do it.
here is the worked example with solution for anyone beeing clumsy as i was:

###########################################################
por<-data.frame(list(structure(list(run = structure(c(1L, 1L, 1L, 1L, 2L,
2L,
2L, 2L, 3L, 3L, 3L, 3L), .Label = c("1", "3", "4"), class = "factor"),
    press = c(15, 21, 24, 29.5, 15, 21, 24, 29.5, 15, 21, 24,
    29.5), tr_rel = c(1, 0.459454191, 0.234697856, 0.135282651,
    1, 0.853283066, 0.306314797, 0.186302231, 1, 0.42980063,
    0.103882476, 0.086463799), tr = c(513, 235.7, 120.4, 69.4,
    318.3, 271.6, 97.5, 59.3, 476.5, 204.8, 49.5, 41.2)), .Names = c("run",
"press", "tr_rel", "tr"), row.names = c(NA, -12L), class = "data.frame")))
attach(por) 

summary(mod1<-nls(tr ~ SSlogis( log(press), Asym, xmid, scal)))

predict(mod1, x_press)

x_press<-data.frame(press=seq(from=5,to=35,by=0.5))

y_pred<-data.frame(tr=predict(mod1, x_press))

plot(press,tr, xlim=c(10,30))
lines(cbind(x_press,y_pred))
###########################################################

greetings,
kay
-- 
View this message in context: http://n4.nabble.com/nls-predict-problem-tp1690561p1692061.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list