On 2010-04-22 11:09, Muhammad Rahiz wrote:
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)
Presumably you want f(s1,a,b) in your nls call.
-Peter Ehlers
curve(f(x,a=co[1],b=co[2]),add=TRUE,col="blue")
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Peter Ehlers
University of Calgary
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.