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

using foreach to run regressions for consecutive time periods

$
0
0
Greetings,

I have a panel dataset (country/years) for years 1956-2014. I'd like to estimate a regression and save the output for each 10-yr period (e.g. starting with 1956-1955, then 1957-1956, and so). The intent being to explore how the model performs across time. My basic code structure is (I'm using version 13.1):

eststo model_56_65: quietly logit depvar var1 var2 var3 if year >= 1956 & year<= 1965
quietly estadd fitstat

Would I be able to use the foreach command to loop the estimations rather than copying the same block of code 50 times?

Apologies if this is an overly elementary question. I'm reading the online help on the foreach command, but I'm still a bit confused with how it works. Any advice would be much appreciated.

Viewing all articles
Browse latest Browse all 65050

Trending Articles



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