# Line of Best Fit

If we have a dataset with two variables, X & Y, we can find the line of best fit using the empirical data (and whatever method suits you best).

However, what if know the true joint distribution of X & Y, how could we find the "true" line of best fit?

For example, if we have X & Y distributed uniformly such that 0 < X < 1, 0 < Y < 1 and X + Y < 1, the line of best fit should be the line y = -0.5x + 0.5.

Can this be generalised to any joint distribution? If not what are the limitations?

• The procedure is exactly the same as for data: ordinary least squares regression. The only limitation is that the variance of the response variable must be finite. Typically one wants to compute the regression rather than the linear regression; it's a basic theorem that the value of the regression is the conditional expectation. In your example the regression (obviously) gives exactly the formula you propose and, because it is linear, this must be the least squares line. – whuber Apr 11 at 14:52