-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
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
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:
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
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
I have the following data:
> y
[1] 0.000 0.004 0.008 0.016 0.024 0.032 0.044 0.064 0.072 0.088 0.108 0.140
[13] 0.156 0.180 0.208 0.236 0.264 0.296 0.320 0.360 0.408 0.444 0.472 0.524
[25] 0.576
> x
[1] 100 200 300 400 500 600 700 800 900 1
5 matches
Mail list logo