Announcement

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

  • intersection variable

    Code:
    reghdfe cases_normed i.days#bus_policy_open_risk cases_normed_delay_14days cases_normed_delay_14days_growth residential workplaces transit_stations parks grocery_and_pharmacy retail_and_recreation  if days<=368 & days>=331  , absorb( fips  )
    I am trying to build the previous regression where bus_policy_open_risk has two values (0,1) the results as follows:
    Code:
     reghdfe cases_normed i.days#bus_policy_open_risk  cases_normed_delay_14days cases_normed_delay_14days_growth residential workplaces tr
    > ansit_stations parks grocery_and_pharmacy retail_and_recreation  if days<=368 & days>=331   , absorb( fips  )
    (dropped 78 singleton observations)
    (MWFE estimator converged in 1 iterations)
    
    HDFE Linear regression                            Number of obs   =      2,988
    Absorbing 1 HDFE group                            F(  83,   2402) =       3.61
                                                      Prob > F        =     0.0000
                                                      R-squared       =     0.6040
                                                      Adj R-squared   =     0.5075
                                                      Within R-sq.    =     0.1108
                                                      Root MSE        =     0.4728
    
    --------------------------------------------------------------------------------------------------
                        cases_normed | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    ---------------------------------+----------------------------------------------------------------
           days#bus_policy_open_risk |
                              331 1  |   .2096405   .1333903     1.57   0.116    -.0519315    .4712124
                              332 0  |   .0290436   .1178141     0.25   0.805    -.2019843    .2600714
                              332 1  |   .1167609    .136788     0.85   0.393    -.1514738    .3849956
                              333 0  |   .0202103   .1238841     0.16   0.870    -.2227206    .2631411
                              333 1  |   .0876057   .1318282     0.66   0.506    -.1709031    .3461145
                              334 0  |  -.0836872   .1223314    -0.68   0.494    -.3235732    .1561988
                              334 1  |   .3293634   .1349964     2.44   0.015      .064642    .5940849
                              335 0  |  -.0519824   .1225741    -0.42   0.672    -.2923444    .1883795
                              335 1  |   .0569438   .1304069     0.44   0.662     -.198778    .3126656
                              336 0  |  -.0497269   .1156959    -0.43   0.667    -.2766011    .1771473
                              336 1  |   .3096333   .1357965     2.28   0.023     .0433429    .5759236
                              337 0  |  -.0742253   .1197005    -0.62   0.535    -.3089522    .1605016
                              337 1  |   .0582338   .1327688     0.44   0.661    -.2021195    .3185871
                              338 0  |  -.0234937   .1142326    -0.21   0.837    -.2474985     .200511
                              338 1  |   .1724191   .1303567     1.32   0.186    -.0832041    .4280424
                              339 0  |  -.0593665   .1191785    -0.50   0.618    -.2930699    .1743368
                              339 1  |   .1652005   .1308348     1.26   0.207    -.0913603    .4217612
                              340 0  |  -.1055072   .1156711    -0.91   0.362    -.3323326    .1213183
                              340 1  |   .1114776    .133643     0.83   0.404    -.1505899    .3735451
                              341 0  |  -.1084851   .1178873    -0.92   0.358    -.3396563    .1226862
                              341 1  |   .0508871   .1362215     0.37   0.709    -.2162367    .3180108
                              342 0  |  -.0646933   .1205707    -0.54   0.592    -.3011266      .17174
                              342 1  |   .1925672   .1317682     1.46   0.144     -.065824    .4509584
                              343 0  |  -.0475884   .1174408    -0.41   0.685    -.2778842    .1827073
                              343 1  |   .1629395   .1286369     1.27   0.205    -.0893112    .4151902
                              344 0  |  -.0611853   .1277101    -0.48   0.632    -.3116188    .1892482
                              344 1  |   .1395029    .137892     1.01   0.312    -.1308967    .4099024
                              345 0  |  -.0902414   .1253265    -0.72   0.472    -.3360007    .1555178
                              345 1  |   .2101073   .1293424     1.62   0.104     -.043527    .4637415
                              346 0  |   .0101026   .1336115     0.08   0.940    -.2519032    .2721085
                              346 1  |   .1752553   .1273663     1.38   0.169    -.0745039    .4250144
                              347 0  |  -.0532696   .1222337    -0.44   0.663    -.2929639    .1864247
                              347 1  |   .1535804   .1298833     1.18   0.237    -.1011146    .4082755
                              348 0  |  -.0573576   .1159042    -0.49   0.621    -.2846401    .1699249
                              348 1  |   .2491161   .1292221     1.93   0.054    -.0042823    .5025146
                              349 0  |  -.0163862   .1191614    -0.14   0.891    -.2500559    .2172835
                              349 1  |   .1651863   .1297673     1.27   0.203    -.0892812    .4196537
                              350 0  |  -.1191376   .1331604    -0.89   0.371    -.3802588    .1419836
                              350 1  |   .1687508    .130931     1.29   0.198    -.0879987    .4255003
                              351 0  |  -.0480022   .1182763    -0.41   0.685    -.2799363    .1839319
                              351 1  |   .1326414   .1288148     1.03   0.303    -.1199583     .385241
                              352 0  |   .0030494   .1195856     0.03   0.980    -.2314522    .2375509
                              352 1  |   .2942891   .1336999     2.20   0.028     .0321101    .5564682
                              353 0  |   .0189665   .1278907     0.15   0.882    -.2318211    .2697541
                              353 1  |   .1465909   .1319872     1.11   0.267    -.1122296    .4054114
                              354 0  |   -.110522   .1299275    -0.85   0.395    -.3653036    .1442596
                              354 1  |   .1523915   .1312036     1.16   0.246    -.1048925    .4096754
                              355 0  |  -.0756447   .1262508    -0.60   0.549    -.3232166    .1719271
                              355 1  |    .060433   .1279538     0.47   0.637    -.1904783    .3113443
                              356 0  |  -.0957646   .1245305    -0.77   0.442    -.3399629    .1484336
                              356 1  |   .0408801    .133175     0.31   0.759    -.2202697    .3020299
                              357 0  |    .138325   .1254909     1.10   0.270    -.1077567    .3844067
                              357 1  |  -.0411404   .1399316    -0.29   0.769    -.3155396    .2332589
                              358 0  |  -.1219758    .139442    -0.87   0.382    -.3954148    .1514633
                              358 1  |    .109354   .1297075     0.84   0.399    -.1449962    .3637043
                              359 0  |   .0039393   .1240928     0.03   0.975    -.2394007    .2472793
                              359 1  |   .2560763    .135518     1.89   0.059     -.009668    .5218206
                              360 0  |  -.0592402   .1347542    -0.44   0.660    -.3234868    .2050064
                              360 1  |   .5000361   .1370191     3.65   0.000     .2313483     .768724
                              361 0  |  -.1226208   .1245707    -0.98   0.325     -.366898    .1216565
                              361 1  |     .15382   .1383023     1.11   0.266    -.1173843    .4250243
                              362 0  |  -.2125093   .1265772    -1.68   0.093    -.4607211    .0357025
                              362 1  |   .0132899   .1403392     0.09   0.925    -.2619086    .2884884
                              363 0  |  -.2454007   .1270654    -1.93   0.054      -.49457    .0037685
                              363 1  |  -.1819625   .1400782    -1.30   0.194    -.4566491    .0927242
                              364 0  |   .1367787    .130235     1.05   0.294    -.1186059    .3921632
                              364 1  |  -.0606629   .1295566    -0.47   0.640    -.3147172    .1933914
                              365 0  |  -.1406556   .1307284    -1.08   0.282    -.3970078    .1156966
                              365 1  |   .0483386   .1360251     0.36   0.722       -.2184    .3150773
                              366 0  |   .0631108   .1278295     0.49   0.622    -.1875567    .3137783
                              366 1  |  -.0712824    .132783    -0.54   0.591    -.3316635    .1890987
                              367 0  |   .0174997   .1255504     0.14   0.889    -.2286986    .2636979
                              367 1  |  -.0645931    .140157    -0.46   0.645    -.3394342     .210248
                              368 0  |  -.1548754   .1278592    -1.21   0.226    -.4056013    .0958504
                              368 1  |     .01671   .1327696     0.13   0.900    -.2436448    .2770649
                                     |
           cases_normed_delay_14days |   .2925883    .022953    12.75   0.000     .2475785    .3375981
    cases_normed_delay_14days_growth |   .0009109   .0002954     3.08   0.002     .0003316    .0014902
                         residential |  -.0551442   .6125502    -0.09   0.928    -1.256326    1.146037
                          workplaces |  -.1953761   .2616483    -0.75   0.455    -.7084558    .3177037
                    transit_stations |   .1590853   .0618105     2.57   0.010     .0378778    .2802927
                               parks |  -.0212484   .0286065    -0.74   0.458    -.0773444    .0348475
                grocery_and_pharmacy |  -.0191809   .1138943    -0.17   0.866    -.2425221    .2041602
               retail_and_recreation |  -.2590651   .1554198    -1.67   0.096    -.5638359    .0457056
                               _cons |    .182201   .8551501     0.21   0.831    -1.494707    1.859109
    --------------------------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    -----------------------------------------------------+
     Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -------------+---------------------------------------|
            fips |       503           0         503     |
    -----------------------------------------------------+


    if I try to build same regression but without intersection term and by add condition to the end of regression one when bus_policy_open_risk==0 and other when bus_policy_open_risk==1 as follows:
    Code:
    reghdfe cases_normed i.days    cases_normed_delay_14days cases_normed_delay_14days_growth residential workplaces transit_stations parks grocery_and_pharmacy retail_and_recreation  if days<=368 & days>=331   &bus_policy_open_risk==0 , absorb( fips  )
    
    
    reghdfe cases_normed i.days    cases_normed_delay_14days cases_normed_delay_14days_growth residential workplaces transit_stations parks grocery_and_pharmacy retail_and_recreation  if days<=368 & days>=331   &bus_policy_open_risk==1 , absorb( fips  )
    after comparing results with intersection variable when it is =1 or 0 it is different. I am wondering which regression is more accurate use intersection variable or adding condition to the regression?

  • #2
    First a clarification of terminology. What you have called an intersection term, is actually an interaction term. (It is nothing more than than the multiplied value between two or more variables.)

    If I understand you correctly, you are comparing one model which includes a 2-way interaction between -bus_policy_open_risk- and -days-. You expect that running the reduced regression model (that is, without this interaction) on the separate subsets of -bus_policy_open_risk- will provide you with equivalent results. Sometimes people do this as a way of performing a stratified analysis, however these two approaches will only be equivalent when the model contains only the terms involved in the interaction and nothing else. In the case of having additional covariates, as in your example, there is no reason to expect them to the the same or even similar. A truly stratified (or subgroup) analysis using a single, "big" model would need to have an interaction with -bus_policy_open_risk- and every covariate in the model.

    Comment


    • #3
      Thank you. Yes it is typo. should be interaction. I mean running model with interaction term between bus_policy_open_risk- and -days should be the same as running two regression: first when bus_policy_open_risk=0 and other when bus_policy_open_risk=1 is it true?

      Comment


      • #4
        Amera, thank you, I did understand your question correctly, and my answer to you in #2 applies. Short answer, no, they will not generally be the same.
        Last edited by Leonardo Guizzetti; 22 Nov 2021, 20:10.

        Comment


        • #5
          So, which one is more accurate to study the effect of bus_policy_open_risk and days on the dependent variable?

          Comment


          • #6
            It's impossible for me to stay since I don't know your research area. Generally speaking, conducting separate regressions will give you the most flexibility in what you are modeling, but the interaction model may provide substantively similar results for your particular research question. Flexibility in modeling ability alone does not automatically mean more accurate, and indeed could result in worse results because at some point, the model becomes overfit and all you are doing is modeling noise.

            Speaking of which, looking at your model it's not clear to me why you are modeling -days- as a categorical variable. Have you considered modeling -days- as a linear variable (-c.days-) or perhaps a as a polynomial? That could give you a better idea of the time trends in each subgroup and greatly simplify your model.

            Comment


            • #7
              Thank you. days in my model are categorical. i am studying event based model for -7 to 30 days of ordering mask event. and bus_policy_open_risk is 0 or 1 means that the business_closed policy is implemented or not during days (-7 to 30)

              Comment

              Working...
              X