How do I remove points to subtract the $b$ term in a linear regression fit?

30 Views Asked by At

I have a scatterplot of points with a fit of $y = mx + b$. I would like to only keep the points such that the linear fit would be: $y = mx$.

How do I subtract out the points contributing to the $b$ term in the linear regression fit?

1

There are 1 best solutions below

0
On BEST ANSWER

The OLS estimator of the intercept is $$ \hat{b} = \bar{Y}_n - \hat{m}\bar{X}_n, $$ hence, if there is a non-zero correlation between $Y$ and $X$, then the easiest way is to insure that both $\bar{Y}_n$ and $\bar{X}_n$ are zero. E.g., you can subtract the sample mean from $Y$ and $X$ in order to get $b=0$.