Dear STATA list users,
I am relatively new to STATA and I need help with the following problem. I have a panel dataset and I want to calculate the residuals and fitted values of a preliminary regression, where each fitted and residual value is calculated for the unit of observation of my panel, and for all the years of the panel. I have currently 212 such units and so far I have been inputting the following commands in the example below about 212 times,
EXAMPLE:
xi: reg iGDP jGDP if PairsofAdjacentstatesij =="OR, ID", robust
predict double resid155 if PairsofAdjacentstatesij =="OR, ID", residuals
replace final=resid155 if PairsofAdjacentstatesij=="OR, ID"
order resid155
and for the the fitted values, again for 212 pairs of adjacent states:
xi: reg iGDP jGDP if PairsofAdjacentstatesij =="OR, ID", robust
predict common155 if PairsofAdjacentstatesij =="OR, ID"
replace finalcommon=common155 if PairsofAdjacentstatesij=="OR, ID"
. order common155
However there must be a faster way of doing this instead of manually entering the commands.
Can someone help wit this or indicate a good source (manual, website) to lear about this?
Thank you very much for all the help you can provide on this.
Elena
I am relatively new to STATA and I need help with the following problem. I have a panel dataset and I want to calculate the residuals and fitted values of a preliminary regression, where each fitted and residual value is calculated for the unit of observation of my panel, and for all the years of the panel. I have currently 212 such units and so far I have been inputting the following commands in the example below about 212 times,
EXAMPLE:
xi: reg iGDP jGDP if PairsofAdjacentstatesij =="OR, ID", robust
predict double resid155 if PairsofAdjacentstatesij =="OR, ID", residuals
replace final=resid155 if PairsofAdjacentstatesij=="OR, ID"
order resid155
and for the the fitted values, again for 212 pairs of adjacent states:
xi: reg iGDP jGDP if PairsofAdjacentstatesij =="OR, ID", robust
predict common155 if PairsofAdjacentstatesij =="OR, ID"
replace finalcommon=common155 if PairsofAdjacentstatesij=="OR, ID"
. order common155
However there must be a faster way of doing this instead of manually entering the commands.
Can someone help wit this or indicate a good source (manual, website) to lear about this?
Thank you very much for all the help you can provide on this.
Elena
Comment