Skip to contents

Convert percent per year trend to cumulative trend

Usage

convert_ppy_to_cumulative(x, n_years)

Arguments

x

numeric; percent per year trend on the 0-100 scale rather than the 0-1 scale.

n_years

integer; number of years.

Value

A numeric vector of the same length as x that contains the cumulative trend resulting from n_years years of compounding annual trend.

Examples

ppy_trend <- runif(100, min = -100, 100)
cumulative_trend <- convert_ppy_to_cumulative(ppy_trend, n_years = 5)
cbind(ppy_trend, cumulative_trend)
#>          ppy_trend cumulative_trend
#>   [1,]  26.5237797       224.235667
#>   [2,] -78.7290758       -99.956456
#>   [3,]  37.0308294       383.160512
#>   [4,]  99.9613629      3096.910224
#>   [5,] -60.5870956       -99.048974
#>   [6,] -65.7462530       -99.528436
#>   [7,] -66.6408817       -99.586883
#>   [8,]  93.1104965      2585.526253
#>   [9,] -27.6598451       -80.189421
#>  [10,] -49.0065226       -96.551953
#>  [11,] -72.5135942       -99.843112
#>  [12,] -62.3086964       -99.239313
#>  [13,]  67.5481140      1220.376291
#>  [14,] -98.5543832      -100.000000
#>  [15,] -21.6235981       -70.424874
#>  [16,]  49.5139800       647.152082
#>  [17,]  78.0171083      1687.757918
#>  [18,] -37.4275029       -90.407817
#>  [19,] -76.0853987       -99.921780
#>  [20,]  16.0109404       110.133230
#>  [21,]   4.9255232        27.176163
#>  [22,] -31.6596431       -85.093139
#>  [23,] -98.7014870      -100.000000
#>  [24,]  52.0246697       712.026762
#>  [25,]  23.2525141       184.432313
#>  [26,]  28.6719997       252.712013
#>  [27,]  82.5191530      1925.546527
#>  [28,] -82.3117551       -99.982685
#>  [29,] -28.0494563       -80.717187
#>  [30,] -47.2478580       -95.914921
#>  [31,]  18.3742505       132.426805
#>  [32,] -97.3313568       -99.999999
#>  [33,]  24.4785105       198.862837
#>  [34,] -59.1507802       -98.862585
#>  [35,]   3.2270633        17.210862
#>  [36,]  88.5309670      2281.844887
#>  [37,]  86.9456285      2183.371470
#>  [38,] -18.6704147       -64.416981
#>  [39,] -12.7653876       -49.482229
#>  [40,] -70.8498831       -99.789525
#>  [41,] -33.4829047       -86.978339
#>  [42,] -20.7052394       -68.651089
#>  [43,] -69.0053591       -99.713956
#>  [44,]  92.0461348      2512.328892
#>  [45,]  82.8205821      1942.327742
#>  [46,] -50.1079920       -96.908602
#>  [47,] -51.3973860       -97.287947
#>  [48,]  82.6365235      1932.067636
#>  [49,]  79.8070486      1779.462055
#>  [50,] -37.4815181       -90.449148
#>  [51,]  82.5406853      1926.741607
#>  [52,] -39.6010438       -91.962015
#>  [53,] -63.6699866       -99.367111
#>  [54,]  61.6571397      1004.013670
#>  [55,] -50.4581128       -97.015561
#>  [56,]  75.0888617      1545.479955
#>  [57,]  31.6975001       296.175538
#>  [58,] -24.0338038       -74.701085
#>  [59,] -81.7176180       -99.979575
#>  [60,]  26.9031846       229.126312
#>  [61,]  -4.8496712       -22.007747
#>  [62,] -53.2877808       -97.775909
#>  [63,] -65.6208901       -99.519744
#>  [64,]  71.7607693      1394.926645
#>  [65,] -47.6182770       -96.056345
#>  [66,]  64.2411353      1095.114984
#>  [67,] -35.0734280       -88.462483
#>  [68,] -85.2128339       -99.992930
#>  [69,]  14.4770744        96.604118
#>  [70,]  33.2304805       319.776353
#>  [71,]  72.6926422      1435.922035
#>  [72,] -91.9113623       -99.999654
#>  [73,]  23.6590130       189.153784
#>  [74,] -59.7943409       -98.949404
#>  [75,] -77.2165910       -99.938611
#>  [76,] -45.6508961       -95.257996
#>  [77,]  57.0508700       855.436291
#>  [78,]  27.5961604       238.211234
#>  [79,]  -6.0898502       -26.959680
#>  [80,]  65.3054437      1134.342770
#>  [81,]  -1.3583505        -6.609730
#>  [82,]  55.0320627       795.586683
#>  [83,]  40.7493845       452.373101
#>  [84,] -81.9888145       -99.981046
#>  [85,]  -3.7408039       -17.356034
#>  [86,] -83.0425453       -99.985978
#>  [87,] -65.6136450       -99.519237
#>  [88,] -33.6547709       -87.145698
#>  [89,] -85.5264190       -99.993648
#>  [90,]  99.3374145      3047.343215
#>  [91,] -73.3879390       -99.866527
#>  [92,]   0.8804244         4.480322
#>  [93,] -58.4314961       -98.758857
#>  [94,]  98.8942169      3012.510161
#>  [95,]  28.6094997       251.856229
#>  [96,]   2.3137241        12.116483
#>  [97,] -35.4352674       -88.780415
#>  [98,] -92.2750663       -99.999725
#>  [99,] -92.3839119       -99.999744
#> [100,]  19.5461488       144.161930