How do I test if a non-linear least squares regression best fits a given set of data in R? More specifically I'm interested in getting estimates for a regression like this: $$y=\beta_0+\beta_1(x_1-a)+u$$

(for the variables $\beta_0$,$\beta_1$ and $a$). How would I code this?

  • 1
    $\begingroup$ What does "best fits" mean? What is it being compared with? $\endgroup$ – Glen_b Jun 11 '17 at 4:48
  • $\begingroup$ Your specification is linear in parameters. To test for non-linearity, you could estimate another model including a non-linear effect (e.g. Y = b0 + b1.X1 + b2.(X1*X1) + U) and use a log-likelihood ratio to compare the performance of this 2nd model with your first reference model. $\endgroup$ – Umka Jun 11 '17 at 13:46
  • $\begingroup$ @Glen_b im looking for statistically significant betas. Its being compared to a standard linear regression model without $a$ being subtracted from the $x_1$ $\endgroup$ – EconJohn Jun 11 '17 at 16:53
  • $\begingroup$ @Umka so just throw in an arbitrary constant and see what happens? $\endgroup$ – EconJohn Jun 11 '17 at 16:55

If (as your question seems to say) that you have three parameters to estimate ($\beta_0,\beta_1,a$) then this model is not identifiable.

\begin{eqnarray} y&=&\beta_0+\beta_1(x_1-a)+u\\ &=&(\beta_0-\beta_1 a)+\beta_1 x_1+u\\ &=&\beta_0^*+\beta_1 x_1+u \end{eqnarray}

Now consider that there's some best estimate of slope $\hat{\beta}_1$, and a corresponding best intercept $\hat{\beta}_0^*$ (this doesn't rely on how they're estimated - it doesn't matter).

Then in your formulation the intercept (given the slope) has two free parameters ($\beta_0$ and $a$), so that for a given $\hat{\beta}_0^*$ there's an infinite set of pairs ($\hat{\beta}_0$ and $\hat a$) which will give that best fitting value of intercept. So you simply can't tell which pair it might be -- they will all give identical fits.

As it stands, there's nothing to be done here.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.