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