News from ESGtoolkit, ycinterextra, and nnetsauce

[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.

In this post, I introduce new versions of ESGtoolkit, ycinterextra, and nnetsauce.

  • ESGtoolkit (for R) is a toolkit for Monte Carlo Simulation in Finance, Economics, Insurance, Physics, etc.
  • ycinterextra (for R) is used for yield curve interpolation and extrapolation
  • nnetsauce (for Python and R) does supervised Statistical/Machine Learning using Randomized and Quasi-Randomized neural networks

Contents

Feel free to jump directly to the section that has your interest:

1-ESGtoolkit

ESGtoolkit is no longer available from CRAN (archived). It can be installed from GitHub or from R universe.

installing ESGtoolkit

  • From Github:
library(devtools)
devtools::install_github("Techtonique/ESGtoolkit")
  • From R universe:
# Enable universe(s) by techtonique
options(repos = c(
  techtonique = 'https://techtonique.r-universe.dev',
  CRAN = 'https://cloud.r-project.org'))

# Install some packages
install.packages('ESGtoolkit')

news from ESGtoolkit

In version v0.4.0, spline interpolation (stats::spline) is used for forward rates’ computation in esgfwdrates. New (and only, so far) interpolation options are: “fmm”, “periodic”, “natural”, “hyman” (type ?stats::spline in R console for more details on each interpolation method).

Here is an example (in function simG2plus, and more specifically for methodyc, whose possible values are now “fmm”, “periodic”, “natural”, “hyman”) in which you can see how this new choices will affect the simulation results.

G2++ simulations

2-ycinterextra

ycinterextra is no longer available from CRAN (archived). It can be installed from GitHub or from R universe.

installing ycinterextra

  • From Github:
devtools::install_github("Techtonique/ycinterextra")
  • From R universe:
# Enable universe(s) by techtonique
options(repos = c(
  techtonique = 'https://techtonique.r-universe.dev',
  CRAN = 'https://cloud.r-project.org'))

# Install some packages
install.packages('ycinterextra')

news from ycinterextra

In version 0.2.0

  • Rename function as.list to a tolist doing the same thing. ycinterextra::as.list was notably causing bugs in Shiny applications
  • Refactor the code, to make it more readable

3-nnetsauce

installing nnetsauce

Python version:

  • 1st method: by using pip at the command line for the stable version
pip install nnetsauce
  • 2nd method: using conda (Linux and macOS only for now)
conda install -c conda-forge nnetsauce 
  • 3rd method: from Github, for the development version
pip install git+https://github.com/Techtonique/nnetsauce.git

R version:

library(devtools)
devtools::install_github("Techtonique/nnetsauce/R-package")
library(nnetsauce)

news from nnetsauce

In version 0.11.3:

  • Implementation of a RandomBagRegressor; an ensemble of CustomRegressors in which diversity is achieved by sampling the columns and rows of an input dataset. A Python example can be found here on GitHub.

  • In MTS class (univariate and multivariate time series forecasting), no more lower and upper bounds of prediction intervals. Only standard deviation is returned when return_std is set to True (see Python example below for more details).

  • Use of pandas DataFrames in Python, for MTS (see Python example below for details)

# Using a data frame input for forecasting with `MTS`

import nnetsauce as ns
import pandas as pd
from sklearn import linear_model


dataset = {
'date' : ['2001-01-01', '2002-01-01', '2003-01-01', '2004-01-01', '2005-01-01'],
'series1' : [34, 30, 35.6, 33.3, 38.1],    
'series2' : [4, 5.5, 5.6, 6.3, 5.1],
'series3' : [100, 100.5, 100.6, 100.2, 100.1]}
df = pd.DataFrame(dataset).set_index('date')
print(df)

# Adjust Bayesian Ridge and predict
regr5 = linear_model.BayesianRidge()
obj_MTS = ns.MTS(regr5, lags = 1, n_hidden_features=5)
obj_MTS.fit(df)
print(obj_MTS.predict())

# with credible intervals
print(obj_MTS.predict(return_std=True, level=80))
print(obj_MTS.predict(return_std=True, level=95))

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.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)