How do you estimate degrees of freedoms for derived measurements?

I want to assess the significance of the distance of an independent data point to a regression line. I can easily calculate the (vertical) distance between the data point and the regression line, and I get the uncertainty of the distance from the uncertainties of slope and intercept of the linear regression via Gaussian error propagation. However, what are the degrees of freedom?

The linear regression line has been calculated from n data points, thus its degrees of freedom is n-2. The additional measurement is independent, so I get another degree of freedom, bringing the total to n-1?

Also, should I estimate the uncertainty of the independent measurement using the variance of the residuals of the regression, since the measurement process is the same for both the data that went into the fit and the independent data point? I guess this would reduce the degrees of freedom again?


2 Answers 2


There is a well established theory of prediction intervals in the context of linear regression. New values at $x=x_0$ have a normal distribution with mean $\alpha+\beta x_0$ (not surprisingly) and variance $\sigma^2\left(1+\frac{1}{n} + \frac{(x_0-\bar{x})^2}{\sum{(x_i-\bar{x})^2}}\right)$.

After plugging in the estimated versions of the parameters, the standardized distribution will be a $t$ distribution with $n-2$ degrees of freedom. That's because the estimate of $\sigma^2$ has that many degrees of freedom, and the df of the chi-squared term in the denominator drives the degrees of freedom.

Intuitively, you can think that you are not using the new data point for estimating anything, so you are not gaining any degrees of freedom.

  • $\begingroup$ Thanks for your explanation. $\sigma^2$ is the mean squared residual, correct? $\endgroup$
    – Jonas
    Commented Jun 10, 2011 at 11:22
  • $\begingroup$ $\sigma^2$ is the error variance. For purposes of estimation it is replaced by $s^2$, the mean squared error. That when the $t_{n-2}$ distribution comes in. $\endgroup$
    – Aniko
    Commented Jun 10, 2011 at 15:04

Simplest way would be to include the new data point in the regression and add an indicator (dummy) variable to the model that takes the value 1 for your new data point and 0 for all the rest. Then simply look at the t-statistic and p-value for the indicator variable.

This approach assumes the residual variance for the new data point is the same as for the rest, and shows that the degrees of freedom for the comparison are $n-1$ (where $n$ is the number of original data points, i.e. not counting the new one).

  • $\begingroup$ This solution seems to answer a different question: the p-value refers to a test of the significance of the indicator and therefore does not account for variation in the datum itself. Moreover, the df cannot possibly be as high as $n-1$, because now $3$ parameters have to be fit by the model based on $n+1$ data points. $\endgroup$
    – whuber
    Commented Jun 9, 2011 at 13:52
  • $\begingroup$ This indeed answers a somewhat different question, but thank you nevertheless for reminding me about the useful concept! $\endgroup$
    – Jonas
    Commented Jun 10, 2011 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.