# Testing for a Non-Linear regression in R

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?

• What does "best fits" mean? What is it being compared with? – Glen_b Jun 11 '17 at 4:48
• 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. – Umka Jun 11 '17 at 13:46
• @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$ – EconJohn Jun 11 '17 at 16:53
• @Umka so just throw in an arbitrary constant and see what happens? – 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.
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.