# Constrained linear regression through a specified point

I have a point (x,y) that I need a linear regressor to pass through given a data set (X,Y). How do I implement this in R?

• @cardinal Good answer! (Maybe you could post it as a reply?)
– whuber
Jun 29 '11 at 20:37
• If the fitted line does not have a negative slope, the best you can do is a zero slope, which will pass through the point $(x,y)$, thereby uniquely determining it.
If $(x_0,y_0)$ is the point through which the regression line must pass, fit the model $y−y_0=\beta (x−x_0)+\varepsilon$, i.e., a linear regression with "no intercept" on a translated data set. In $R$, this might look like lm( I(y-y0) ~ I(x-x0) + 0). Note the + 0 at the end which indicates to lm that no intercept term should be fit.
Whether or not it is actually a good idea to force a regression line to go through a particular point is a separate matter and is problem dependent. Generally, I would personally caution against this, unless there is a very good reason (e.g., very strong theoretical considerations). For one thing, fitting the full model can provide a means for measuring lack of fit. As a second matter, if you are mostly interested in evaluating model explanatory power for values of $x$ and $y$ "far away" from $(x_0,y_0)$, then the relevance of the fixed point becomes suspect.