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

st: re: moving averages in panel data

From   Kit Baum <>
Subject   st: re: moving averages in panel data
Date   Mon, 21 Dec 2009 21:44:47 -0500

Darian said

Thanks. Although 'tssmooth ma' doesn't seem to work because my data is not time-series data. In fact, it's not even panel data. It's product by country by year. So each year in each country has multiple observations due to the different products. That means that 'tsset year' or 'tsset year country' doesn't work, which makes tssmooth not work either.
Help with either moving averages or tips on working with this two-cross-sections-and-time data would be appreciated (without reshaping).

You can form a panel where the unit is the country-product, e.g. kiwi fruit exported by NZ. For that you have a time series. Use egen group() function to form a counter for each combination of country and product, and use that as the panel id variable. Then all time series functions will work properly.

Kit Baum   |   Boston College Economics & DIW Berlin   |
                              An Introduction to Stata Programming  |
   An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

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