Linear regression through the origin (source code)

= Linear regression through the origin

In the model $Y_i=\beta x_i+\varepsilon_i$ without an intercept, with $\sum_i x_i^2>0$, the ordinary least-squares estimator is
$$
\widehat\beta=\frac{\sum_i x_iY_i}{\sum_i x_i^2}.
$$
For independent errors of common variance $\sigma^2$, it is unbiased and has variance $\sigma^2/\sum_i x_i^2$.