Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: rolling covariance

From   "Olga Gorbachev Melloni" <>
Subject   st: rolling covariance
Date   Thu, 10 Aug 2006 15:46:48 -0400


I need help writign a little program/do file that will do the following (so far i've been unsuccessful):

I have panel data with about 3000 individuals observed over on average 15 years, unbalanced panel.

I need to see how sums of covariances b/w individuals changed over time.

Specifically, I need to compute for each 5 year block, the sum of covariances across all individuals within the sample, where

cov_t(y_it, y_jt)=(1/5)*sum_t{1 to 5} (y_it-y_ibar)(y_jt-y_jbar), where i and j are individuals

so I take individuals i and j and compute their covariance of income over 5 year period, and then I take i and m and then i and n ... and thus, for all individuals in the sample, and then I need to sum over those cov and do the same for the next 5 years.

Any help on programming this?

thank you,

Olga Gorbachev Melloni
Ph.D. student in Economics at Columbia University
502 W122 Street, apt. 62
NY, NY 10027

* For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index