Announcement

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

  • #16
    Thank you sir for the clarification. I want to know how to perform Hausman test adjusted for Cross Sectional dependence as mentioned in Stata Journal xtscc -

    Code:
    qui xtreg logBA logaVol logSize logTRMS2 logTRMS, re
    . scalar lambda_hat = 1 - sqrt(e(sigma_e)^2/(e(g_avg)*e(sigma_u)^2+e(sigma_e)^2))
    . gen in_sample = e(sample)
    . sort ID TDate
    . qui foreach var of varlist logBA logaVol logSize logTRMS2 logTRMS {
    . by ID: egen `var'_bar = mean(`var') if in_sample
    . gen `var'_re = `var' - lambda_hat*`var'_bar if in_sample // GLS-transform
    . gen `var'_fe = `var' - `var'_bar if in_sample // within-transform
    . }
    . * Wooldridge's auxiliary regression for the panel-robust Hausman test:
    . reg logBA_re logaVol_re logSize_re logTRMS2_re logTRMS_re logaVol_fe logSize_fe logTRMS2_fe logTRMS_fe if in_sample, cluster(ID)
    (output omitted )
    . * Test of the null-hypothesis ``gamma==0'':
    . test logaVol_fe logSize_fe logTRMS2_fe logTRMS_fe
    ( 1) logaVol_fe = 0
    ( 2) logSize_fe = 0
    ( 3) logTRMS2_fe = 0
    ( 4) logTRMS_fe = 0
    F( 4, 218) = 2.40
    Prob > F = 0.0510
    Code:
    . xtscc logBA_re logaVol_re logSize_re logTRMS2_re logTRMS_re logaVol_fe logSize_fe logTRMS2_fe logTRMS_fe
    > if in_sample, lag(8)
    (output omitted )
    . test aVol_fe Size_fe TRMS2_fe TRMS_fe
    ( 1) aVol_fe = 0
    ( 2) Size_fe = 0
    ( 3) TRMS2_fe = 0
    ( 4) TRMS_fe = 0
    F( 4, 218) = 1.65
    Prob > F = 0.1632
    I am not able to run this code? As everytime i run the it comes invalid name as error . What is sample in this code? And is it fine if all my variables both dependent and independent variables are in log form? Kindly guide what is wrong with code?

    Comment


    • #17
      Kindly produce the output you get.

      Comment


      • #18
        Sir I am just getting the error
        .invalid names

        Comment


        • #19
          As Eric said, you have to show us much more.

          Comment


          • #20
            Hi dear member,
            I am a beginner in the use of foreach. I need help to execute this code:

            foreach var in eyrs_mf nostu_mf asr_mf {
            gen d10_`var' = `var' - L10.`var'
            su d10_`var' if year==2015, countrynumber
            sort d10_`var'
            scalar p50d`var' = `r(p50)'
            scalar p75d`var' = `r(p75)'
            }

            When I execute the code above, I get the following error message:

            . foreach var in eyrs_mf nostu_mf asr_mf {
            2. gen d10_`var' = `var' - L10.`var'
            3. su d10_`var' if year==2015, countrynumber
            4. sort d10_`var'
            5. scalar p50d`var' = `r(p50)'
            6. scalar p75d`var' = `r(p75)'
            7. }
            not sorted
            r(5);

            end of do-file

            r(5);

            my variables are ranked from 1950 to 2015 with missing data. Even when I try to sort using "bysort countrynumber eyrs_mf nostu_mf asr_mf: list wbcode" I always get the same error message. Thanks for your help

            Comment


            • #21
              Juny:
              please repost your query with an informative and different title, as it has nothing to do with the queries/replies included in this thread. Thanks.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #22
                Hi.. Jeff.. does SUR model solve the issue of endogneity in a cross sectional data..please reply as soon as possible

                Comment

                Working...
                X