![]() |
Geo average
How can I calculate the avg. of %-changes, when they include negative
numbers? Geomean does not work with negative numbers. Simple "average" func. does not produce a theoretical correct number when negative numbers are involved. |
On Mon, 17 Jan 2005 09:07:05 -0800, "Stephen"
wrote: How can I calculate the avg. of %-changes, when they include negative numbers? Geomean does not work with negative numbers. Simple "average" func. does not produce a theoretical correct number when negative numbers are involved. See my answer to your previous post --ron |
Stephen wrote...
How can I calculate the avg. of %-changes, when they include negative numbers? Geomean does not work with negative numbers. Simple "average" func. does not produce a theoretical correct number when negative numbers are involved. You should NEVER average percentage changes. You should convert percentage changes to multiplicative factors and average them. If ANY percentage changes are <= -100%, your geometric mean of percentage changes is meaningless. So, given +5%, +10%, -3%, +6%, -5%, convert these to 1.05, 1.10, 0.97, 1.06 and 0.95, and calculate the geometric mean (1.0205, rounded), then subtract 1 from it to give the geometric average percentage change, +2.05%. The best numerical approach to averaging a range of percentage changes (RPC) would be the array formula =EXP(AVERAGE(LN(RPC))) This avoids problems arising from the shortsighted implementation of GEOMEAN in Excel, basically, PRODUCT(RPC)^(1/COUNT(RPC)), which suffers from overflow and underflow. |
Stephen wrote...
How can I calculate the avg. of %-changes, when they include negative numbers? Geomean does not work with negative numbers. Simple "average" func. does not produce a theoretical correct number when negative numbers are involved. You should NEVER average percentage changes. You should convert percentage changes to multiplicative factors and average them. If ANY percentage changes are <= -100%, your geometric mean of percentage changes is meaningless. So, given +5%, +10%, -3%, +6%, -5%, convert these to 1.05, 1.10, 0.97, 1.06 and 0.95, and calculate the geometric mean (1.0205, rounded), then subtract 1 from it to give the geometric average percentage change, +2.05%. The best numerical approach to averaging a range of percentage changes (RPC) would be the array formula =EXP(AVERAGE(LN(1+RPC))) This avoids problems arising from the shortsighted implementation of GEOMEAN in Excel, basically, PRODUCT(RPC)^(1/COUNT(RPC)), which suffers from overflow and underflow. |
Harlan Grove wrote...
.... =EXP(AVERAGE(LN(RPC))) .... Disregard. Forgot to add 1. |
On 17 Jan 2005 09:33:45 -0800, "Harlan Grove" wrote:
This avoids problems arising from the shortsighted implementation of GEOMEAN in Excel, basically, PRODUCT(RPC)^(1/COUNT(RPC)), which suffers from overflow and underflow. I was not aware of that issue. Thank you for pointing it out. Does it become a problem in averaging stock return percentages? --ron |
Thanks alot - is there any way I can modify the expression to allow for
blanks or zeros in the array I am chosing the percentrage chg. from? "Harlan Grove" wrote: Stephen wrote... How can I calculate the avg. of %-changes, when they include negative numbers? Geomean does not work with negative numbers. Simple "average" func. does not produce a theoretical correct number when negative numbers are involved. You should NEVER average percentage changes. You should convert percentage changes to multiplicative factors and average them. If ANY percentage changes are <= -100%, your geometric mean of percentage changes is meaningless. So, given +5%, +10%, -3%, +6%, -5%, convert these to 1.05, 1.10, 0.97, 1.06 and 0.95, and calculate the geometric mean (1.0205, rounded), then subtract 1 from it to give the geometric average percentage change, +2.05%. The best numerical approach to averaging a range of percentage changes (RPC) would be the array formula =EXP(AVERAGE(LN(1+RPC))) This avoids problems arising from the shortsighted implementation of GEOMEAN in Excel, basically, PRODUCT(RPC)^(1/COUNT(RPC)), which suffers from overflow and underflow. |
Stephen wrote...
Thanks alot - is there any way I can modify the expression to allow for blanks or zeros in the array I am chosing the percentrage chg. from? .... Excluding blanks or text is OK, but zeros in the context of percentage changes are legitimate values meaning NO CHANGE or period T value equals period T+1 value. For this reason I won't help you exclude zeros because you'd wind up with misstated (therefore, misleading) averages. As for including only the numbers in RPC, use the array formula =EXP(AVERAGE(IF(ISNUMBER(RPC),LN(1+RPC))))-1 |
Ron Rosenfeld wrote...
On 17 Jan 2005 09:33:45 -0800, "Harlan Grove" wrote: This avoids problems arising from the shortsighted implementation of GEOMEAN in Excel, basically, PRODUCT(RPC)^(1/COUNT(RPC)), which suffers from overflow and underflow. I was not aware of that issue. Thank you for pointing it out. Does it become a problem in averaging stock return percentages? This is a problem only when averaging a large number of large or small positive numbers. So probably not a problem for averaging stock return precentages for a few stocks over a few years. However, I won't use GEOMEAN for anything, and I post what I use. |
On 17 Jan 2005 11:11:21 -0800, "Harlan Grove" wrote:
This is a problem only when averaging a large number of large or small positive numbers. So probably not a problem for averaging stock return precentages for a few stocks over a few years. However, I won't use GEOMEAN for anything, and I post what I use. Good advice --ron |
However, I won't use GEOMEAN for anything
Could you explain your reasons? |
Myrna Larson wrote...
However, I won't use GEOMEAN for anything Could you explain your reasons? I use some datasets with large numbers of large or small numbers (sometimes I look at X, sometimes at 1/X). These are the sorts of datasets which generate overflow or underflow errors when one applies the simplistic algorithm for geometric means which Excel's GEOMEAN uses. I'm lazy, so I generally stick to one way of doing most tasks so they become second nature. In order to avoid this particular problem, I always use EXP(AVERAGE(LN(.))), so I don't get nasty surprises when I get lazy. By the same token, I also use DEVSQ(.)/COUNT(.) rather than VARP all the time since Jerry W. Lewis clued me into that. I don't know about you, but if I know some functions have problems in extreme cases, I avoid them in all cases. Makes my life easier. |
Hi again,
The formula you advised did wonders. Thanks so much. Now I want to allow for assigning different weights to the percentage changes....can this be done in one formula? I have a collumn with the weights beside the percentage changes. Thanks, Stephen "Harlan Grove" wrote: Stephen wrote... Thanks alot - is there any way I can modify the expression to allow for blanks or zeros in the array I am chosing the percentrage chg. from? .... Excluding blanks or text is OK, but zeros in the context of percentage changes are legitimate values meaning NO CHANGE or period T value equals period T+1 value. For this reason I won't help you exclude zeros because you'd wind up with misstated (therefore, misleading) averages. As for including only the numbers in RPC, use the array formula =EXP(AVERAGE(IF(ISNUMBER(RPC),LN(1+RPC))))-1 |
"Stephen" wrote...
The formula you advised did wonders. Thanks so much. Now I want to allow for assigning different weights to the percentage changes.... can this be done in one formula? I have a collumn with the weights beside the percentage changes. .... If the range of weights were named W and were the same size and shape as RPC, try the array formula =EXP(SUM(IF(ISNUMBER(RPC),(1+RPC)*W))/SUM(IF(ISNUMBER(RPC),W))-1 |
Harlan Grove wrote...
.... =EXP(SUM(IF(ISNUMBER(RPC),(1+RPC)*W))/SUM(IF(ISNUMBER(RPC),W))-1 I screwed up and forgot the LN call. Make that =EXP(SUM(IF(ISNUMBER(RPC),LN(1+RPC)*W))/SUM(IF(ISNUMBER(RPC),W))-1 |
Harlan Grove wrote...
.... =EXP(SUM(IF(ISNUMBER(RPC),(1+RPC)*W))/SUM(IF(ISNUMBER(RPC),W))-1 .... This'll teach me not to test. Also missing a right parenthesis. It should be =EXP(SUM(IF(ISNUMBER(RPC),LN(1+RPC)*W))/SUM(IF(ISNUMBER(RPC),W)))-1 This time I made sure it works. |
Thanks for the insights. It's a function I haven't used enough to hit the
bugs. On 17 Jan 2005 16:45:35 -0800, "Harlan Grove" wrote: Myrna Larson wrote... However, I won't use GEOMEAN for anything Could you explain your reasons? I use some datasets with large numbers of large or small numbers (sometimes I look at X, sometimes at 1/X). These are the sorts of datasets which generate overflow or underflow errors when one applies the simplistic algorithm for geometric means which Excel's GEOMEAN uses. I'm lazy, so I generally stick to one way of doing most tasks so they become second nature. In order to avoid this particular problem, I always use EXP(AVERAGE(LN(.))), so I don't get nasty surprises when I get lazy. By the same token, I also use DEVSQ(.)/COUNT(.) rather than VARP all the time since Jerry W. Lewis clued me into that. I don't know about you, but if I know some functions have problems in extreme cases, I avoid them in all cases. Makes my life easier. |
Myrna Larson wrote...
Thanks for the insights. It's a function I haven't used enough to hit the bugs. If you want to model individual's annual incomes with a lognormal distribution and you have a sample of 100 individuals' incomes in whole US$s, you'll hit this bug (100 * ~5E4 - ~5E400 Excel's FP max). |
All times are GMT +1. The time now is 04:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com