Announcement

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

  • xtivreg test for endog, instrument relevance and instrument exog

    Hi, I want to test for endogeneuity of the variable religioisitymean where I have i.sin##c.religiostymean in my equation. What are the commands for testing for endogentuity of this variable, the instrument relevance test and instrument exog test in stata after running xtivreg?

    Estimation equation is: xtivreg netreturn sin (religiositymean sinreligiositymean= statereg sinstatereg) beta lmarketcap lpb bev lgdp spread inflationrate open law year1 year2 year3 year4 year5 year6 year7 year8 year9 year10 i.country_c, re first vce(cluster company)

    when doing estat endogenous
    I get the error: subcommand estat endogenous is unrecognized

    Thanks
    Last edited by Krissy Philips; 23 Feb 2017, 04:26.

  • #2
    You will increase your chances of a useful reply if you provide Stata code (using code delimiters), Stata output, and sample data (using dateex). Please see the FAQ on asking questions.
    xtivreg2 has some of these tests built in. Otherwise, look at various estat options.

    Comment


    • #3
      Originally posted by Phil Bromiley View Post
      You will increase your chances of a useful reply if you provide Stata code (using code delimiters), Stata output, and sample data (using dateex). Please see the FAQ on asking questions.
      xtivreg2 has some of these tests built in. Otherwise, look at various estat options.
      Click image for larger version

Name:	statalist 2.png
Views:	1
Size:	59.8 KB
ID:	1375760


      I did include the stata code in the question? Its the estimation equation? Sorry here is the output^^

      Comment


      • #4
        Jeff Wooldridge has answered your question here:
        http://www.statalist.org/forums/foru...est-panel-data
        You then replied to him. If you maintain two threads on the same issue, this will create confusion.
        Last edited by Eric de Souza; 25 Feb 2017, 12:40.

        Comment


        • #5
          Originally posted by Eric de Souza View Post
          Jeff Wooldridge has answered your question here:
          http://www.statalist.org/forums/foru...est-panel-data
          You then replied to him. If you maintain two threads on the same issue, this will create confusion.
          Hi Eric,

          The part about testing for instrument relevance and exogenuity hasn't been answered however.

          I am running:

          xtivreg netreturn sin (religiositymean sinreligiositymean= statefav sinstatefav) beta lmarketcap lpb bev lgdp spread inflationrate open law year1 year2 year3 year4 year5 year6 year7 year8 year9 year10 country1 country2 country3 country4 country5 country6 country7 country8 , re vce(cluster company)

          And was told I can do xtoverid to test for the instrument relevance/exogenuity but I'm getting "o. operator not allowed
          r(101);"

          I haven't got any factor variables in the equation so wasn't sure why this is happening - could you assist?

          Comment


          • #6
            When I run (albeit a nonsense regression):
            Code:
            webuse grunfeld
            xtivreg invest (mvalue = kstock), re vce (cluster company)
            xtoverid
            xtoverid, cluster(company)
            I get no error message
            Try reducing the number of explanatory variables to see if that helps to get rid of the error

            Comment


            • #7
              Originally posted by Eric de Souza View Post
              When I run (albeit a nonsense regression):
              Code:
              webuse grunfeld
              xtivreg invest (mvalue = kstock), re vce (cluster company)
              xtoverid
              xtoverid, cluster(company)
              I get no error message
              Try reducing the number of explanatory variables to see if that helps to get rid of the error
              Would that not be testing the instrumental estimation for a different equation to the one used in my analysis then? I am now getting another error message when running the same equation...:
              Error - must have ivreg2/ivreg29/ivreg28 version 2.1.15 or greater installed
              r(601);

              I'm quite confused to what is that cause of this and what's going on. Your help would be much appreciated.

              Comment


              • #8
                To get that error message you must have been running -xtivreg2- and not -xtivreg-
                Could you please reproduce the commands you ran with all the variables you used as well as the error messages you got, each command and each error message on a new line.

                Comment


                • #9
                  Thanks Eric, please have a look at these attached, I am only running xtivreg??
                  Attached Files
                  Last edited by Krissy Philips; 28 Feb 2017, 06:21.

                  Comment


                  • #10
                    Impossible to read.

                    Comment


                    • #11
                      Originally posted by Eric de Souza View Post
                      Impossible to read.
                      Ive made the images bigger so hopefully this will be clearer. They are the succession of commands which I tried.

                      thanks
                      Attached Files

                      Comment


                      • #12
                        To begin with install ranktest: ssc install ranktest. xtivreg requires ranktest. Then we'll see.
                        Also, instead of putting your image in a Word file, save your images in png format, if you can

                        Comment


                        • #13
                          its still coming up as this Eric, will it help if I send you the data file? I've googled this problem but to no avail.
                          Click image for larger version

