JanDitzen / xtdcce2

Estimating Dynamic Common Correlated Effects Models in Stata
https://janditzen.github.io/xtdcce2/
28 stars 14 forks source link

speed xtcd2 #9

Open JanDitzen opened 4 years ago

JanDitzen commented 4 years ago

Instead of loop in loop, multiply e (residuals, NxT) with ej where ej is e with jth element to front, i.e. ej = (ej, ej+1,...,eN,e1,...,ej-1). loop over ej and multiply with e. gives N cross correlations, i.e. one row for rho matrix.

advantage: only one loop necessary. faster? disadvantage: if large T and large N, speed might be slower. solutions: do test runs and assign threshold when multiplication gets slower.