Announcement

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

  • Creating output table with interquartile range of Y after regression

    Code:
    sysuse auto.dta, clear
    eststo: ivreghdfe mpg (weight=trunk) foreign [aw=length]
    estadd ysumm
    estadd local YAVG=e(ymean)
    esttab  using "output.tex", scalars("YAVG YAVG") replace
    After some experimentation, I came to learn that the code will create one more row of average Y in the output table.

    When calculating YAVG, this code will, rightly, NOT include those observations that were not included in regression (such as those observations that have missing values in at least one of control variables).

    Also, when calculating it, this code will, again rightly, weight the observations by length.

    Now I want to do it for interquartile range of Y, not just mean of Y. How can I do that?

    Ultimately, interquartile range should be multiplied with the coefficient to produce the row in the output table meaning "predicted change in Y as a response to X"

    Also, YAVG saves too many decimals. How can I shorten it?
Working...
X