[R] Error in plotting non-linear regression

Muhammad Rahiz muhammad.rahiz at ouce.ox.ac.uk
Thu Apr 22 19:09:23 CEST 2010


Hello everyone,

I'm trying to draw the non-linear regression curve to look at the 
distance decay relationship between distance and correlation values. But 
I'm not able to plot the curve as I'm struggling with the following 
error ("parameters without starting value in 'data': x") and found no 
answers online.*

*Can anyone help...

--
Muhammad*


*    s1         cm
1    0 0.57223196
2   10 0.33110049
3   20 0.11163181
4   30 0.10242237
5   40 0.09254315
6   50 0.02739370
7   60 0.02567137
8   70 0.02492397
9   80 0.03206637
10  90 0.02487381
11 100 0.01747584
12 110 0.15977533
13 120 0.13317708

new <- data.frame(s1,cm)
plot(s1,cm)
f  <- function(x,a,b){a*exp(-b*x)}    
fm <- nls(cm~f(x,a,b),data=new,start=c(a=1,b=1))   
co <- coef(fm)                           
curve(f(x,a=co[1],b=co[2]),add=TRUE,col="blue")



More information about the R-help mailing list