Statalist


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

Re: st: High-frequency time-series (stata 10)


From   "Marc N. Sch�ssler" <[email protected]>
To   [email protected]
Subject   Re: st: High-frequency time-series (stata 10)
Date   Wed, 24 Sep 2008 17:58:59 +0200

Hi Bea,

i had a similar problem, assigning activity-levels to 15 sec. Intervalls.
You need to have 5 min- intervalls in long format and within these 5 min. intervalls the different bid and answers in wide format.

My problem had been similar, an activity - level was measured and could change within a 15 second Intervall.
So i devided my timevar in 15 seconds pices starting here with 7:00am as observations begin.
Over a loop then assign a new variable the clocktimevalue in milliseconds ( i called it "time15").
then i looped over every second from this 15 second Intervall and assigned a counting device for the reshape to keep the ordering within the 15 second Intervalls

In the end i droped unneeded variabls and then reshaped by (id time15) to keep the ID-TIME order and j = alevel15 to get within the 15 second intervall the different activitylevels into the wide format.

hope this helps, however i noticed that there is some trouble with the charactercoding switching from MAC to PC. So you might see the special characters like brakets for the loop not properly.

greets
marc

**********************************************************************
cap drop alevel15 time15
gen time15 = .
gen alevel15=.
local help = 25200000 ///this means 7:00am in milliseconds
forvalues x= 25200000(15000)48600000 {
disp "`x'"
bysort ID: replace time15 = `help' if time >= `x' & time < (`x' + 15000)
local help = `help' + 15000
forvalues y = 0/14 {
replace alevel15 = `y' if time==`x' + `y'*1000
}
}

keep ale* ID time15
reshape wide alevel ,i(ID time15) j(alevel15)

**********************************************************************


Am 24.09.2008 um 13:33 schrieb Beatrice Crozza:


Dear All,

I know that with Stata 10 all time-series analysis commands now
support data with frequencies as high as 1 millisecond.

I would like to treat my dataset as a time-series,I have
high-frequency data(5-minute intervals) and a variable (timedate) that
is composed of the time and the date for each bid and ask. My problem
is that I have duplicate data, because for each timedate there could
be more than one bid and more than one ask, so Stata gave me this
error message:

. tsset timedate, delta(5 minute)
repeated time values in sample
r(451);

I need to treat my date as a time-series to do an AR analysis for bids
and asks through time.
I am thinking to assign a number ( in sequential order) to each
timedate and than to use the command tsset with this new variable.

Do you think that this procedure is right to achieve my goal?

Do you have any idea on how to assign a sequential number to each bid
and ask, without using Excel?

Thank you very much in advance.

Best,
Bea
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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