[R] lines(predict(nls()) with NA's

Fred JEAN Frederic.Jean at univ-brest.fr
Tue Jul 9 22:25:43 CEST 2002


Hi

Finally (a busy evening later) I found it.

This post just in case someone has the same problem


> >nls(nls(X158.7 ~ Cd + ((158.7-Cd)*exp(b*x)),
> start=list(b=0.5,Cd=500),na.action=na.omit,trace=T)->mod1
> 
> then, to look at the result
> > plot(x,X158.7, pch='+', col='blue')
> 
> but (not surprisingly)
> > lines(predict(mod1),lty=2,col='red')
> 
> doesn't line anything as long as there are NA's in the dependant vector.

A solution is 

lines(x, predict(mod1, list(x=x),  type='l', lty=2, col='red')

Sorry for my naive questions... and self-answers... sometimes my brain
seems to be like cottage cheese.

Fred
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list