How to plot a regression line for men and women on wage, holding education, tenure, and married at their average levels

时间:2017-04-10 00:08:09

标签: stata

. SRF Female: wage=-2.30-0.83+.05exper-0.05feduc +.57educ+ .13tenure+ .54married

SRF male=wage=-2.3+.05exper+.57educ+.13tenure+.54 married

variable feuds is the interaction term between female and years of experience:

  1. On the same graph, plot the regression line for men and women, holding educ, tenure and married at their average levels.

What I cannot figure out is how to have multiple y variables, and set them at their mean value.

twoway (line wage if female==1 educ==12.56274 exper==17.01711, sort), this code returns "invalid 'educ' ". saying my x variables are invalid.

1 个答案:

答案 0 :(得分:1)

我认为执行此操作的标准方法是运行这些系数来自的模型,然后使用margins命令和marginsplot。你可以这样做:

regress wage exper i.female##exper educ tenure married //don't forget to use the i. form for all categorical variables. especially because of the interaction term
margins i.female##exper 
marginsplot