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 moments
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: rolling moments
Date
Sun, 23 Dec 2012 11:05:39 +0000
If you have gaps in your data no other command can do any better.
Nick
On Sat, Dec 22, 2012 at 9:57 PM, annoporci <[email protected]> wrote:
> I forgot to add, this is my best shot:
>
> rolling sd=r(sd) skewness=r(skewness) kurtosis=r(kurtosis), window (60)
> clear: summarize, detail
>
> The problem is that it generates a lot of gaps because of missing data.
>
>
>
> On Sat, 22 Dec 2012 23:28:22 +0800, annoporci <[email protected]> wrote:
>
>> Dear Statalist,
>>
>> I have financial data whose statistical properties I'd like to analyze.
>> I'm new to this so any pointer would be appreciated.
>>
>> I would like to do the following:
>>
>> plot a moving average of the mean/sd/skewness/kurtosis, where either I
>> would use a fixed horizon, e.g. 60 observations (add one drop one as you
>> move with time) or I would use exponentially declining weights on distant
>> observations, for a fixed predetermined weight parameter.
>>
>> I have found user-contributed programs to do that for the mean/sd, but not
>> for the skewness and kurtosis. I'm especially interested in the kurtosis. In
>> fact, I would like to also compute semi-kurtosis, e.g. semi-kurtosis for
>> negative returns or for returns below average.
>>
>> I could probably work this out on my own by writing down the formulas in
>> terms of the first 4 moments, but I have read exchanges that suggest that
>> efficiency issues may be important, so I'd like to start on the right track,
>> and would thus appreciate your suggestions.
>>
>> my dataset has the date and the daily return for different portfolios x1,
>> x2, x3, etc. over a 30 year period, so efficiency in the code is likely to
>> be necessary.
>>
>> many thanks,
>>
>> Patrick.
>>
>> my main reference:
>> http://www.stata.com/statalist/archive/2008-08/msg00153.html
*
* 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/