cagr
Calculates the compound annual growth rate (CAGR). The traditional appraoch is to calculate the growth by considering the first value
and the last value, taking the ratio of them and annualizing them. Formula: (xn / n1) ^ (1 / number of years).
Since the standard appraoch ignores some intermediate values (for example last year was lousy, but previous years were successful
and should be merited), the CAGR can also be calculated using the average of the first n and last n values.
Indirect parameter passing is disabled
1-3
No. | Type | Description |
---|---|---|
1 input |
set | input values Set of numerals (blank strings are allowed and recognized as zero) to be used to calculate the CAGR |
Opt. 2 input |
numeral | Grouping Use the average of the first n and the last n values for the CAGR. This feature eliminates the limited focus on just the first and last value. If the set contains fewer values, then the grouping figure will be reduced anyway. Example: Grouping of 3 for parameter with 5 elements would overlap in the middle, therefore it will be reduced to 2 in order to compare first two and last two figures. Default value: 1 |
Opt. 3 input |
string | time base Accepts following three values: year, semesters, quarters, and months in order to identify wheter the values provided are on an annual, quarterly or monthly base. If quarter or month are chosen, then the compound avarage growth rate will be automatically adjusted to years. Default value: years |
Type | Description |
---|---|
numeral | CAGR result 0 if set provided contains 0 or 1 parameter only. |
Growth figure from zero yields mathematics error.
echo( cagr( { 1, 3, 2, 3, 4, 6, 8, 3 } ) ); // ca 17%. Ignores values in the middle
echo( cagr( { 1, 3, 2, 3, 4, 6, 8, 3 }, 3 ) ); // ca 23%, looks better now
echo( cagr( { 1, 1.2, 1.1, 1.2, 1.3 }, 1, quarters ) ); // 30% growth in 1 year
0.1699308128
0.2315712276
0.3