Young-Jin Lee <youngjin.michael <at> gmail.com> writes:
>
> Dear R users
>
> I have a question about how to fit data to a straight line.
> I tried nls to do it, but it didn't work.
>
>
You really need to read a statistics book!
R assumes that you have basic statistical training
and/or access to basic statistics texts (e.g.
books by Dalgaard or any of the other fine books
listed on the R web site, but *any* introductory
statistics textbook would do).
I also can't see why nls() wouldn't work.
> x = 1:10
> y = rnorm(10,1+x,sd=0.4)
> AIC(nls(y~a+b*x,start=list(a=1,b=1)))
[1] 11.3995> AIC(lm(y~x))
[1] 11.3995
I probably shouldn't have answered this --
please read the posting guide before you post
again ...
sincerely,
Ben Bolker