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.
Related Posts with Loop Panel Regression to save one coefficient and visualize
R squared of fixed effects model too highHello everybody, thank you for your time and effort in advance! I really appreciate it! I have some…
Missing ValuesHello, everybody. There is a way to apply: drop if missing(var) when you have more than one variabl…
Cleaning Data Problemhello, everyone I have this problem: I have a variable x1 string and I have x2 byte...I need to cre…
Parameters in assert command must be positiveHello, I am using the assert command in a program that I wrote and I get the error message indicati…
Error r(430) when including lagged DV in XTMIXEDI am trying to run an HLM model in which monthly brand sales is my dependent variable. The model run…
Subscribe to:
Post Comments (Atom)
0 Response to Loop Panel Regression to save one coefficient and visualize
Post a Comment