Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Finding the estimated variance of residuals

    Hello,

    I am fairly new to Stata and I have a question which I hope can be answered via this forum.

    I ran a simple OLS regression in the form
    Code:
    reg y1 x1 x2, robust
    in which I added time dummies as independent variables for the years 2009-2019. Now I want to obtain 'the estimated variances of residuals' (sigma_hat^2) for each of the years. I think this means that I should run separate regressions for each of the years, excluding the others. However, I don't know how or where I can find the estimated variance of residuals of the different years?

    Do I have to look at the Root MSE?

    I hope someone can help me with this.

    Kind regards,

    Bas van den Boomen
    Last edited by Bas Boomen; 01 Aug 2019, 05:01.

  • #2
    Bas:
    welcome to this forum.
    Stata returns the standard error of the residuals (that you can square to obtain the variance).
    Code:
    . use "C:\Program Files (x86)\Stata15\ado\base\a\auto.dta"
    (1978 Automobile Data)
    
    . reg price mpg i.foreign
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(2, 71)        =     14.07
           Model |   180261702         2  90130850.8   Prob > F        =    0.0000
        Residual |   454803695        71  6405685.84   R-squared       =    0.2838
    -------------+----------------------------------   Adj R-squared   =    0.2637
           Total |   635065396        73  8699525.97   Root MSE        =    2530.9
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             mpg |  -294.1955   55.69172    -5.28   0.000    -405.2417   -183.1494
                 |
         foreign |
        Foreign  |   1767.292    700.158     2.52   0.014     371.2169    3163.368
           _cons |   11905.42   1158.634    10.28   0.000     9595.164    14215.67
    ------------------------------------------------------------------------------
    
    . predict residual, residuals
    
    . predict se_residual, stdr
    
    . list residual se_residual in 1/10
    
         +----------------------+
         |  residual   se_res~l |
         |----------------------|
      1. | -1334.114   2503.568 |
      2. | -2155.091   2501.542 |
      3. | -1634.114   2503.568 |
      4. | -1205.505   2506.473 |
      5. |  334.5177   2492.034 |
         |----------------------|
      6. | -821.8957   2504.426 |
      7. |  196.6686   2482.802 |
      8. | -832.5046   2506.473 |
      9. |  3173.713   2497.414 |
     10. |   -2233.7   2506.068 |
         +----------------------+
    
    .
    If you add -i.year- among predcitors, you will have residuals related to all the regressors, including -i.year-, as they act adjusted for each other in your regressin model: hence, I'm not that clear with your second question..
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hello Carlo,

      Thank you for your clarifying answer. This works for me.

      Kind regards,

      Bas

      Comment

      Working...
      X