Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: could this be done with tssmooth


From   Phil Stata <[email protected]>
To   [email protected]
Subject   st: could this be done with tssmooth
Date   Sat, 13 Apr 2013 21:38:10 +0200

I am new to Stata and am having problems with reducing my dataset to a size
that I can handle:

I have a large amount of observations (intraday stock prices, multiple
observations per second).
I would like to compress this to say one stock price every ten minutes.

My approach has been to try to calculate the average of all observations in
the past 5 minutes and the next every ten minutes.
I used the following loop, where the numbers represent the date-time
interval I am looking at in miliseconds (600'= 10 Minutes)

forvalues x = 1578216600000(600000)1609430400000 {
quietly sum price[fweight=size] if date_time>=`x'-300000 &
date_time<=`x'+300000
replace mean_price = r(mean) if date_time==`x'
}

While I think it does the job, it is incredibly slow. I read that Stata's
internal looping functions are much faster,
so I was wondering whether Stata's time-series functionality provides a
more direct and elegant solution.


I hope someone can give me some pointers as to why the performance is so
poor and am grateful for any help.
Thank you, Phil



my data looks something like this
symbol         date    time          price    size
FDO    04jan2010    09:29:01    27.95    100
FDO    04jan2010    09:29:01    27.95    200
FDO    04jan2010    09:29:30    27.95    300
FDO    04jan2010    09:30:00    27.96    100
FDO    04jan2010    09:30:00    27.91    100
FDO    04jan2010    09:30:00    27.88    100
FDO    04jan2010    09:30:00    27.87    100
FDO    04jan2010    09:30:00    27.85    100
FDO    04jan2010    09:30:00    27.85    100
FDO    04jan2010    09:30:01    27.95    263
FDO    04jan2010    09:30:01    27.95    263
...
FDO    08jan2010    14:49:55    30.24    100
FDO    08jan2010    14:49:55    30.24    100

I am using Stata 12 on a Win7 64 machine, with 4GB RAM, and an Intel i5
2.5GHz
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index