0

I estimate marginal effects of a continuous variable at certain levels of a factor. While I can define and change value labels for my factor variable, the margins command does not display those labels. Can this be changed?

* load data
set more off
use http://www.stata-press.com/data/r13/nlswork
describe

* set panel structure
xtset idcode year

* set labels
label define OCC_labels 1 "First"  2 "Second" 3 "Third"
label values occ_code OCC_labels
tab occ_code

enter image description here

* fixed effects regression, with interaction of continuous and factor variable
xtreg ln_wage c.wks_ue##i.occ_code, fe

* investigate marginal effects of weeks worked last year
margins, dydx(wks_ue) at(occ_code = (1 2 3))

enter image description here

Marco
  • 2,368
  • 6
  • 22
  • 48
  • 1
    Your question is about value labels, I believe, and nothing to do with variable labels, which are quite different. Showing value labels is often awkward because they can be too long to fit into a table showing much else. I don't know a way to get what you want if it's not documented as an option. – Nick Cox Aug 11 '20 at 08:46
  • See [this question](https://stackoverflow.com/questions/58770557/output-variable-value-labels-with-margins-dydx). –  Aug 11 '20 at 10:03
  • @PearlySpencer This cannot be estimated for my continuous variable. `margins, dydx(wks_ue) at(1.occ_code 2.occ_code 3.occ_code)` can you explain a bit more? – Marco Aug 11 '20 at 10:38
  • 1
    The problem in your case is the interaction. `margins` does not support levels of interactions in `at()`. To see this, remove the interaction and run `xtreg` with `i.occ_code` instead. –  Aug 11 '20 at 10:42

0 Answers0