Re: [R] fitting curve to data

2009-01-11 Thread Nathan S. Watson-Haigh
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 S Ellison wrote: > Just 'cos it's bent doesn't mean you need nls. Sorry, my bad! :o( > With your data, lm fits (suspicously!) well... Nothing suspiciousjust benchmarking some functions with different sized inputs! Thanks for the help! Nathan

Re: [R] fitting curve to data

2009-01-11 Thread S Ellison
Just 'cos it's bent doesn't mean you need nls. With your data, lm fits (suspicously!) well... y<-c(0.000,0.004,0.008,0.016,0.024,0.032,0.044,0.064,0.072,0.088,0.108,0.140 ,0.156,0.180,0.208,0.236,0.264,0.296,0.320,0.360,0.408,0.444,0.472,0.524 ,0.576) x<-c(100,200,300,400,500,600,700,800,900,1000

Re: [R] fitting curve to data

2009-01-11 Thread Gabor Grothendieck
As x goes from 200 to 400, y goes from ,004 to .016 so y is quadrupling while x doubles -- quadratic growth.Fitting to a quadratic and plotting shows this to be the case. Note that for y to be quadratic in x it must be linear in the coefficients of x so we can just use lm and don't need nls:

Re: [R] fitting curve to data

2009-01-11 Thread Simon Blomberg
First, try plot(x,y) If you want to use nls, you have to specify a nonlinear function to fit to your data. See ?nls. If you are really stuck on how to fit regression models, you should consult a statistician (CSIRO has a lot of expertise). Simon. On Mon, 2009-01-12 at 12:19 +1000, Nathan S. Wa