[R-SIG-Finance] Skewness function for intraday data return distribution

Patrick Burns patrick at burns-stat.com
Mon Oct 31 09:09:39 CET 2011


The skewness of c * X should be equal to
the skewness of X.  If I'm reading the
formulas correctly, that is true of the
second one but not the first.

It would be interesting to hear if you find
different results intraday than I did with
daily data over a year:

http://www.portfolioprobe.com/2011/10/03/predictability-of-kurtosis-and-skewness-in-sp-constituents/

On 31/10/2011 05:18, Roupell, Darko wrote:
> Hi All,
>
> I have written a skew function to calculate stock skewness using intraday 5 min data. However, going through literature I have come across two very similar formulas, though they produce different skewness coefficient and wonder if anyone else has used similar formulas and know which one is the correct one.
>
> mq_skewness = function(data){
> data = dataformatc(data);
>    #returns midquote log returns as xts object
>    mq_ret = mq_return(data);
>    #returns midquote log returns as xts object
>    mq_ret_sqr = mq_ret^2;
>    #returns realized daily volatility as xts object
>    RVar=sum(  mq_ret_sqr)
>    n = length(mq_ret);
>
>    #first formula to measure skewness
>    mq_skewness = sqrt(n) * (sum(mq_ret^3))/sum(mq_ret_sqr)^(2/3)
>
>   # second formula to measure skewness
>    mq_skewness = sqrt(n) * sum((mq_ret/sqrt(RVar))^3)
>
>    return(mq_skewness);
> }
>
>    #first formula to measure skewness
>    mq_skewness = sqrt(n) * (sum(mq_ret^3))/sum(mq_ret_sqr)^(2/3)
> [1] 0.0003991095
>    # second formula to measure skewness
>    mq_skewness = sqrt(n) * sum((mq_ret/sqrt(RVar))^3)
> [1] 0.09759751
> # this is output from base package function but this may not be appropriate to use for intraday data
> skewness(mq_ret)
> [1] 0.3035787
> __________________________________________________
> Darko Roupell
>
>
>
> ************** IMPORTANT MESSAGE *****************************
> This e-mail message is intended only for the addressee(s) and contains information which may be
> confidential.
> If you are not the intended recipient please advise the sender by return email, do not use or
> disclose the contents, and delete the message and any attachments from your system. Unless
> specifically indicated, this email does not constitute formal advice or commitment by the sender
> or the Commonwealth Bank of Australia (ABN 48 123 123 124) or its subsidiaries.
> We can be contacted through our web site: commbank.com.au.
> If you no longer wish to receive commercial electronic messages from us, please reply to this
> e-mail by typing Unsubscribe in the subject line.
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>

-- 
Patrick Burns
patrick at burns-stat.com
http://www.burns-stat.com
http://www.portfolioprobe.com/blog
twitter: @portfolioprobe



More information about the R-SIG-Finance mailing list