Announcement

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

  • #31
    Dear Sebastian Kripfganz ,

    I am trying to run multiple overidentification tests on random subsamples of my original dataset, however, I cannot find how to extract the test-statistic from the overid test...
    I tried the following:

    Code:
    clear all
    
    cd "C:\Users\wille\OneDrive\Afstuderen2\Enexis\XGBoost\Output Data\with2023"
    insheet using "double_risk.csv", comma clear
    
    format year %ty
    encode postcode, generate(id)
    egen newid = group(id)
    global id id
    global year year
    sort $id $year
    xtset $id $year
    
    mat overidentification = (.)
    
    tempfile holding
    save `holding'
    set seed 1234
    
    forval i = 1/5 {
        use `holding', clear
        keep id
        duplicates drop
        sample 50, count
        merge 1:m id using `holding', assert (match using) keep(match) nogenerate
        sort id
        quietly xtdpdgmm L(0/1).consumption L(0/2).gas L(0/2).gdp heatdays, model(diff) gmm(consumption, lag(2 4)) gmm(gas, lag(2 4)) gmm(gdp, lag(2 4)) iv(heatdays, lag(1 2)) two vce(r) overid
        estat overid
        mat overidentification = (overidentification \ r(HansenJ))
    }
    Also, the model I use above has 35 degrees of freedom. I am trying to figure out why this is 35 but I do not find why there are so many.

    Thanks in advance!

    Hein Willems

    Comment


    • #32
      estat overid after xtdpdgmm stores the Hansen test statistic in r(chi2_J), the p-value in r(p_J), and the degrees of freedom in r(df_J).

      Type return list after estat overid to see the full list of stored results.

      The degrees of freedom equal the number of non-redundant instruments minus the number of non-omitted coefficients; i.e., the number of overidentifying restrictions.
      https://www.kripfganz.de/stata/

      Comment


      • #33
        Sebastian Kripfganz

        Thank you for your reply. I am still not sure how to obtain the 35 degrees of freedom. I am using gmm(consumption, lag(2 4)) a sinstruments for the consumption variable. This gives me 3 instruments right? Than I also have 3 for the gas variable, 3 for the gdp variable and 2 for the heatdays variable. The number of estimated coefficients is 8. I dont see how this forms the 35 degrees of freedom.

        Thanks in advance!

        Comment


        • #34
          No, without the collapse option, gmm(consumption, lag(2 4)) roughly gives you 3 instruments per time period. Essentially, the gmm() option creates instruments that are interactions of these lagged variables with time dummies; see slide 22 of my 2019 London Stata Conference presentation. You can see the full list of non-redundant instruments below the regression output.
          https://www.kripfganz.de/stata/

          Comment


          • #35
            Sebastian Kripfganz Thank you for the clarification. So without the collapse option, for each time period, gmm(consumption, lag(2 4)) uses 3 instruments, unless they are redundant. How is it tested whether one of these instruments is redundant? Can I get the output of these tests in some way?

            Comment


            • #36
              There is no test. If an instrument is redundant (i.e., perfectly collinear with other instruments), it will be dropped automatically (and therefore not show up in the list below the regression output).
              https://www.kripfganz.de/stata/

              Comment


              • #37
                Sebastian Kripfganz

                When evaluating different models based on the Andrews and Lu moment and model selection criteria, and the MMSC-BIC and MMSC-HQIC have optimal values for different models, how should we decide between these models?

                Comment


                • #38
                  This is then really up to your judgment, whether you think one specification is (from a theoretical standpoint) more reasonable than the other.
                  https://www.kripfganz.de/stata/

                  Comment

                  Working...
                  X