Name:	xtoverid error.png
Views:	1
Size:	558.8 KB
ID:	1376177

                          Last edited by Krissy Philips; 28 Feb 2017, 09:08.

                          Comment


                          • #14
                            This time the image you posted is not visible

                            Comment


                            • #15
                              I'm not sure why not sorry, I can see it and it's a PNG file. But I basically removed the 1 out of the 8 country dummies I have put in, which was getting omitted due to collinearity. However now the constant term has been omitted?Therefore I get the error: variable _cons not found
                              r(111);? I think if I can prevent this from happening it should solve the problem. Why is this happening? Hopefully you can see this:

                              xtivreg netreturn sin (religiositymean sinreligiositymean= statefav sinstatefav) beta lmark
                              > etcap lpb bev lgdp spread inflationrate open law year1 year2 year3 year4 year5 year6 year7 y
                              > ear8 year9 year10 country1 country2 country3 country4 country5 country6 country7, re vce(clu
                              > ster company)

                              G2SLS random-effects IV regression Number of obs = 1,310,589
                              Group variable: company Number of groups = 11,217

                              R-sq: Obs per group:
                              within = 0.0053 min = 3
                              between = 0.0016 avg = 116.8
                              overall = 0.0039 max = 120


                              Wald chi2(28) = 21205.21
                              corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000

                              (Std. Err. adjusted for 11,245 clusters in company)

                              | Robust
                              netreturn | Coef. Std. Err. z P>|z| [95% Conf. Interval]

                              religiositymean | 8.593998 4.578544 1.88 0.061 -.3797837 17.56778
                              sinreligiositymean 2.629845 1.24173 2.12 0.034 .1960985 5.063591
                              sin | -5.628733 2.384256 -2.36 0.018 -10.30179 -.955678
                              beta | .4106493 1.57818 0.26 0.795 -2.682527 3.503826
                              lmarketcap | .0068872 .0393319 0.18 0.861 -.0702018 .0839763
                              lpb | 1.291663 .0651996 19.81 0.000 1.163875 1.419452
                              bev | -.6960829 .4117346 -1.69 0.091 -1.503068 .110902
                              lgdp | -1.158466 .19548 -5.93 0.000 -1.5416 -.7753326
                              spread | .5631453 .1378397 4.09 0.000 .2929845 .8333061
                              inflationrate | -.1676651 .0395968 -4.23 0.000 -.2452734 -.0900568
                              open | -.0139416 .002138 -6.52 0.000 -.018132 -.0097513
                              law | 1.566445 9.68651 0.16 0.872 -17.41877 20.55166
                              year1 | -3.307143 .2228099 -14.84 0.000 -3.743842 -2.870443
                              year2 | -2.67502 .3942239 -6.79 0.000 -3.447685 -1.902355
                              year3 | -.848703 .2192208 -3.87 0.000 -1.278368 -.4190382
                              year4 | -9.003221 .2226633 -40.43 0.000 -9.439633 -8.566809
                              year5 | -.934297 .181023 -5.16 0.000 -1.289096 -.5794984
                              year6 | -1.276434 .3654093 -3.49 0.000 -1.992623 -.5602448
                              year7 | -3.53848 .2776365 -12.75 0.000 -4.082638 -2.994323
                              year8 | -2.426716 .315858 -7.68 0.000 -3.045786 -1.807645
                              year9 | .5427375 .3208605 1.69 0.091 -.0861375 1.171612
                              year10 | -1.175674 .2956233 -3.98 0.000 -1.755085 -.5962633
                              country1 | .1485511 2.03223 0.07 0.942 -3.834547 4.131649
                              country2 | -1.130993 2.980294 -0.38 0.704 -6.972262 4.710275
                              country3 | 4.871609 1.030264 4.73 0.000 2.852328 6.89089
                              country4 | -3.829572 7.106923 -0.54 0.590 -17.75889 10.09974
                              country5 | 3.886175 2.093766 1.86 0.063 -.217531 7.989881
                              country6 | -1.465936 .6749977 -2.17 0.030 -2.788907 -.1429644
                              country7 | -11.46393 7.463646 -1.54 0.125 -26.0924 3.164549
                              _cons | 0 (omitted)

                              sigma_u | 5.3873446
                              sigma_e | 46.549328
                              rho | .01321734 (fraction of variance due to u_i)

                              Instrumented: religiositymean sinreligiositymean
                              Instruments: sin beta lmarketcap lpb bev lgdp spread inflationrate open law year1
                              year2 year3 year4 year5 year6 year7 year8 year9 year10 country1
                              country2 country3 country4 country5 country6 country7 statefav
                              sinstatefav


                              . xtoverid, cluster(company)
                              variable _cons not found
                              r(111);

                              . xtoverid
                              variable _cons not found
                              r(111);


                              Attached Files
                              Last edited by Krissy Philips; 28 Feb 2017, 09:28.

                              Comment

                              Working...
                              X