Dear all,
I am new to Stata and could use some help. I have a Panel-Data set where I try to analyze the impact of Locus of Control (LOC) on Wage. After the usual steps I came to the point where I did regressions appropiate for my data seperately for men and women:
xtreg lnwage LOC age tenure (..other control variables..) if gender==0, re vce(cluster id)
Im happy with the results so far, but now I would like to loop this regression for age= 20/30 and save the regression coefficients from LOC. So far I searched through the internet and tried different commands. Among others I tried for example:
g b_loc=.
quietly forval age=20/30 {
xtreg lnwage LOC age tenure (other control variables) if gender==0, re vce(cluster id)
replace b_loc=_b[loc]
or statsby commands. However I could not produce logical results.
In a next step I am interested in visualizing the impact of LOC over the age (-> x-axis) on logwage (-> y-axis) in a line chart with 2 graphs for men and women, to see if the impact of LOC on lnwage changes throughout the life. Because the loops did not work out for me I don't have a exemplary approach on how to do that graphic yet.
I could use any kind of help thank you very much in advance.
0 Response to Loop Panel Regression to save one coefficient and visualize
Post a Comment