Announcement

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

  • Test whether coefficient is significantly different in 2 subsamples

    Dear listers,

    I want to test whether the relationship of interest is significantly different between the subsamples with respectively var1 above or below its median, and likewise for var2 and var3.
    Hence I generated the respective dummies and wrote the below code:

    Code:
    eststo clear
    foreach var of varlist dummy1 dummy2  dummy3 {
         eststo: reghdfe depvar indepvar if `var'==0
         eststo: reghdfe depvar indepvar if `var'==1     
         }
    esttab using "table"
    This does produce the estimates of interest, showing for each dummy first the sub- and then right to it the super-median estimations.
    However, I would like to add to the bottom of the table the variable by which I have split and, more importantly,
    add a formal test of whether the difference in the estimates on indepvar is significant.

    Does someone know how to do this?

    Thank you so much,
    PM

  • #2
    To add notes, esttab provides the option
    Code:
    addnotes("Something to print")
    Regarding the other question, you need to add an interaction term. To fully replicate what you have so far would boil down to this model:
    Code:
    reghdfe depvar c.indepvar##i.dummy
    The significance level of the interaction term is what you are interested in.

    If you have more control variables, you can do it like so:
    Code:
    reghdfe depvar i.dummy##(c.indepvar c.control1 c.control2)
    Best wishes

    Stata 18.0 MP | ORCID | Google Scholar

    Comment

    Working...
    X