loocvridge2f: LOOCV for Ridge2 model

View source: R/loocvridge2.R

loocvridge2fR Documentation

LOOCV for Ridge2 model

Description

LOOCV for Random Vector functional link network model with 2 regularization parameters

Usage

loocvridge2f(
  y,
  xreg = NULL,
  h = 5,
  level = 95,
  lags = 1,
  nb_hidden = 5,
  nodes_sim = c("sobol", "halton", "unif"),
  activ = c("relu", "sigmoid", "tanh", "leakyrelu", "elu", "linear"),
  a = 0.01,
  lambda_1 = 0.1,
  lambda_2 = 0.1,
  dropout = 0,
  type_forecast = c("recursive", "direct"),
  type_pi = c("gaussian", "bootstrap", "blockbootstrap", "movingblockbootstrap",
    "rvinecopula", "splitconformal"),
  block_length = NULL,
  margins = c("gaussian", "empirical", "student"),
  seed = 1,
  B = 100L,
  type_aggregation = c("mean", "median"),
  centers = NULL,
  type_clustering = c("kmeans", "hclust"),
  ym = NULL,
  cl = 1L,
  show_progress = TRUE,
  ...
)

Arguments

y

A multivariate time series of class ts (preferred) or a matrix

xreg

External regressors. A data.frame (preferred) or a matrix

h

Forecasting horizon

level

Confidence level for prediction intervals

lags

Number of lags

nb_hidden

Number of nodes in hidden layer

nodes_sim

Type of simulation for nodes in the hidden layer

activ

Activation function

a

Hyperparameter for activation function "leakyrelu", "elu"

lambda_1

Regularization parameter for original predictors

lambda_2

Regularization parameter for transformed predictors

dropout

dropout regularization parameter (dropping nodes in hidden layer)

type_forecast

Recursive or direct forecast

type_pi

Type of prediction interval currently "gaussian", "bootstrap", "blockbootstrap", "movingblockbootstrap", "splitconformal" (very experimental right now), "rvinecopula" (with Gaussian margins for now, Student-t coming soon)

block_length

Length of block for circular or moving block bootstrap

margins

Distribution of margins: "gaussian", "empirical", "student" (postponed or never) for type_pi == "rvinecopula"

seed

Reproducibility seed for random stuff

B

Number of bootstrap replications or number of simulations (yes, 'B' is unfortunate)

type_aggregation

Type of aggregation, ONLY for bootstrapping; either "mean" or "median"

centers

Number of clusters for type_clustering

type_clustering

"kmeans" (K-Means clustering) or "hclust" (Hierarchical clustering)

ym

Univariate time series (stats::ts) of yield to maturities with frequency = frequency(y) and start = tsp(y)[2] + 1 / frequency(y). Default is NULL.

cl

An integer; the number of clusters for parallel execution, for bootstrap

show_progress

A boolean; show progress bar for bootstrapping? Default is TRUE.

...

Additional parameters to be passed to kmeans or hclust

Value

An object of class "mtsforecast"; a list containing the following elements:

method

The name of the forecasting method as a character string

mean

Point forecasts for the time series

lower

Lower bound for prediction interval

upper

Upper bound for prediction interval

sims

Model simulations for bootstrapping (basic, or block)

x

The original time series

residuals

Residuals from the fitted model

coefficients

Regression coefficients for type_pi == 'gaussian' for now

Author(s)

T. Moudiki

References

Moudiki, T., Planchet, F., & Cousin, A. (2018). Multiple time series forecasting using quasi-randomized functional link neural networks. Risks, 6(1), 22.

Examples


require(fpp)

print(ahead::loocvridge2f(fpp::insurance))
print(ahead::loocvridge2f(fpp::usconsumption))

#foo <- function(xx) ahead::loocvridge2f(fpp::insurance, lambda_1=10^xx[1], lambda_2=10^xx[2])
#(opt <- stats::nlminb(objective=foo, lower=c(-10,-10), upper=c(10,10), start=c(0, 0)))
#print(ahead::loocvridge2f(fpp::insurance, lambda_1=10^opt$par[1], lambda_2=10^opt$par[2]))


Techtonique/ahead documentation built on Nov. 24, 2024, 10:33 a.m.