So I'm working through that engineering chapter again before submitting it and updating some analyses with new data that came out this year. I'm looking at a section where I'm discussing the graduate degree wage premium and I do something really weird in my code that I just can't figure out:
bysort year dgrdg: egen w=total(salarp*rweight)
bysort year dgrdg: egen totalr=total(rweight)
tab year dgrdg, sum(wrate) mean
tab year dgrdg [w=rweight] if salarp!=.
dgrdg is the degree variable, salarp is salary. For some reason I'm aggregating it up before tabulating. I get qualitatively similar results when I just do the natural thing of tabulating salaries and weighting the tabulation, but different results... does anyone have any clue what might have driven me to do this the first time (maybe a year ago)? The fact that the results are somewhat different (although like I said, qualitatively similar) makes me wonder if the weights are even frequency weights, which makes me want to stick with more intuitive thing I'm doing today.
The Lonely Unicorn
4 hours ago