Skip to content

lines(predict(nls()) with NA's

2 messages · Fred Jean

#
Dear List,

my exploration of R goes on... And I REALLY enjoy it ! (thanks to all guRus).

Yesterday a colleague ask me for fitting some data presented as a data.frame,
something like :
x X158.7  X150.0  ...
1   -0.25    506   183.1
2   -0.75    633   210.7
3   -1.25    674   220.3
4   -1.50     NA   244.6
5   -1.75    742   261.2
6   -2.25    787   269.1
7   -2.50     NA   283.5
8   -2.75    794   287.6
9   -3.25    816   296.4
10  -3.50     NA   307.9
...

I used the nls package :
start=list(b=0.5,Cd=500),na.action=na.omit,trace=T)->mod1

then, to look at the result
but (not surprisingly)
doesn't line anything as long as there are NA's in the dependant vector.
How can I make this work and get my nice plots ?

Thanks 
Sincerely yours

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Hi

Finally (a busy evening later) I found it.

This post just in case someone has the same problem
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._