Statalist The Stata Listserver


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

st: Re: Took forever to run an event study program


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Took forever to run an event study program
Date   Wed, 14 Mar 2007 07:14:35 -0400

I'm not familair with even study programs in Stata (is this something you downloaded, someone gave to you, or what?) You really should show the code that you are executing to get specific advice about improving it.

Unlike some other responses, I think that Stata could run the 1300 simple regressions and calculate residuals in maybe a 1 minute or less, not 30 minutes. But it could easily take much longer with code that isn't optimized for speed. For example, if your code uses -if- to identify the window of interest repeatedly within each regression (for estimation, residual generation, etc..) then in larger datasets you could save about 80%-90% of your execution time switching to -in-. There are many other ways to write slow code in Stata.

A completely different issue that could dramatically affect execution speed is if your machine doesn't have much actual RAM and Stata is using swap file space.

Michael Blasnik

----- Original Message ----- From: "Nian Huang" <huangnian@gmail.com>
To: <statalist@hsphsun2.harvard.edu>
Sent: Wednesday, March 14, 2007 1:19 AM
Subject: st: Took forever to run an event study program



Could someone who knows about the event study (Finance or Accounting
area) in Stata give me some hints? My stata took too long to run a
event study program.

My version is Intercool Stata.

I have around 1,300 events. For each event, I need to calculate CAR
(cumulative abnormal return) around the event based on the market
model.
The event window is 3 days (-1, 1). The CAR is totalled for the 3 days period.
The estimation window is 241 days (-250, -10)

In Stata, for each event, a simple linear regression will be estimated
around the estimation window. Then based on the fitted line, residuals
will be calculated for the 3-day event window. Since I have around
1,300 events, Stata will do the same routine around 1,300 times.

I ran the program several times, and everytime it would take more than
30 minutes to finish the task.
I asked some of my colleagues--unfortunately, they use SAS instead of
Stata, and they said for the task, it only takes around several
seconds in SAS.

I want to know whether any Stata users have the similar situation
while running a event study program.
Is there any way to improve the program's efficiency?

Thank you very much.
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index