Share via

How do I find annualized standard deviation on 60 years of S&P data?

Anonymous
2010-07-05T05:37:04+00:00

Hi. I have a workbook that has about 60 years of data on the S&P 500. I designed a trading system and have the compounded results of the portfolio (day to day) from the beginning of the test to current. I am interested in finding the standard deviation of each calender year (ie Jan 1, 1960-January 1, 1961), then dividing it by the price on the first cell of the data (ie January 1, 1960). This will give me the annual percent standard deviation...then I want to average all 60 years of this answer and have it inputed in one cell.

Is there a formula I could use that would find the January 1sts and would do this calculation between each one then give me the average % standard deviation of all of them? I could just simply do the standard deviation of all 60 years of the portfolio, divide by the initial investment - 10,000, then divide it by 60 (years), but I would guess it would return a slightly different answer.

Thanks,

Stephen

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
  1. Anonymous
    2010-07-06T04:23:06+00:00

    The index is around 14% (don't know the exact) and I want to compare my systems to this standard deviation.

    Not sure where you are getting the historical number (index sd of 14%), but your method does not even come close.  (No big surprise; just making a point.)

    Or perhaps you are doing the right thing after all, and you merely miscommunicated the methodology, which led to my misunderstanding.

    You might want to look at http//www.investopedia.com/articles/04/021804.asp.  It states:  "When we calculate the volatility for the S&P 500 index  as of January 31, 2004, we get anywhere from 14.7% to 21.1%.  Why such a range?  Because we must choose both an interval and a historical period".

    Using their methodology, you would compute the standard deviation of the daily returns, then annualize it.  Note that they are indeed using an __annualized__ sd, not the average "annual" sd that you specified.

    For example, if the closing SP500 index values for 1950 through 2009 are in E2:E15099, define the name "close1s" for E2:E15098 and "close1e" for E3:E15099.

    (Note:  The named ranges should be absolute references prefixed by the sheet name.  Excel will do that for you if you define the names as I described previously in this thread.  I'm just too lazy to type them.)

    Then the (daily) sd of the daily (simple) returns is the array formula (remember:  ctrl+alt+Enter) =STDEVP(close1e/close1s).  And the annualized daily sd is the array formula =STDEVP(close1e/close1s)*SQRT(252).

    (Note that I use 252 instead of the 250 used in investopedia.com web page.  The average trade days per year is 251.6 between 1950 and 2009.  And 252 is divisible by 12.)

    For the 1950-2009 data, the daily sd is 0.97%, which is close to the 1.1% (for a different period) in the investopedia.com web page.  The annualized sd is 15.32%.

    For comparison, the annual sd computed by the daily year-over-year return is 16.49%.  That is computed by the array formula =STDEVP(close252e/close252s), where "close252s" is E2:E14847 and "close252e" is E254:E15099.

    But you might also want to look at http://www.riskglossary.com/link/volatility.htm.  It defines volatility in the "typical" fashion, namely:  the standard deviation of the log returns.

    Thus, the (daily) sd of the daily log returns is the array formula =STDEVP(LN(close1e/close1s)), and the annualized daily sd is the array formula =STDEVP(LN(close1e/close1s))*SQRT(252).

    In this case, the daily (log) sd appears to be about the same, 0.97%.  The annualized (log) sd is 15.38%.

    The sd of the year-over-year log returns is 16.10%, which is computed with the array formula =STDEVP(LN(close252e/close252s)).

    1 person found this answer helpful.
    0 comments No comments

11 additional answers

Sort by: Most helpful
  1. Anonymous
    2010-07-05T20:18:09+00:00

    Thanks for the replies.

    The column of cells I am looking at is the result of the stategy at the close of each day for about 60 years. It starts at 10,000 and has a different result each day depending on the accumulated gain of the strategy and ends with the final number after about 60 years. Question:

    1. I noticed in your example it had open, low, high, and close....as I just have the closing result of the portfolio value for each day would I just need to the e2-h2 formulas you listed above. Also, since it is daily not yearly, do I just copy this down for the approximate 13000 rows of data?

    (I believe Yahoo has from 1950-present for S&P 500 data...that is what I used)

    My overall purpose for this question is to determine the risk of my system vs. the risk of the S&P 500. I believe the annual standard deviation (is this how you would say that?) for the S&P 500 is around 14%, I want to find out the SD of my system so I can compare the two. Just in case it was unclear, I wanted to share that.

    Thanks,

    Stephen

    0 comments No comments
  2. Anonymous
    2010-07-05T19:50:01+00:00

    PS....

    StephenBB wrote:

    I could just simply do the standard deviation of all 60 years of the portfolio, divide by the initial investment - 10,000

    So your data is probably "total return" for some frequency (daily, weekly, monthly, etc), not the open, high, low and close of the S&P 500 index.

    That should not substantially affect your understanding of the formulas that I suggested.  It just simplifies some things.  But to be clear, the formulas are:

    B2, open:      =INDEX(val,MATCH(MIN(IF(YEAR(tdate)=A2,tdate)),tdate,0),1)

    C2, low:        =MIN(IF(YEAR(tdate)=A2,val))

    D2, high:       =MAX(IF(YEAR(tdate)=A2,val))

    E2, close:      =INDEX(val,MATCH(MAX(IF(YEAR(tdate)=A2,tdate)),tdate,0),1)

    F2, mean:      =AVERAGE(IF(YEAR(tdate)=A2,val))

    G2, stdev:     =STDEVP(IF(YEAR(tdate)=A2,val))

    H2, %stdev:  =G2/F2

    Where "val" is the name of the column of data corresponding to the dates in the column named "tdate".

    See my previous posting about entering the array formulas in B2:G2.

    0 comments No comments
  3. Anonymous
    2010-07-05T18:53:03+00:00

    StephenBB wrote:

    I have a workbook that has about 60 years of data on the S&P 500.

    [....] I am interested in finding the standard deviation of each calender year (ie Jan 1, 1960-January 1, 1961), then dividing it by the price on the first cell of the data (ie January 1, 1960). This will give me the annual percent standard deviation...then I want to average all 60 years of this answer and have it inputed in one cell.

    First, what you describe here is an __annual__ standard deviation as you wrote, not an "annualized" standard deviation as you wrote in the subject line.  I will assume that your description here is what you truly want.  It is a more reliable statistic.

    Second, I quibble with the way in which you compute the (annual) "percent standard deviation".  That is not how "relative standard deviation" (aka "percent relative standard deviation") is normally computed.  It is unclear whether you truly want to compute a different statistic (of dubious value), or you misunderstand the statistic.

    To answer your question....

    Suppose the dates corresponding to the S&P 500 values are in a column named "tdate".  For completeness, I will assume you have columns of S&P 500 values which you can name "open", "high", "low" and "close".  Finally, suppose A2:A61 contains the year numbers (not dates) 1950 through 2009.

    (By the way, where did you get so much data?  Finance.yahoo.com provides only 48 years of SP500 data, 1962 through present day.)

    Some of the following formulas might be useful to you, either directly or as paradigms for whatever you need.  Put the following formulas into the indicated cells and copy down through row 61.

    B2, open:      =INDEX(open,MATCH(MIN(IF(YEAR(tdate)=A2,tdate)),tdate,0),1)

    C2, low:        =MIN(IF(YEAR(tdate)=A2,low))

    D2, high:       =MAX(IF(YEAR(tdate)=A2,high))

    E2, close:      =INDEX(close,MATCH(MAX(IF(YEAR(tdate)=A2,tdate)),tdate,0),1)

    F2, mean:     =AVERAGE(IF(YEAR(tdate)=A2,(high+low)/2))

    G2, stdev:     =STDEVP(IF(YEAR(tdate)=A2,(high+low)/2))

    H2, %stdev:  =G2/F2

    Format H2 as Percentage.

    All formulas except H2 are array formulas.  Enter an array formula by pressing ctrl+shift+Enter instead of simply Enter.  Excel will display curly braces around the entire formula in the Formula Bar ({=formula}); but you should not type the curly braces yourself.  If you make a mistake, select the cell, press F2, edit as needed, then press ctrl+shift+Enter.

    Finally, the average %stdev is =AVERAGE(H2:H61), a non-array formula formatted as Percentage.

    Notes:

    1. The mean in F2 is the average "daily" average (i.e. the average high and low for whatever the frequency of your data is).  If you prefer the average close, for example, simply use AVERAGE(IF(YEAR(tdate)=A2,close).  Similarly for the standard deviation in G2.
    2. The standard deviation in G2 uses STDEVP instead of STDEV.  This is because the data in the matching range represents the entire data ("population"), not a sampling of data for that period.

    Note:  I think Excel 2010 uses different function names for STDEVP and STDEV.  I use Excel 2003.

    1. The %stdev in H2 is the statistic known as "relative standard deviation", to wit:  the ratio of the standard deviation to the average.  If you truly want the ratio of the standard deviation to the year's open value, simply use G2/B2.

    ----- original message -----

    Hi. I have a workbook that has about 60 years of data on the S&P 500. I designed a trading system and have the compounded results of the portfolio (day to day) from the beginning of the test to current. I am interested in finding the standard deviation of each calender year (ie Jan 1, 1960-January 1, 1961), then dividing it by the price on the first cell of the data (ie January 1, 1960). This will give me the annual percent standard deviation...then I want to average all 60 years of this answer and have it inputed in one cell.

    Is there a formula I could use that would find the January 1sts and would do this calculation between each one then give me the average % standard deviation of all of them? I could just simply do the standard deviation of all 60 years of the portfolio, divide by the initial investment - 10,000, then divide it by 60 (years), but I would guess it would return a slightly different answer.

    Thanks,

    Stephen

     

    0 comments No comments
  4. Anonymous
    2010-07-05T07:46:04+00:00

    Stephen,

    You could try this array formula

    =STDEV(IF(YEAR($A$2:$A$20)=2009,$B$2:$B$20))/MIN(IF(YEAR ($A$2:$A$20=2009),$B$2:$B$20))

    This is an array formula.

    This means that you use Ctrl-Shift-Enter to commit the formula, not just Enter (array Enter it). Excel will put curly brackets around the formula in the formula bar, you don't do this.

    If you need to change the formula at any time, you must array Enter it again.

    --

    HTH

    Bob

    <StephenBB> wrote in message news:*** Email address is removed for privacy *** .com...

    Hi. I have a workbook that has about 60 years of data on the S&P 500. I designed a trading system and have the compounded results of the portfolio (day to day) from the beginning of the test to current. I am interested in finding the standard deviation of each calender year (ie Jan 1, 1960-January 1, 1961), then dividing it by the price on the first cell of the data (ie January 1, 1960). This will give me the annual percent standard deviation...then I want to average all 60 years of this answer and have it inputed in one cell.

    Is there a formula I could use that would find the January 1sts and would do this calculation between each one then give me the average % standard deviation of all of them? I could just simply do the standard deviation of all 60 years of the portfolio, divide by the initial investment - 10,000, then divide it by 60 (years), but I would guess it would return a slightly different answer.

    Thanks,

    Stephen

     

    0 comments No comments