utils::install.packages("remotes", repos="https://cloud.r-project.org", quiet = TRUE)
remotes::install_github("Techtonique/esgtoolkit")
## Using github PAT from envvar GITHUB_PAT. Use `gitcreds::gitcreds_set()` and unset GITHUB_PAT in .Renviron (or elsewhere) if you want to use the more secure git credential store instead.
## Downloading GitHub repo Techtonique/esgtoolkit@HEAD
## stringi (NA -> 1.8.4 ) [CRAN]
## utf8 (NA -> 1.2.4 ) [CRAN]
## pkgconfig (NA -> 2.0.3 ) [CRAN]
## pillar (NA -> 1.9.0 ) [CRAN]
## colorspace (NA -> 2.1-1 ) [CRAN]
## viridisLite (NA -> 0.4.2 ) [CRAN]
## RColorBrewer (NA -> 1.1-3 ) [CRAN]
## munsell (NA -> 0.5.1 ) [CRAN]
## labeling (NA -> 0.4.3 ) [CRAN]
## farver (NA -> 2.1.2 ) [CRAN]
## rngWELL (NA -> 0.10-10) [CRAN]
## ADGofTest (NA -> 0.3 ) [CRAN]
## mvtnorm (NA -> 1.3-1 ) [CRAN]
## stringr (NA -> 1.5.1 ) [CRAN]
## plyr (NA -> 1.8.9 ) [CRAN]
## gtable (NA -> 0.3.6 ) [CRAN]
## tibble (NA -> 3.2.1 ) [CRAN]
## scales (NA -> 1.3.0 ) [CRAN]
## isoband (NA -> 0.2.7 ) [CRAN]
## randtoolbox (NA -> 2.0.5 ) [CRAN]
## VineCopula (NA -> 2.5.1 ) [CRAN]
## reshape2 (NA -> 1.4.4 ) [CRAN]
## gridExtra (NA -> 2.3 ) [CRAN]
## ggplot2 (NA -> 3.5.1 ) [CRAN]
## Installing 24 packages: stringi, utf8, pkgconfig, pillar, colorspace, viridisLite, RColorBrewer, munsell, labeling, farver, rngWELL, ADGofTest, mvtnorm, stringr, plyr, gtable, tibble, scales, isoband, randtoolbox, VineCopula, reshape2, gridExtra, ggplot2
## Installing packages into '/tmp/Rtmp82spAs/Rinst3a34deb5d2a'
## (as 'lib' is unspecified)
## Running `R CMD build`...
## * checking for file ‘/tmp/Rtmpb0zWmE/remotes4596a5efce6/Techtonique-esgtoolkit-9b0c602/DESCRIPTION’ ... OK
## * preparing ‘esgtoolkit’:
## * checking DESCRIPTION meta-information ... OK
## * cleaning src
## * checking for LF line-endings in source and make files and shell scripts
## * checking for empty or unneeded directories
## NB: this package now depends on R (>= 3.5.0)
## WARNING: Added dependency on R >= 3.5.0 because serialized objects in
## serialize/load version 3 cannot be read in older versions of R.
## File(s) containing such objects:
## ‘esgtoolkit/vignettes/g2plus_cache/html/unnamed-chunk-8_d22852b4b99a208e5ff82d93631204e2.RData’
## ‘esgtoolkit/vignettes/g2plus_cache/html/unnamed-chunk-8_d22852b4b99a208e5ff82d93631204e2.rdx’
## * building ‘esgtoolkit_1.1.2.tar.gz’
## Installing package into '/tmp/Rtmp82spAs/Rinst3a34deb5d2a'
## (as 'lib' is unspecified)
suppressPackageStartupMessages({
library(esgtoolkit)
library(simulatetimeseries)
})
simulate_bsg2plus
require(esgtoolkit)
sims <- simulatetimeseries::simulate_bsg2plus(t0=1L, n=100L,
horizon = 10L)
par(mfrow=c(1,2))
plot(sims$maturities,
sims$initial_discount_bonds,
type="l",
main="Discount bonds prices",
xlab="Maturity", ylab="Prices")
plot(sims$maturities,
sims$initial_zero_rates,
type="l",
main="Discount rates",
xlab="Maturity", ylab="Rates")
par(mfrow=c(1,2))
esgtoolkit::esgplotbands(sims$discount_bond_prices, main="Discount bond prices (at t=1)", xlab="Maturity", ylab="Prices")
esgtoolkit::esgplotbands(window(sims$discount_rates, start=2), main="Discount rates (at t=1)", xlab="Maturity", ylab="Rates")
par(mfrow=c(1,2))
esgtoolkit::esgplotbands(sims$asset_price,
main="Asset prices",
xlab="Horizon", ylab="Prices")
esgtoolkit::esgplotbands(sims$short_rate,
main="Short rates",
xlab="Horizon", ylab="Rates")