[R] Fitting parabolic function to data

Duncan Murdoch murdoch.duncan at gmail.com
Thu Oct 6 12:07:25 CEST 2011


On 11-10-06 4:59 AM, Henri Mone wrote:
> Dear R users and experts,
>
> I want to fit a shifted parabolic function with the following
> functional form to my data:
>
> f(x)=a0*(x+a1)^2+a2
>
> (a0, a1 and a2 are scaling factors.)
> What is standard approach to do this in R? I tried the "lm" function
> in R but I got problems getting the above functional form.
>
> Any help is welcome :) .

That can be expanded into a regular quadratic:

(a0*a1^2 + a2) + 2*a0*a1*x + a0*x^2

So fit a regular quadratic, and then solve for a0, a1, a2 from the 
resulting coefficients.  The only tricky bit will be computing errors on 
the a's.

Duncan Murdoch



More information about the R-help mailing list