Announcement

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

  • F-test after xtivreg

    Dear Statalisters,

    I am running an instrumental variable model using the following codes. I am trying to check the exogeneity of the instrument, whether it is a strong or a weak one.

    Code:
    global X2 "c.age##c.age i.educ4 i.marital3 hhsize urban public"
    xtivreg Y $X1 (endvar= $IV), re vce(robust) first
    xtoverid
    However, the
    Code:
    xtoverid
    did not work and it gave me the below error:

    cage#c: operator invalid
    r(198);

    I have also tried the below code and it gave me an error term that endog is not allowed.

    Code:
    xtivreg Y $X1 (endvar= $IV), fe first endog(endvar)
    Could you please advise me on this?

    Best regards,
    Maye
    Last edited by Maye Ehab; 29 Jun 2017, 06:43.

  • #2
    Maye:
    the user-written programme -xtoverid- does not support -fvvarlist- notation.
    Hence, you should create interactions by hand and prefix your code with -xi-.
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Dear Carlos,

      Thank you for your reply.

      It worked but did not give me the statistic:
      The code:
      Code:
      global X2 "age agesq basiceducation secondaryeducation postsecondary married widowedordivorced hhsize urban public"
      xi: xtivreg Y $X2 (endogvar= $IV), re vce(robust) first
      The result:
      Code:
      Test of overidentifying restrictions:
      Cross-section time-series model: xtivreg g2sls  robust cluster(Findid)
      Sargan-Hansen statistic   0.000  (equation exactly identified)


      Can you please guide me what went wrong?
      I was not able to find a reference with enough examples for this command. If you can provide me with one, I would be grateful.

      Best regards,
      Maye

      Comment


      • #4
        I actually found another option that gave me the tests I need
        Code:
         
         xtoverid,noi
        Thank you again for clarifying to me why the -xtoverid- did not work in the first place.

        Comment


        • #5
          Maye:
          please note that -xtivreg, re- (just like -xtreg, re-) does not give you back an F-test but a chi2 one:
          Code:
          webuse nlswork
          xtivreg ln_w age c.age#c.age not_smsa (tenure = union south), vce(robust) first
          
          First-stage G2SLS regression
                                                           Number of obs    =     19,007
                                                           Wald chi(5)      =       4932
                                                           Prob > chi2      =     0.0000
          
          ------------------------------------------------------------------------------
                       |               Robust
                tenure |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                   age |   .1357715   .0382906     3.55   0.000     .0607233    .2108196
                       |
           c.age#c.age |   .0021357   .0006504     3.28   0.001      .000861    .0034105
                       |
              not_smsa |  -.0178559    .068881    -0.26   0.795    -.1528601    .1171484
                 union |   1.032321   .0650498    15.87   0.000     .9048261    1.159816
                 south |  -.1311183   .0637709    -2.06   0.040     -.256107   -.0061297
                 _cons |   -3.02552   .5449259    -5.55   0.000    -4.093555   -1.957485
          ------------------------------------------------------------------------------
          
          G2SLS random-effects IV regression              Number of obs     =     19,007
          Group variable: idcode                          Number of groups  =      4,134
          
          R-sq:                                           Obs per group:
               within  = 0.0620                                         min =          1
               between = 0.1745                                         avg =        4.6
               overall = 0.1206                                         max =         12
          
          
                                                          Wald chi2(4)      =     403.60
          corr(u_i, X)       = 0 (assumed)                Prob > chi2       =     0.0000
          
                                       (Std. Err. adjusted for 4,134 clusters in idcode)
          ------------------------------------------------------------------------------
                       |               Robust
               ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                tenure |   .1772948   .0152425    11.63   0.000       .14742    .2071696
                   age |   .0191674   .0102686     1.87   0.062    -.0009588    .0392935
                       |
           c.age#c.age |  -.0008496   .0001707    -4.98   0.000    -.0011842   -.0005149
                       |
              not_smsa |  -.2119932   .0179604   -11.80   0.000    -.2471951   -.1767914
                 _cons |    1.42761   .1509676     9.46   0.000     1.131719    1.723501
          -------------+----------------------------------------------------------------
               sigma_u |  .33156584
               sigma_e |  .63029359
                   rho |  .21674808   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          Instrumented:   tenure
          Instruments:    age c.age#c.age not_smsa union south
          ------------------------------------------------------------------------------
          Kind regards,
          Carlo
          (Stata 18.0 SE)

          Comment

          Working...
          X