Announcement

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

  • how to test if one variable accounts for more variance in a regression

    Hi all,

    I am running two simple regression models with a DV (x) and IV (y&z).

    So it looks like:
    reg x y
    reg x z

    How can I compare if the variable y and z explains more of the variance? They both significant predict the IV. And one has a larger t-value. But how do I test if the t-values in the regressions are significantly different from each other?

    Would an lrtest work? But I just want to test the variables, not the models, I think. Or would I put all 3 variables in one model?

    Thank you!

  • #2
    Rachel:
    this seems to be a job for -suest-:
    Code:
    . use "C:\Program Files\Stata17\ado\base\a\auto.dta"
    (1978 automobile data)
    
    . regress price mpg
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =     20.26
           Model |   139449474         1   139449474   Prob > F        =    0.0000
        Residual |   495615923        72  6883554.48   R-squared       =    0.2196
    -------------+----------------------------------   Adj R-squared   =    0.2087
           Total |   635065396        73  8699525.97   Root MSE        =    2623.7
    
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             mpg |  -238.8943   53.07669    -4.50   0.000    -344.7008   -133.0879
           _cons |   11253.06   1170.813     9.61   0.000     8919.088    13587.03
    ------------------------------------------------------------------------------
    
    
    . estimates store A
    
    . regress price trunk
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =      7.89
           Model |  62747229.9         1  62747229.9   Prob > F        =    0.0064
        Residual |   572318166        72  7948863.42   R-squared       =    0.0988
    -------------+----------------------------------   Adj R-squared   =    0.0863
           Total |   635065396        73  8699525.97   Root MSE        =    2819.4
    
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           trunk |   216.7482   77.14554     2.81   0.006     62.96142     370.535
           _cons |   3183.504   1110.728     2.87   0.005     969.3088    5397.699
    ------------------------------------------------------------------------------
    
    . estimates store B
    
    . suest A B
    
    Simultaneous results for A, B                               Number of obs = 74
    
    ------------------------------------------------------------------------------
                 |               Robust
                 | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
    A_mean       |
             mpg |  -238.8943   57.08197    -4.19   0.000     -350.773   -127.0157
           _cons |   11253.06   1366.933     8.23   0.000     8573.922     13932.2
    -------------+----------------------------------------------------------------
    A_lnvar      |
           _cons |   15.74465   .2176038    72.35   0.000     15.31815    16.17114
    -------------+----------------------------------------------------------------
    B_mean       |
           trunk |   216.7482   57.53296     3.77   0.000     103.9857    329.5108
           _cons |   3183.504   723.6459     4.40   0.000     1765.184    4601.824
    -------------+----------------------------------------------------------------
    B_lnvar      |
           _cons |   15.88854   .2315864    68.61   0.000     15.43464    16.34244
    ------------------------------------------------------------------------------
    
    . test [A_mean]mpg=[B_mean]trunk
    
     ( 1)  [A_mean]mpg - [B_mean]trunk = 0
    
               chi2(  1) =   20.60
             Prob > chi2 =    0.0000
    
    .
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Rachel:
      this seems to be a job for -suest-:
      Code:
      . use "C:\Program Files\Stata17\ado\base\a\auto.dta"
      (1978 automobile data)
      
      . regress price mpg
      
      Source | SS df MS Number of obs = 74
      -------------+---------------------------------- F(1, 72) = 20.26
      Model | 139449474 1 139449474 Prob > F = 0.0000
      Residual | 495615923 72 6883554.48 R-squared = 0.2196
      -------------+---------------------------------- Adj R-squared = 0.2087
      Total | 635065396 73 8699525.97 Root MSE = 2623.7
      
      ------------------------------------------------------------------------------
      price | Coefficient Std. err. t P>|t| [95% conf. interval]
      -------------+----------------------------------------------------------------
      mpg | -238.8943 53.07669 -4.50 0.000 -344.7008 -133.0879
      _cons | 11253.06 1170.813 9.61 0.000 8919.088 13587.03
      ------------------------------------------------------------------------------
      
      
      . estimates store A
      
      . regress price trunk
      
      Source | SS df MS Number of obs = 74
      -------------+---------------------------------- F(1, 72) = 7.89
      Model | 62747229.9 1 62747229.9 Prob > F = 0.0064
      Residual | 572318166 72 7948863.42 R-squared = 0.0988
      -------------+---------------------------------- Adj R-squared = 0.0863
      Total | 635065396 73 8699525.97 Root MSE = 2819.4
      
      ------------------------------------------------------------------------------
      price | Coefficient Std. err. t P>|t| [95% conf. interval]
      -------------+----------------------------------------------------------------
      trunk | 216.7482 77.14554 2.81 0.006 62.96142 370.535
      _cons | 3183.504 1110.728 2.87 0.005 969.3088 5397.699
      ------------------------------------------------------------------------------
      
      . estimates store B
      
      . suest A B
      
      Simultaneous results for A, B Number of obs = 74
      
      ------------------------------------------------------------------------------
      | Robust
      | Coefficient std. err. z P>|z| [95% conf. interval]
      -------------+----------------------------------------------------------------
      A_mean |
      mpg | -238.8943 57.08197 -4.19 0.000 -350.773 -127.0157
      _cons | 11253.06 1366.933 8.23 0.000 8573.922 13932.2
      -------------+----------------------------------------------------------------
      A_lnvar |
      _cons | 15.74465 .2176038 72.35 0.000 15.31815 16.17114
      -------------+----------------------------------------------------------------
      B_mean |
      trunk | 216.7482 57.53296 3.77 0.000 103.9857 329.5108
      _cons | 3183.504 723.6459 4.40 0.000 1765.184 4601.824
      -------------+----------------------------------------------------------------
      B_lnvar |
      _cons | 15.88854 .2315864 68.61 0.000 15.43464 16.34244
      ------------------------------------------------------------------------------
      
      . test [A_mean]mpg=[B_mean]trunk
      
      ( 1) [A_mean]mpg - [B_mean]trunk = 0
      
      chi2( 1) = 20.60
      Prob > chi2 = 0.0000
      
      .
      Hi Carlo thank you so much for sharing this!

      I read more about the suest command and it seems super helpful. Do you have any recommended reading on the test? I just want to make sure I understand the interpretation. Is this output saying that the trunk variable explains a significantly higher amount of the model variance compared to mpg?

      Thank you!

      Comment


      • #4
        . test[m1_mean]X1=[m2_mean]X2

        ( 1) [m1_mean]X1 - [m2_mean]X2 = 0

        chi2( 1) = 49.94
        Prob > chi2 = 0.0000

        This was my output!

        So does this mean X1 is significantly higher than X2?

        Also, do I need to use the lincom instead of test since my X1 and X2 are not measured the same way?

        Thank you!

        Comment


        • #5
          Rachel:
          1)yes;
          2) -lincom- cannot change/fix the way your variable were measured.
          Kind regards,
          Carlo
          (StataNow 18.5)

          Comment


          • #6
            Looks like a job for dominance analysis.

            https://psycnet.apa.org/doiLanding?d...2-989X.8.2.129

            Code:
            ssc install domin, replace
            help domin
            Best wishes

            (Stata 16.1 MP)

            Comment


            • #7
              Originally posted by Felix Bittmann View Post
              Looks like a job for dominance analysis.

              https://psycnet.apa.org/doiLanding?d...2-989X.8.2.129

              Code:
              ssc install domin, replace
              help domin
              This looks great!

              Is it really as easy as just doing:

              domin x1 y1 y2

              and then when the output says x1 dominates x2, that is the variable that explains more variance? I got the same results with the suest method above

              Comment


              • #8
                Yes, its quite simple but you should read the extensive documentation of the command and the paper I linked you so you see what these measures of "dominance" actually mean. I usually rely on the R2 statistics as these measures of dominance over other variables becomes complex when many variables are involved.
                Best wishes

                (Stata 16.1 MP)

                Comment

                Working...
                X