Announcement

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

  • How to test significant difference in coefficients after using preserve command

    Hi
    I run two restricted sample models.
    Where in the first subsample I run the model for age group 5-10. In the second sample I run the same specifictaion for age group 10-16.
    How can I test the difference in the coeffcients for say read_score and the other scores in`y' between the two samples?
    How do I outreg all of this to an excel file?

    preserve
    keep if child_age>4 & child_age<11
    ************************************************** *************************************
    foreach x in sd_vc_body_out_high2 {
    foreach y in math_score read_score english_score {
    xtreg `y' `x' controls i.year i.child_age , fe cl(distid)
    sum `y' if e(sample)
    outreg2 using "${results1}/age5to10score_`x'",dta bdec(4) dec(4) nocons title(`x') append ctitle(`y') keep(`y' `x') addstat( "mean of outcome",r(mean)) alpha(0.01, 0.05, 0.1, 0.15) symbol(***, **, *, †)

    }
    }



    restore
    ************************************************** *******
    ****************************11-16************************
    preserve
    keep if child_age>10 & child_age<17
    ************************************************** *************************************
    foreach x in sd_vc_body_out_high2 {
    foreach y in math_score read_score english_score {
    xtreg `y' `x' controls i.year i.child_age , fe cl(distid)
    sum `y' if e(sample)
    outreg2 using "${results1}/age11to16score_`x'",dta bdec(4) dec(4) nocons title(`x') append ctitle(`y') keep(`y' `x') addstat( "mean of outcome",r(mean)) alpha(0.01, 0.05, 0.1, 0.15) symbol(***, **, *, †)

    }
    }



    restore

  • #2
    You cannot. You need to estimate both equations jointly as in https://www.statalist.org/forums/for...two-subsamples or add the fixed effects as indicators, estimate with regress and use suest. The latter approach is only feasible if \(N\) is not too large.

    Code:
    help suest

    Comment


    • #3
      what is the difference between suest and lincom command

      Comment


      • #4
        Look at the documentation for each of these commands:

        Code:
        help lincom
        help suest

        Comment

        Working...
        X