Fitting a line through intercept 0

39 Views Asked by At

I need to code a least squares routine to fit a line

$$y = m*x$$

into a 2d set of points

$$(x_i,y_i)$$

How can I find the regression line without an interceptor?

1

There are 1 best solutions below

1
On BEST ANSWER

If I understand your problem, you want to find the regression line without an interceptor, in which case you can use the estimator of $\beta$

$$\hat{\beta} = \frac{\overline{xy}}{\overline{x^2}}$$