Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Weighted average of historical observations


From   Samuel Yeo <[email protected]>
To   [email protected]
Subject   st: Weighted average of historical observations
Date   Fri, 27 Jan 2012 12:52:44 +0800

Dear all,

I have annual data on a variable, X, for a set of individuals. Given
their ages, I would like to generate a new variable X_HIS, which is a
weighted average of their past experiences of X through their
lifetimes. X_HIS would therefore incorporate all observations of X,
over each individual's lifetime.

The calculation for X_HIS would be:

WEIGHT FOR A GIVEN YEAR = (AGE - k)^m
where k is the time lag (in years), increasing from 1 to each
individual's AGE; m is an arbitrary parameter

X_HIS = SUM(WEIGHT FOR A GIVEN YEAR * X) / (SUM OF WEIGHT FOR ALL YEARS)

Is there a way to do this in Stata, or would I need to do it elsewhere
and import it in?

Thanks, Samuel
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index