I have panel data and I want to find autocorrelation of variable x for each individual, so I do
It turns out that this command implements really slowly (I have a lot of different values of id). At the same time, when I want to find standard errors of x by
it is calculated very quickly. It seems like finding autocorrelation is not much more computationally difficult. Is there any way to do it faster?
Thanks.
Code:
levelsof id, local(levels) foreach i of local levels { corr(L.x x) if id == `i' replace rho = r(rho) if id == `i' }
Code:
bysort id: egen std = sd(x)
Thanks.
Comment