[This article was first published on T. Moudiki's Webpage - R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
esgtoolkit version v1.1.0
Disclaimer: I’ve used Quarto to generate this post, on a (Ubuntu Linux) machine that already had R installed.
Install package
pip install esgtoolkit pip install jupyter import numpy as np import pandas as pd import seaborn as sns from esgtoolkit import simdiff, simshocks, esgplotbands from time import time # GBM print(" - Geometric Brownian Motion with input shock: ----------------- \n") start = time() eps0 = simshocks(n = 10, horizon = 5, frequency = "quarterly", seed=13) sim_GBM = simdiff(n = 10, horizon = 5, frequency = "quarterly", model = "GBM", x0 = 100, theta1 = 0.03, theta2 = 0.1, eps = eps0) print(f"Time taken: {time() - start}") print(sim_GBM) - Geometric Brownian Motion with input shock: ----------------- Time taken: 0.004328727722167969 Series 1 Series 2 Series 3 Series 4 Series 5 Series 6 \ 0.00 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 0.25 103.454979 101.956609 101.133073 94.475589 100.244989 98.786559 0.50 102.654906 112.460886 110.188097 96.496339 102.385258 102.492172 0.75 112.886299 115.206435 114.064448 96.386361 97.054726 95.068583 1.00 114.662968 110.024723 124.429289 92.774201 88.383140 96.347981 1.25 122.165101 114.201486 122.309546 98.206449 95.331175 95.677369 1.50 125.511793 115.778865 118.688216 94.376833 95.534048 93.892757 1.75 134.306574 108.306610 113.475059 92.282166 98.038320 100.441304 2.00 136.757466 98.481036 103.641963 98.358521 93.454057 103.278180 2.25 135.123598 93.997305 105.747022 104.800696 101.883088 103.890307 2.50 143.695591 91.204928 114.173285 104.202724 107.800189 113.662872 2.75 136.902284 91.739074 116.468844 99.310188 110.556223 109.525891 3.00 140.979002 96.311551 121.711082 99.626263 108.147813 119.607825 3.25 132.530357 95.074775 120.355412 97.694078 102.417748 114.367064 3.50 121.542060 93.185125 117.847286 89.363048 96.264051 110.506563 3.75 119.643633 92.497056 119.983915 90.406402 90.245912 110.917510 4.00 119.231891 90.300205 118.951552 85.772319 89.658624 110.986348 4.25 128.655956 89.366542 114.771418 94.180926 84.858749 116.546428 4.50 130.115822 88.847329 120.363700 92.900846 86.308649 121.742365 4.75 130.184550 85.629574 130.445114 95.574373 87.142176 124.914620 5.00 135.682055 82.593599 135.936293 98.363391 91.525969 124.534089 Series 7 Series 8 Series 9 Series 10 0.00 100.000000 100.000000 100.000000 100.000000 0.25 107.521866 102.348972 100.949160 97.990714 0.50 110.681157 97.246611 107.375117 101.785448 0.75 110.911899 92.661609 105.781405 92.336489 1.00 111.209495 84.396236 109.985201 92.018360 1.25 104.625881 86.772149 114.009257 93.490594 1.50 104.229700 95.096738 109.210712 88.220991 1.75 103.651073 88.414156 111.465709 89.709708 2.00 103.999695 87.394462 112.329965 88.929610 2.25 99.388953 80.781602 117.645437 84.936292 2.50 95.771344 76.738284 110.914729 89.041692 2.75 100.543861 66.981236 128.192181 94.201157 3.00 101.800514 73.434320 126.785558 96.875158 3.25 104.516113 69.491231 134.165204 99.775879 3.50 110.135072 68.837380 155.407720 95.034869 3.75 121.181232 69.027246 162.989689 98.596933 4.00 120.852696 66.611100 189.426959 99.295934 4.25 119.247152 67.861187 193.981618 103.665617 4.50 124.406121 60.036808 186.553021 111.022297 4.75 131.331886 60.426209 195.536293 107.700006 5.00 123.866484 68.372526 191.971234 107.989511 isinstance(sim_GBM, pd.DataFrame) True sim_GBM.plot(kind = 'line', legend = False)
To leave a comment for the author, please follow the link and comment on their blog: T. Moudiki's Webpage - R.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.