I have panel data, as constructed below for illustration. I wonder if there is a way to perform regression on the panel data so that each panel can serve as an explanatory variable for others? I am now doing it by reshaping the data but wonder if there is a better way. Thanks in advance for your advice.
Code:
clear * set obs 100 gen panel=1 gen day=_n gen x=runiform(1,100) set obs 10000 replace panel=panel[_n-100]+1 if panel==. replace day=day[_n-100] if day==. replace x=x[_n-100] if x==. xtset panel day gen y=runiform(1,10) reshape wide y , i(day x) j(panel) regress y1 x y2-y100 //is it possible to do regression on the original panel data to achieve this?
Comment