There is a bi-dimensional table of frequencies:

freq table

Doing the regression analysis with the fit formula being $\hat y=a+bx^2$, where $\hat y$ is the same as $y^{est}$, the filled table looks like this: calculated table of regression analysis

Doing standard regression analysis (i.e. by calculator) and substituting calculated $a$ and $b$ yields linear fit formula $\hat y_i=0.1077+1.4154x^2$.

I need to calculate the residual variance. I have encountered two formulas for calculating, I residual variance in the statistics course presentations, I am currently taking:

$$V_r=\frac{\sum_i n_ie_i^2}{\sum_i n_i} - \left(\frac{\sum_i n_ix_i}{\sum_i n_i}\right)^2$$ $$V_r=\frac{\sum_i e_i^2}n - \left(\frac{\sum_i e_i}n\right)^2$$

They both give different results (1.5282 vs 2.6219). There is a also question concerning this, that has got a exhaustive answer and the formula there for residual variance is:

$$\text{Var}(e^0) = \sigma^2\cdot \left(1 + \frac 1n + \frac {(x^0-\bar x)^2}{S_{xx}}\right)$$

But it looks like a some different formula. I would like to use it to verify the results. I have found that $S_{xx}=\sum_i (x_i-\bar x)^2$, but I still do not understand what the $e^0$ and $x^0$ represents.

There are also multiple formulas on the internet for calculating residual variance, that are completely different and make me more confused. How do I compute residual variance from the given data?

Thank you for any help!

  • 1
    $\begingroup$ You are compelling your readers to guess what this all means. I would suppose you might be doing an Analysis of variance and that the $n_i$ are the group sizes, but it's not entirely clear. Please edit this question to explain the notation, describe the context, and stipulate the sources of these formulas. $\endgroup$
    – whuber
    May 11, 2015 at 19:42
  • 2
    $\begingroup$ You still have your $e_i$ undefined. I am afraid you are mixing up several statistical concepts and methods. The concept of a residual comes from regression analysis where at least the dependent variable is continuous; when you talk about frequency tables, that seems to imply the analysis of categorical data only. Please keep clarifying. $\endgroup$
    – StasK
    May 11, 2015 at 20:04
  • 1
    $\begingroup$ I can't clearly understand what's going on here but it looks like you're trying to apply regression to a contingency table. Please clarify what you're doing and why you're doing it this way. $\endgroup$
    – Glen_b
    May 12, 2015 at 2:50
  • $\begingroup$ It seems like this is a table of (originally continuous )data collapsed into intervals, and what is wanted is an estimation of the model based on the original variables before it was collapsed into intervals? Is that a true interpretation? $\endgroup$ May 12, 2015 at 16:48
  • 1
    $\begingroup$ @Glen_b I am not sure, the textbook is in Spanish. I was an exchange student. Most of the people did not pass the course. But it was how we were supposed to calculate it. $\endgroup$ Jul 1, 2015 at 12:51

1 Answer 1


So, I have found the answer. It is not this (first formula in the question): $$V_r=\frac{\sum_i n_ie_i^2}{\sum_i n_i} - \left(\frac{\sum_i n_ix_i}{\sum_i n_i}\right)^2$$

But this (somehow, the $e_i$ got replaced by $x_i$ in the presentation):

$$V_r=\frac{\sum_i n_ie_i^2}{\sum_i n_i} - \left(\frac{\sum_i n_ie_i}{\sum_i n_i}\right)^2$$

The second formula from the question is the same, but used when the frequency is not specified (no cross-table, just independent and dependent variable).

The solution wasn't that hard as the moderators in the comments were continuously stating!

  • $\begingroup$ The issue is not with the simplicity of the solution, but with your question; people weren't saying the problem was hard, they were pointing out ways in which parts of the question were unclear, ill defined and so on. Indeed your question remains problematic in a variety of senses. You should seek to improve your question and address as many of the issues raised in comments as you can. A clear, well framed question would not only have attracted upvotes, you'd likely have had several good answers in quick time. $\endgroup$
    – Glen_b
    Jun 23, 2015 at 2:44
  • $\begingroup$ @Glen_b You are right, I did overreact, but I was confused from all the formulas and frustrated from the endless question improving, without being just a bit closer to the answer. $\endgroup$ Jun 23, 2015 at 16:39

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.