Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: scaling by average

From   Claudius Li <>
Subject   st: scaling by average
Date   Tue, 11 Dec 2012 16:10:50 -0500

I've got an other question on the panel data set from my previous post.
I've reshaped it so that I now have

date state score time <other stuff>

I want to add a variable normalized_score = score - average_for_day
Where average_for_day = sum(score * count + score[n-7] * count[n-7]
+score[n+7] * count[n+7] ... ) / sum(count + count[n-7] + count[n+7]
... )

It seems a bit complicated to do this with loops. Is there a simpler way?

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index