Statalist The Stata Listserver


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

st: rolling covariance


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

Hi,

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


Olga Gorbachev Melloni
Ph.D. student in Economics at Columbia University
(212)866-6091
502 W122 Street, apt. 62
NY, NY 10027


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




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