rlgt.control: Sets and initializes the control parameters

View source: R/rlgtcontrol.R

rlgt.controlR Documentation

Sets and initializes the control parameters

Description

This function initializes and sets the control parameters, i.e. hyperparameter values which control the prior distribution of the rlgtfit model. The purpose of this function is mainly to provide a default value for each of the hyperparameters. The function also accepts a customised set of values of the parameters as provided in the input of this function. This function is used in conjunction with the rlgt function.

Usage

rlgt.control(
  ADAPT_DELTA = 0.9,
  MAX_TREE_DEPTH = 12,
  NUM_OF_CHAINS = 4,
  NUM_OF_CORES = 4,
  ADD_JITTER = TRUE,
  CAUCHY_SD_DIV = 150,
  NUM_OF_ITER = 5000,
  MAX_NUM_OF_REPEATS = 2,
  MAX_RHAT_ALLOWED = 1.006,
  NUM_OF_SEASON_INIT_CYCLES = 3,
  MIN_NU = 2,
  MAX_NU = 20,
  MIN_POW_TREND = -0.5,
  MAX_POW_TREND = 1,
  POW_TREND_ALPHA = 1,
  POW_TREND_BETA = 1,
  POW_SEASON_ALPHA = 1,
  POW_SEASON_BETA = 1,
  MIN_SIGMA = 1e-10,
  MIN_VAL = 1e-30,
  MAX_VAL = 1e+38
)

Arguments

ADAPT_DELTA

Target Metropolis acceptance rate. See Stan manual. Suggested range is between (0.85-0.97).

MAX_TREE_DEPTH

NUTS maximum tree depth. See Stan manual for more details. Suggested range is between (10-15), defaut is 12.

NUM_OF_CHAINS

Number of MCMC chains. Suggested range is 3 to 4. Default is 4.

NUM_OF_CORES

Number of cores used for calculations. It can be smaller than NUM_OF_CHAINS, but for best computational speed, it should be equal to NUM_OF_CHAINS. Default is 4.

ADD_JITTER

Whether to add a very small amount (sd=min(y)*0.0001) of jitter to the input series. It is sometimes useful in cases of series with some perfectly flat sections. Default is TRUE.

CAUCHY_SD_DIV

Cauchy distribution is used for some parameters with non-obvious range. The error size hyperparameter of this distribution is calculated by dividing the max value of the time series by this constant. Suggested range is between (100,300). Default 150.

NUM_OF_ITER

Starting number of iterations for each chain. Suggested range is between (2000,10000). Default is 5000. Generally, the longer the series, the smaller is the value to reach convergence. Some models e.g. those with "innov" error size method are more difficult to fit and require more iterations.

MAX_NUM_OF_REPEATS

Maximum number of the sampling procedure repeats if the fit is unsatisfactorily, i.e. avgRHat>MAX_RHAT_ALLOWED. Each round will double the number of iterations which could potentially double the running time. Suggested range is between (2,4). Default is 2.

MAX_RHAT_ALLOWED

Maximum average value of Rhat's that suggests a good fit, i.e. the treshold below which the fit is considered as acceptable. Consult Stan's manual for more details on Rhat. Suggested range is between (1.005,1.02). Default is 1.006.

NUM_OF_SEASON_INIT_CYCLES

For seasonal models, number of seasonality periods used for establishing initial seasonality coefficients. Default is 3.

MIN_NU

Minimum degrees of freedom of the Student's distribution that is used in most models. Suggested range(1.2, 5). Default 2.

MAX_NU

Maximum degrees of freedom of the Student's distribution. Suggested range is between (15,30). Default 20.

MIN_POW_TREND

Minimum value of the global trend power coefficient. Suggested range is between (-1,0). Default -.5

MAX_POW_TREND

Maximum value of the global trend power coefficient. It should be 1 to allow the model to approach exponential growth when needed. Default is 1.

POW_TREND_ALPHA

Alpha parameter of Beta prior distribution. To make the forecast more upward curved, so to nudge it towards larger values, make the parameter larger. Suggested range is between (1,6) Default 1.

POW_TREND_BETA

Beta parameter of Beta prior distribution for the global trend power coefficient. 1 by default, see also above.

POW_SEASON_ALPHA

Alpha parameter of Beta distribution that is the prior of the power coefficient in the formula of the generalized seasonality in gSGT model. 1 by default, increasing it (say, to 3 or 5) will push the seasonality towards multiplicative behavior.

POW_SEASON_BETA

Beta parameter of Beta distribution that is the prior of the power coefficient in the formula of the generalized seasonality in gSGT model. 1 by default.

MIN_SIGMA

Minimum size of the fitted sigma, applied for numerical stability. Must be positive. 1e-10 by default.

MIN_VAL

Minimum value that forecast can take. Must be positive. 1e-30 by default.

MAX_VAL

Maximum value the forecast can take. 1e38 by default.

Value

list of control parameters


Rlgt documentation built on Sept. 11, 2024, 7:49 p.m.