0

I am having problems adding a line to one scatter plot. My data is fit to an exponential model. I used nls to get coefficients:

fit <- nls(volumen ~ bo+ exp(b1*dap), data= df, start = list(bo=0, b1=55))

Later I used plot and lines commands to visualize the fit to my data:

plot(dap,volumen)
lines(dap,predict(fit,data.frame(x=dap)))

My Big problem is that I visualize a linear line that does not fit with my exponential points.

Could my model statement have errors?

Please, any comments I would appreciate.

OhBeWise
  • 5,350
  • 3
  • 32
  • 60
Rodrigo_BC
  • 161
  • 11
  • 2
    You may be giving a different set of values to the predict function. (`dap` may not be `df$dap`.) And you have not offered the data in `df`. I don't see how you expect the worldwide SO audience to offer much in the way of specific advice. – IRTFM Jun 19 '15 at 17:39
  • Maybe you just have a bad fit. Hard to say without more information from you. – Roland Jun 19 '15 at 18:40
  • It would be easier to help you with a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – MrFlick Jun 19 '15 at 18:53

0 Answers0