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, statalist.org is already up and running.


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

Re: st: time series from panel data


From   "Whelan, Paul" <paul.whelan07@imperial.ac.uk>
To   "<statalist@hsphsun2.harvard.edu>" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: time series from panel data
Date   Sun, 10 Feb 2013 20:16:01 +0000

Ahh. Got it

Thanks 

Sent from my iPhone

On 10 Feb 2013, at 20:06, "Cory Smith" <corybsmith@gmail.com> wrote:

> Don't do the by/egen. Instead,
> 
> collapse (mean) eps, by(date)
> 
> On Sun, Feb 10, 2013 at 12:36 PM, Whelan, Paul
> <paul.whelan07@imperial.ac.uk> wrote:
>> Hi,
>> 
>> I would like to take the 'mean' of the residuals from a panel
>> regression at each point in time to plot the average residual
>> in the cross-section as a time series. Here is an example and
>> the code I am using :
>> 
>> xtreg y x1 x2, fe vce(robust)
>> predict yhat
>> generate eps = y - yhat
>> by date, sort: egen mean_residual = mean(eps)
>> 
>> I would then like to export the resulting mean_residual to excel
>> as a single time series i.e., one observation for each date. The
>> problem is that I get many mean_residuals for each date corresponding
>> to each entity in the cross-section at that point in time.
>> 
>> Is there a simple way to extract a single time series?
>> 
>> thanks
>> 
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> *   http://www.ats.ucla.edu/stat/stata/
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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