Hi all, quite new to Stata.
I am doing research on Excess CEO Compensation and I want to regress the natural log of CEO's total compensation on the control variables of CEO compensation. However, I want to perform a separate regression for each company for each year, and use each result as variable for that particular observation.
I've tried the following commands, however it doesn't provide me with the desired results:
sort CIK YEAR
gen expected_comp=.
egen id=group(CIK)
forvalues i=1(1)5696 {
I id CIK if id=='i'
reg logTDC1 logSALES logFS if id=='i '
predict p if id=='i'
replace expected_comp=p if id=='i'
drop p
}
Can anyone help me with this?
Related Posts with create variable based on regressed results per observation
Hierarchical anycountDear all, I have 2 sets of 8 variables and want to do egen x = anycount(varlist) values(1 3 6 7…
Dealing with a variable that has both numeric and categorical observationsHi everyone. I am new to this site so please bear with me. I am running a regression of property va…
Out of sample cross-validation for counts data, am I correct?Dear all, I am working on counts data and my study is to compare performance of several models that…
Problem with the power oneslope commandHi! I want to do a power analysis for a slope test in my linear regression, the command I have trie…
Issue with rename on a foreach loopHi I am trying to start a loop so that I can rename my variables. I tried using the same format I …
Subscribe to:
Post Comments (Atom)
0 Response to create variable based on regressed results per observation
Post a Comment