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]

Re: st: Moving Standard Deviation


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Moving Standard Deviation
Date   Sun, 3 Nov 2013 16:22:57 +0000

I think you are missing my point on divisors. Consider a window with
the values 1,2,3,4,5.

If you use sample size n (here 5) as divisor the SD is just the root
mean square deviation, namely

. mata : sqrt(mean(((1,2,3,4,5)' :- 3):^2))
  1.414213562

If you use n - 1 as divisor you get

. mata : sqrt(sum(((1,2,3,4,5)' :- 3):^2)/4)
  1.58113883

which corresponds to what -summarize- does (I put the same values in a
variable)

. su y

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
           y |         5           3    1.581139          1          5

Ordinarily we can be cavalier about which formula you use but for
small windows -- and for reproducibility and comparability with others
-- it does make a difference, here a factor or divisor sqrt(5/4),
depending on which way you go.

-mvsumm- calls -summarize-; so if you want the first definition you
need to multiply by a correction factor.

Otherwise, sorry, but I have no idea what you mean when you say "is
this ok?". Do you distrust -summarize-? -mvsumm-? something else?
Whether SD is a good measure of volatility for your project I can't
say, naturally.
Nick
[email protected]


On 3 November 2013 14:37, Browne, Alan <[email protected]> wrote:
> Hey, Sorry for the late reply. I was under the impression that m was just the number of windows for the moving standard deviation. I am just going to use the mvsumm method as it is far more practical and I was only looking to try and replicate the literature for piece of mind. Just to clarify is the use of mvsumm ok for a moving standard deviation as a measure of volatility? Sorry for the question but trying to figure this out has been driving me crazy over the last few days. Thanks for the help.
>
> Best regards,
> Alan
> ________________________________________
> From: [email protected] <[email protected]> on behalf of Nick Cox <[email protected]>
> Sent: 31 October 2013 13:28
> To: [email protected]
> Subject: Re: st: Moving Standard Deviation
>
> would be happy with a citation, but my guess is that most reviewers
> would regard a citation as unnecessary for something of this kind.
> Your notation m perhaps implies that you are using the number of
> values as a divisor. If so, you would need to correct the results from
> -mvsumm-, which, as documented, uses -summarize-, which, as
> documented, uses that number minus 1 as divisor.
>
>
> Nick
> [email protected]
>
>
> On 31 October 2013 13:05, Browne, Alan <[email protected]> wrote:
>> Hello, I am currently trying to generate the moving standard deviation for a measure of volatility. I have used the mvsumm command, however, I am not sure how to cite that in the paper I am writing. I am trying to reproduce the following formula used in the literature.
>>                    Vol= [1/m*(sum(lne_t+i-1 - lne_t+i-2)^2)]^1/2
>>
>> where lne is the log of the exchange rate. Any help with this issue would be hugely appreciated.
>
> *
> *   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index