Announcement

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

  • Residual Diagnostic Tests

    Hello!

    Probably a stupid question, but still relatively new to Stata. I have a wage regression and want to see if the residuals of the regression indicate the model is a good fit, and want to create certain plots but I am unsure how to do the plots listed below:

    - A plot of the residuals against the dependent variable of log wages to check they're uncorrelated
    - A plot of the residuals against an independent variable x to check for uncorrelation again
    - A plot to test for potential violation of normality of the residuals (QQ)

    So essentially, I am unsure on how to plot residuals.

    Thank you in advance!

  • #2
    Olivia:
    I would go as follows:
    Code:
    . sysuse auto.dta
    (1978 Automobile Data)
    
    . regress price mpg trunk
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(2, 71)        =     10.14
           Model |   141126459         2  70563229.4   Prob > F        =    0.0001
        Residual |   493938937        71  6956886.44   R-squared       =    0.2222
    -------------+----------------------------------   Adj R-squared   =    0.2003
           Total |   635065396        73  8699525.97   Root MSE        =    2637.6
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             mpg |  -220.1649   65.59262    -3.36   0.001    -350.9529    -89.3769
           trunk |   43.55851   88.71884     0.49   0.625    -133.3418    220.4589
           _cons |   10254.95   2349.084     4.37   0.000      5571.01    14938.89
    ------------------------------------------------------------------------------
    
    . estat hettest
    
    Breusch-Pagan / Cook-Weisberg test for heteroskedasticity
             Ho: Constant variance
             Variables: fitted values of price
    
             chi2(1)      =     7.96
             Prob > chi2  =   0.0048
    
    . predict residual, res
    
    . qnorm residual
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you Carlo! I see that's how you define residuals and then you can plot any residual graph, thank you!

      Comment


      • #4
        Olivia:
        see -help regress postestimation- and related entry in Stata .pdf manual for more details.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X