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

st: tsset for GARCH estimation with repeating dates

From   Kaspar Dardas <>
Subject   st: tsset for GARCH estimation with repeating dates
Date   Wed, 21 Oct 2009 14:08:07 +0200

Hi Statalisters,

I have a data set with 4 variables (date ret market_ret id) which
looks as follows:

date             ret     market_ret                id
01/02/2009   1%            2%                  1
02/02/2009   1.20%       2%                  1
03/02/2009    -1%        -4%                   1
04/02/2009    -5%       - 3%                   1
01/02/2009      8%        2%                   2
02/02/2009      9.00%   2%                   2
03/02/2009     -16%       -4%                 2
04/02/2009        0.3%    -3%                 2

Please note that date repeats/overlaps - (not for all ids but for some).
I try to use a GARCH process to estimate abnormal returns for each id
with the following loop:

forvalues i=1(1) 1137 {
l id gvkey if id==`i' & dif==0
arch ret market_ret, arch(1) garch(1) if id==`i' & estimation_window==1
predict p if id==`i'
replace predicted_return = p if id==`i'
drop p

My loop breaks because there is no time variable set. Whenever, I try
to set "date" as time variable with the command tsset I get the
following error message:

. tsset date
repeated time values in sample

Since this is an event study I will have repeated/overlapping dates in
my data set which is unavoidable. However there is NO repetition of
the same dates within any single id set. Thus, is there any way to set
a time variable for subsamples within a large data set such as

"by id: tsset date"?

The above obviously does not work but I hope that it somehow describes
what I need. Any help would be appreciated.



*   For searches and help try:

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