Announcement

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

  • combined standard error for interaction terms following regress

    I'm running a regression on a dataset with 60m observations. My variables include gender, age group and household type, which I include as interactions.

    Code:
    reg y i.gender#i.age#i.hholdtype deprivation otherstuff, base
    When presenting my results I want to show the impact of age for each gender after controlling / standardising for household type. To do this I'm multiplying the coefficient for each age by the all age share of each household type. However, where I'm struggling is how to combine the standard errors from the regression to be able to show confidence intervals. The standard errors should be smaller than the average of the standard errors from the regression because I'm collapsing over household type. I've tried using --margins-- but even after 4 hours of processing it still hadn't finished.

    Any help or pointers would be gratefully received.

  • #2
    Rob:
    1) why your code does not include the man conditional terms of the predictors included in -regress-?:
    Code:
     reg y i.gender##i.age##i.hholdtype deprivation otherstuff, base
    2) have you already considered -lincom-?:
    Code:
    . use "C:\Program Files\Stata17\ado\base\a\auto.dta"
    (1978 automobile data)
    
    . sysuse auto.dta
    (1978 automobile data)
    
    . regress price mpg i.rep78
    
          Source |       SS           df       MS      Number of obs   =        69
    -------------+----------------------------------   F(5, 63)        =      4.39
           Model |   149020603         5  29804120.7   Prob > F        =    0.0017
        Residual |   427776355        63  6790100.88   R-squared       =    0.2584
    -------------+----------------------------------   Adj R-squared   =    0.1995
           Total |   576796959        68  8482308.22   Root MSE        =    2605.8
    
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             mpg |  -280.2615   61.57666    -4.55   0.000    -403.3126   -157.2103
                 |
           rep78 |
              2  |   877.6347   2063.285     0.43   0.672     -3245.51     5000.78
              3  |   1425.657   1905.438     0.75   0.457    -2382.057    5233.371
              4  |   1693.841   1942.669     0.87   0.387    -2188.274    5575.956
              5  |   3131.982   2041.049     1.53   0.130    -946.7282    7210.693
                 |
           _cons |   10449.99   2251.041     4.64   0.000     5951.646    14948.34
    ------------------------------------------------------------------------------
    
    . lincom (22*mpg + 500*mpg) - (50*mpg + 670*mpg)
    
     ( 1)  - 198*mpg = 0
    
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             (1) |   55491.77   12192.18     4.55   0.000     31127.65     79855.9
    ------------------------------------------------------------------------------
    
    .
    In the previous toy-example, -lincom- tests the difference of two linear combinations of the -mpg- predictor.
    Last edited by Carlo Lazzaro; 23 Jan 2023, 01:56.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Carlo

      Thanks.
      1. There is no particular reason other than making the output more compact.
      2. I'll try lincom - thanks.

      Rob
      Last edited by Rob Shaw; 23 Jan 2023, 02:00.

      Comment


      • #4
        Rob:
        1) your choice;
        2) sorry for the terrible layout (now fixed).
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X