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]
Re: st: Rolling regression based on trading days
From
Bernice Mi <[email protected]>
To
[email protected]
Subject
Re: st: Rolling regression based on trading days
Date
Mon, 29 Apr 2013 19:12:39 +1000
Thanks Nick. That is also question. While the -xtset- is reporting ms,
the rolling regression is running on a calendar day basis though I
have formatted the dates as business calendar.
Much appreciated for your time and help Nick!! :-)
On Mon, Apr 29, 2013 at 7:08 PM, Nick Cox <[email protected]> wrote:
> It's me that is being slow. You did say that you have a business
> calendar format in operation. So your last date is (presumably)
> 31dec2012 (not 31dec2002).
>
> But I don't understand why the -xtset- is reporting ms, so I remain
> unclear where the problem is.
>
> Nick
> [email protected]
>
>
> On 29 April 2013 09:55, Bernice Mi <[email protected]> wrote:
>> Hi Nick,
>>
>> Sorry for confusing you. My data look like this:
>> company date price return
>> 1 02jan1990
>> 1 03jan1990
>> 1 04jan1990
>> .
>> .
>> .
>> 1 31dec1991
>> 2 02jan1980
>> 2 03jan1980
>> .
>> .
>> .
>> 2 31dec2012
>> .
>> .
>> .
>> So, 8399 is the max period for one company say starting 02jan1980 - 31dec2002.
>>
>>
>> Also, "describe date" gives us:
>>
>> storage display value
>> variable name type format label variable label
>> ----------------------------------------------------------------------------------------------------------------------------------------------
>> date float %tbbcal
>>
>> where "bcal" is the business calendar I have defined.
>>
>> Many thanks for your patience Nick!!
>>
>> On Mon, Apr 29, 2013 at 6:42 PM, Nick Cox <[email protected]> wrote:
>>> Your -date- variable varies between 0 and 8399. That can't be a daily
>>> date variable that includes dates like 31 Dec 2012.
>>>
>>> . di %d 8399
>>> 30dec1982
>>>
>>> . di %d 0
>>> 01jan1960
>>>
>>> So what you are showing us? You are -list-ing something; what is it?
>>>
>>> I also asked for -describe date-.
>>> Nick
>>> [email protected]
>>>
>>>
>>> On 29 April 2013 09:25, Bernice Mi <[email protected]> wrote:
>>>> Many thanks for your prompt reply Nick. Although delta is .001
>>>> seconds, when I run rolling regression, it is still based on calendar
>>>> days (not trading days as I want).
>>>>
>>>> The partial results are below. I really appreciate your help!
>>>> 864761. | 26nov2012 |
>>>> 864762. | 27nov2012 |
>>>> 864763. | 28nov2012 |
>>>> 864764. | 29nov2012 |
>>>> 864765. | 30nov2012 |
>>>> |-----------|
>>>> 864766. | 03dec2012 |
>>>> 864767. | 04dec2012 |
>>>> 864768. | 05dec2012 |
>>>> 864769. | 06dec2012 |
>>>> 864770. | 07dec2012 |
>>>> |-----------|
>>>> 864771. | 10dec2012 |
>>>> 864772. | 11dec2012 |
>>>> 864773. | 12dec2012 |
>>>> 864774. | 13dec2012 |
>>>> 864775. | 14dec2012 |
>>>> |-----------|
>>>> 864776. | 17dec2012 |
>>>> 864777. | 18dec2012 |
>>>> 864778. | 19dec2012 |
>>>> 864779. | 20dec2012 |
>>>> 864780. | 21dec2012 |
>>>> |-----------|
>>>> 864781. | 24dec2012 |
>>>> 864782. | 26dec2012 |
>>>> 864783. | 27dec2012 |
>>>> 864784. | 28dec2012 |
>>>> 864785. | 31dec2012 |
>>>> +-----------+
>>>>
>>>> .
>>>> end of do-file
>>>>
>>>> . do "C:\Users\lmi\AppData\Local\Temp\STD02000000.tmp"
>>>>
>>>> . su date
>>>>
>>>> Variable | Obs Mean Std. Dev. Min Max
>>>> -------------+--------------------------------------------------------
>>>> date | 864785 4144.932 2229.524 0 8399
>>>>
>>>> .
>>>>
>>>> On Mon, Apr 29, 2013 at 6:16 PM, Nick Cox <[email protected]> wrote:
>>>>> It seems that you have daily data. So why does -xtset- report milliseconds?
>>>>>
>>>>> Show us the results of say
>>>>>
>>>>> . describe date
>>>>> . su date
>>>>> . list date in 1/5
>>>>>
>>>>> I don't know offhand whether -rolling- is smart about business
>>>>> calendars. Introducing business calendars is an on-going project for
>>>>> StataCorp and I don't have access to Stata 12 right now.
>>>>>
>>>>> But if Stata thinks your time variable is clock time in ms, it won't
>>>>> be paying much attention to business calendars. As far as it is
>>>>> concerned you have in total about 1 second's worth of data.
>>>>>
>>>>> Nick
>>>>> [email protected]
>>>>>
>>>>>
>>>>> On 29 April 2013 08:53, Bernice Mi <[email protected]> wrote:
>>>>>> Hi All,
>>>>>>
>>>>>> I have an unbalanced panel data with the dates being trading days. I
>>>>>> have already defined and formatted (using %tbcalname) the dates as
>>>>>> business calendar. I checked by testing the lead and lag days - it
>>>>>> worked. However, when I xtset company date, it shows that delta is
>>>>>> 0.001 seconds. Moreover, when I run rolling regression for 3 years, it
>>>>>> turns up to be 1035 (roughly 360*3) replications not around 780 (i.e.
>>>>>> 260*3) replications.
>>>>>>
>>>>>> I am new user of Stata and could not figure out where I went wrong.
>>>>>> Please help me.
>>>>>>
>>>>>> Many thanks!!
>>>>>>
>>>>>> Bernice
>>>>>> *
>>>>>> * 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/
>>> *
>>> * 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/
*
* 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/