Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65553

Running regression in a loop in panel data

$
0
0
Hello,

I have to run regression in a loop on a panel data set. My data is of the following format:
panel_id year cash_flow
1 1994 35
1 1995 39
1 1996 24
I have to regress cash_flow over time, where (1994=1, 1995=2, 1996=3). For each observation I have to calculate regression coefficient for past 3 years. Overall, my data spans over 20 years and have over 100 panels. Is there a way to run the above regression in a loop and save the coefficient of regression(slope) into my data.

Thanks,
Shekhar

Viewing all articles
Browse latest Browse all 65553

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>