Announcement

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

  • Chow test using xtivreg, re model with interacted IV

    Dear statalists,
    I want to perform a chow test to consider whether to split my data into male and female observations. I know how to do this in a "reg" setting using the F statistics formula or also with including all interaction terms and using "test". However, now using xtivreg, re I reached my limits. Let me show you what I have done so far:

    General Information:
    Variables:
    haz: height for age z-score
    smdummy: Supermarket shopping 1 yes 0 no
    casex: gender of children; 1 female 0 male
    All the others are control variables
    Instrument: distance to nearest supermarket as IV for Supermarket shopping
    Model:
    Code:
     xtivreg haz (smdummy = log_distance) casex page pagesq fe_height fe_age fe_edu hhsex exphhadeq_thou_inf mal_respir alwaystreatwa logd_hhhosp yeardummy par_act, re vce(cluster town)
    Now I want to do a chow test to see if it makes sense to split the data into caesx ==1 (female) and casex ==0 (male)
    I tried to do this by including all interaction terms with the following commands:

    Code:
    gen ipage = page*casex
    gen ipagesq = pagesq*casex
    gen ife_height = fe_height*casex
    gen ife_age = fe_age*casex
    gen ife_edu = fe_edu*casex
    gen ihhsex = hhsex*casex
    gen iexphhadeq_thou_inf = exphhadeq_thou_inf*casex
    gen imal_respir = mal_respir*casex
    gen ialwaystreatwa = alwaystreatwa*casex
    gen ilogd_hhhosp = logd_hhhosp*casex
    gen iyeardummy = yeardummy*casex
    gen ipar_act = par_act*casex
    gen ismdummy = smdummy*casex
    gen ilog_distance = log_distance*casex
    
    global interaction ipage ipagesq ife_height ife_age ife_edu ihhsex iexphhadeq_thou_inf imal_respir ialwaystreatwa ilogd_hhhosp iyeardummy ipar_act
    
    xtivreg haz (smdummy ismdummy = log_distance ilog_distance) casex page pagesq fe_height fe_age fe_edu hhsex exphhadeq_thou_inf mal_respir alwaystreatwa logd_hhhosp yeardummy par_act $interaction, re vce(cluster town)
    
    test casex $interaction
    The test however, gives me the following results:

    Code:
    . test casex $interaction
    
     ( 1)  casex = 0
     ( 2)  ipage = 0
     ( 3)  ipagesq = 0
     ( 4)  ife_height = 0
     ( 5)  ife_age = 0
     ( 6)  ife_edu = 0
     ( 7)  ihhsex = 0
     ( 8)  iexphhadeq_thou_inf = 0
     ( 9)  imal_respir = 0
     (10)  ialwaystreatwa = 0
     (11)  ilogd_hhhosp = 0
     (12)  iyeardummy = 0
     (13)  ipar_act = 0
           Constraint 2 dropped
           Constraint 3 dropped
           Constraint 4 dropped
           Constraint 5 dropped
           Constraint 6 dropped
           Constraint 7 dropped
           Constraint 8 dropped
           Constraint 9 dropped
           Constraint 10 dropped
           Constraint 11 dropped
           Constraint 13 dropped
    
               chi2(  2) =    1.99
             Prob > chi2 =    0.3695
    See below for data example and preparatory steps:

    Code:
    global id hhid
    sort $id
    xtset $id
    gen log_distance = log(distance)
    Preparation

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float town long hhid float(smdummy log_distance casex page pagesq fe_height fe_age fe_edu) byte hhsex float exphhadeq_thou_inf double mal_respir float(alwaystreatwa logd_hhhosp yeardummy par_act)
    1 101015 0  -.2759892 1  8  64 153.8 29  2 1   3.48827 0 0   -.6768774 0  6.120652
    1 101060 1  -.2745178 1  5  25 167.2 25 11 0  9.459771 0 0   -.7041644 0 4.4381065
    1 101092 1  -.3012685 0  3   9   155 29  8 1 1.4842116 0 1   -.7187036 1     3.896
    1 101120 0 -.12707411 0 14 196   154 53  0 1  4.123272 0 0   -.4751264 0 3.7664325
    1 101133 1 -.09644198 0 12 144 160.5 35  7 1  4.248362 0 1   -.3982806 1      3.65
    1 101150 0 -.10780872 0  8  64 157.9 25  0 0 3.3035066 0 1   -.3764812 0  4.659444
    1 101152 1 -.07267016 0  8  64   155 30  8 0 8.5949545 0 1   -.4151053 1  5.980937
    1 101160 1 -.10102946 0  9  81 163.4 21 23 0 10.716895 0 0   -.4562035 1     3.124
    1 101165 1 -.10608626 0 11 121 152.8 33 13 1  6.305768 0 1   -.3589305 0  3.772441
    1 101187 1  -.3012685 1  3   9 158.7 32  8 1  4.382894 0 1   -.7187036 1      3.34
    1 101187 1  -.3012685 1  6  36 158.7 32  8 1  4.382894 0 1   -.7187036 1  4.089779
    1 101232 0 -.10386962 1  8  64 156.5 38 13 0  4.841167 0 0   -.4232088 1 2.9770336
    1 101233 0 -.26564938 1  8  64   168 28  1 1  6.045906 0 0   -.6792672 1  2.988636
    1 101233 0 -.26564938 0  2   4   168 28  1 1  6.045906 0 0   -.6792672 1  3.684676
    1 102042 1  -.1947158 1  3   9 153.5 58 18 1  38.71392 0 1  -.14101137 1 2.3455555
    1 102072 1  -.3759676 0  5  25 150.5 25  8 1  5.368425 0 1   -.3675688 0  5.826667
    1 102224 1 -.50440526 0  7  49   172 26 13 0 4.5385613 0 0  -.28798133 0  4.532575
    1 102224 1  -.1590696 0 10 100   169 31 12 0 3.2002316 0 0   -.1889755 1 4.6835556
    1 102235 0  -.4082444 1 10 100 162.4 27  3 0 10.268873 0 1   -.4321473 1 2.4596155
    1 102238 1  -.1675446 1  9  81 154.5 49 13 0 17.689611 0 0  -.17448825 1 3.3602154
    1 102242 1  -.3439426 1  2   4 155.7 26 17 0 3.6758075 0 1   -.3360094 1  5.358333
    1 102248 1  -.1947158 1 10 100 163.6 35  8 0  6.640871 0 1  -.14101137 1  2.428066
    1 102248 1  -.1947158 1  3   9 163.6 35  8 0  6.640871 0 1  -.14101137 1 3.0504255
    1 102251 1 -.07594346 1 11 121 156.5 32 11 0   8.84528 0 0  -.11202684 1  4.399379
    1 102253 1 -.11177652 0  2   4 168.4 35 11 0  5.884458 0 1   -.1776362 1  4.791765
    1 102255 0 -.04167989 1  5  25 135.8 36  8 0  4.302381 0 0  -.08164472 1 4.7333474
    1 102259 0 .065311424 0 11 121 165.4 30  8 0  7.545856 0 0    .2608818 1 2.0195844
    1 102262 1  -.1044739 0  3   9   154 24 13 1  6.432965 1 1  -.15847446 1 4.0380955
    1 103005 1  -.0934255 1  5  25 149.2 24  9 0  4.007631 0 1  .073954254 0 1.6120614
    1 103005 1 -.07144998 1  7  49 150.5 26  8 0  5.210956 0 0   .09139802 1  4.961429
    1 103020 1     .49469 1  7  49   159 40 12 0  6.802856 0 1    .6094911 1  3.754831
    1 103079 1 .067443766 1  9  81 159.7 35 13 0  12.55146 1 0    .2346505 0 2.0315778
    1 103079 1 -3.5213604 0  3   9   162 38 13 0  12.55146 0 1   -1.203663 1  4.888424
    1 103079 1 -3.5213604 1 12 144   162 38 13 0  9.477755 1 1   -1.203663 1  5.781053
    1 103270 1  -.0235086 0 10 100 159.4 35  8 0  11.03689 0 1   .15711935 1  3.289328
    1 103270 1  -.0235086 1  4  16 159.4 35  8 0  11.03689 0 1   .15711935 1  3.578182
    1 103273 1   .0784503 0  3   9 154.7 21  8 0 4.5332603 0 1    .2447033 1  4.290196
    1 103273 1   .0784503 0  6  36 154.7 21  8 0 4.5332603 0 1    .2447033 1  3.263489
    1 103286 1 -.07550966 0  4  16   152 20  8 1  8.653082 0 1   .12942402 1 2.7233906
    1 104011 1  -.8513553 0  6  36 151.7 31 11 0 11.435349 0 1  -1.0518322 1  5.302995
    1 104014 1  -.8184634 1  8  64 150.5 29  8 0  4.354312 0 1  -1.4755445 0 3.1487205
    1 104014 0   .3532219 1 12 144 151.6 32  8 0  3.257185 0 1    .4825776 1   4.45218
    1 104023 1  -.7516773 0  4  16 162.9 29 18 1  7.758446 0 1  -1.0365263 1 4.5732203
    1 104038 1  -.5328552 0  5  25 161.5 25 13 0  8.405521 0 1    -.855533 1  2.588271
    1 104045 1 -.57377774 0  4  16 156.3 26 13 0 10.927027 0 1  -1.0542958 1 3.7700605
    1 104051 1  -.6232637 0 12 144 171.1 35 15 0  7.284609 0 0   -.9509041 1  5.476156
    1 104053 1  -.6174152 1  5  25 158.3 27  8 1  6.902289 0 0    -.870684 1 4.6718817
    1 104061 1  -.5964566 0 14 196   163 45  8 1  5.143697 0 1   -.8683907 1 1.6202967
    1 104073 0   -.507745 1 11 121 150.1 50 10 0  6.204353 0 1   -.8239071 1 3.8096235
    1 104089 1  -.7320044 0  5  25 156.1 46  8 1 13.898783 0 0  -1.2372576 1 3.8905554
    1 104099 1  -.9950921 1  3   9 162.5 27 16 0  8.948689 0 1  -1.4146683 1      3.65
    1 104099 1  -.9950921 0  6  36 162.5 27 16 0  8.948689 0 1  -1.4146683 1   3.13428
    1 104105 1  -.9066513 1  5  25 162.5 20 11 0 12.249145 0 0  -1.4111787 0  6.185783
    1 104113 1 -1.0275059 1 18 324   154 40 13 0 13.096262 0 1  -1.5274245 0  2.687519
    1 104119 1  -.9904838 1  3   9   171 29  8 0  5.618302 0 1  -1.3358274 1     3.745
    1 104119 1  -.9904838 0 10 100   171 29  8 0  5.618302 0 1  -1.3358274 1 2.9209886
    1 104119 1  -.9808413 0  8  64   171 26  8 0  6.281139 0 0    -1.35034 0 4.0488935
    1 104124 1  -.7261969 0  3   9 166.2 25 13 0 14.528405 1 1  -1.1005704 1 4.4214315
    1 104134 1   -.518187 0  9  81 165.3 29  8 0  8.329432 1 0   -.6988966 1 2.8927915
    1 104134 1   .5810298 0  6  36 164.1 27  8 0  6.564938 1 1    .6728283 0  5.222489
    1 104149 0  -.8028625 1 10 100 166.2 33 18 1  9.940226 0 0  -1.2264674 0  3.324898
    1 104195 1 -.12819771 1 11 121 151.1 31  8 0   4.32167 0 0   -.4168614 1 3.0022414
    1 104195 1  -.5648473 1 10 100 155.5 29  9 0  8.871733 0 1   -.9310053 0  4.606504
    1 104211 1  -.9809739 1  7  49 162.8 33 10 1  15.67621 0 1  -1.2187607 0  1.661107
    1 104211 1  -.4633047 1  2   4   164 36  8 1  15.67621 0 1  -1.0656716 1  4.879838
    1 104211 1  -.4633047 1 10 100   164 36  8 1 13.117378 0 1  -1.0656716 1 3.3189585
    1 104217 0 -.54254854 0 12 144 160.9 32  8 0   9.36393 0 1    -.723403 1 3.3198004
    1 104240 1 -.52694577 1 11 121   156 32 13 0  9.980625 0 1   -.7833086 1  2.571899
    1 104284 1  -.7692413 0 14 196 164.1 51 13 0  5.322569 0 1  -1.1129457 0  3.124765
    1 104299 1  -.6906428 0  6  36 164.3 31 17 0  7.854314 0 1    -.993553 0  6.893657
    1 104345 1  -.6025292 0  5  25 162.9 23 11 1 12.684011 0 1   -.8806682 0  5.742651
    1 104345 0 -2.0487454 0  7  49 166.8 24 10 1  9.564786 0 1   -.9546191 1  2.672951
    1 104359 0  -.6762633 0 10 100 161.5 31  8 1  4.512309 0 0   -.9399909 0  5.229585
    1 104362 1  -.7018924 1 13 169 153.5 30 11 0  5.970167 0 1   -.9566259 0  2.506875
    1 104389 1   -.652982 0  7  49 154.6 26 13 0  5.956482 0 0   -.8410805 0  4.925277
    1 104424 1  -.4739029 1  5  25 158.1 32 13 0  10.63225 0 1    -.698294 0  5.371875
    1 104435 1   -.536782 1  8  64 150.5 42 14 0 11.796685 1 0   -.7142504 0  5.823333
    1 105020 1  -.8322588 1  6  36 158.6 29 12 1 20.471844 0 1    -.440774 0  3.952284
    1 105035 1  -.7415005 1 17 289 154.1 41 18 1  25.47631 0 1   -.3683096 0  2.723719
    1 105080 1  -.4083213 1  9  81   142 42 16 1 12.383317 0 1  -.11582004 0  3.274024
    1 105110 1  -.8173686 1  8  64 158.2 32 13 0  19.55381 0 1   -.3822133 1   3.87907
    1 105141 1  -.3021265 1  7  49 155.5 20 22 0 15.195867 0 1 -.013006023 0 4.7095265
    1 105170 1  -.5704307 1  3   9 160.6 24 13 0  28.85682 0 0   -.2234922 1  2.519625
    1 105182 1  -.6111993 0  6  36 152.5 25 19 0 10.211945 0 1  -.24719736 0  5.729524
    1 105184 1  -.6760815 1 10 100 155.5 35 23 0   17.2916 0 1  -.21786927 1 4.7361307
    1 105187 1  -.8252611 0  3   9 169.4 25 13 0 26.065996 0 0   -.4110517 1 4.5355763
    1 105201 1  -.8465944 1  6  36 155.4 40  8 1  8.937267 0 1   -.4045398 1      3.65
    1 105203 1 -.41805905 0  2   4 167.4 35 19 0 12.155595 0 1   -.1167053 1  2.652593
    1 105203 1 -.41805905 0  7  49 167.4 35 19 0 12.155595 0 1   -.1167053 1 4.1603036
    1 105204 0  -.7605008 0  5  25 158.5 35 13 0  6.622839 0 0   -.3836259 1  5.270667
    1 105204 0  -.7605008 1  3   9 158.5 35 13 0  6.622839 0 0   -.3836259 1 4.2490907
    1 105215 1  -.6909766 1  8  64 163.3 28 13 0 17.422085 0 0   -.2950828 0  2.641471
    1 105220 1  -.4026555 1 11 121 154.4 32  8 0  6.249478 0 1   -.1131703 1  4.158603
    1 105260 1  -.7207878 1 17 289 161.2 31 13 0  14.58359 0 0   -.3101804 1 1.9537038
    1 105260 1  -.7207878 0  4  16 161.2 31 13 0  14.58359 0 0   -.3101804 1 4.1158724
    1 105260 1  -.6664535 0 11 121   160 26 16 0 12.574732 1 0   -.2787774 0 4.0894737
    1 105263 1  -.6461336 0  6  36   158 25 13 0  10.37851 0 1   -.2964736 1  3.251145
    1 105290 1  -.7663828 0  6  36 157.3 32 19 0  8.959538 0 1    -.347116 0  2.003217
    1 105290 1  -.7641261 1  3   9 159.2 36 19 0  8.959538 0 1   -.3475043 1 4.3457136
    1 105290 1  -.7641261 0 11 121 159.2 36 19 0 10.060345 0 1   -.3475043 1  3.195122
    end
    label values hhsex Gender
    I would be very grateful for receiving your help,
    Kind regards, Jacob






  • #2
    You should read an econometrics textbook on clustered standard errors and tests of joint significance. As far as I can see, "town" is a binary variable and you are using it as your clustering variable. In general, if you have less than 30 clusters, you rather not cluster as the bias with few clusters outweighs any gains from clustering. Start with Cameron and Miller's paper where this issue is discussed in page 15.

    Comment


    • #3
      First of all thanks for your reply!
      Town is a variable that can take 3 values as there are 3 towns. As the Panel id is a household identifier, I decided to cluster the standard errors at the town level to control for heteroskedasticity of the error term and common characteristics of households living in the same town in terms of economic status and food environments. This is also done by a paper that I am closely referring to. Therefore, I would be surprised if this is the cause of this problem.
      Thanks for the paper I will read it now.
      Edit: I did change the cluster and now the test worked, so you were completely right!
      Thank you very much for youre help, I appreciate it a lot.
      Last edited by Jacob Steckel; 10 Mar 2022, 04:10.

      Comment

      Working...
      X