stan_Holt: Fitting an Holt state-space model.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/stan_models.R

Description

Fitting an Holt state-space model in Stan.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
stan_Holt(
  ts,
  damped = FALSE,
  xreg = NULL,
  genT = FALSE,
  chains = 4,
  iter = 2000,
  warmup = floor(iter/2),
  adapt.delta = 0.9,
  tree.depth = 10,
  stepwise = TRUE,
  prior_sigma0 = NULL,
  prior_level = NULL,
  prior_level1 = NULL,
  prior_trend = NULL,
  prior_trend1 = NULL,
  prior_damped = NULL,
  prior_breg = NULL,
  prior_df = NULL,
  series.name = NULL,
  ...
)

Arguments

ts

a numeric or ts object with the univariate time series.

damped

a boolean value to specify a damped trend local level model. By default is FALSE. If trend option is FALSE then damped is set to FALSE automatically.

xreg

Optionally, a numerical matrix of external regressors, which must have the same number of rows as ts. It should not be a data frame.

genT

a boolean value to specify for a generalized t-student SSM model.

chains

An integer of the number of Markov Chains chains to be run, by default 4 chains are run.

iter

An integer of total iterations per chain including the warm-up, by default the number of iterations are 2000.

warmup

A positive integer specifying number of warm-up (aka burn-in) iterations. This also specifies the number of iterations used for step-size adaptation, so warm-up samples should not be used for inference. The number of warmup should not be larger than iter and the default is iter/2.

adapt.delta

An optional real value between 0 and 1, the thin of the jumps in a HMC method. By default is 0.9.

tree.depth

An integer of the maximum depth of the trees evaluated during each iteration. By default is 10.

stepwise

If TRUE, will do stepwise selection (faster). Otherwise, it searches over all models. Non-stepwise selection can be very slow, especially for seasonal models.

prior_sigma0

The prior distribution for the scale parameter in an SSM model. By default the value is set NULL, then the default student(7,0,1) prior is used.

prior_level

The prior distribution for the level parameter in a SSM model. By default the value is set NULL, then the default normal(0,0.5) priors are used.

prior_level1

The prior distribution for the initial level parameter in a SSM model. By default the value is set NULL, then the default student(6,0,2.5) priors are used.

prior_trend

The prior distribution for the trend parameter in a SSM model. By default the value is set NULL, then the default normal(0,0.5) priors are used.

prior_trend1

The prior distribution for the initial trend parameter in a SSM model. By default the value is set NULL, then the default student(6,0,2.5) priors are used.

prior_damped

The prior distribution for the damped trend parameter in a SSM model. By default the value is set NULL, then the default normal(0,0.5) priors are used.

prior_breg

The prior distribution for the regression coefficient parameters in a ARMAX model. By default the value is set NULL, then the default student(7,0,1) priors are used.

prior_df

The prior distribution for the degree freedom parameters in a t-student innovations SSM model. By default the value is set NULL, then the default gamma(2,0.1) priors are used.

series.name

an optional string vector with the series names.

...

Further arguments passed to varstan function.

Details

The function returns a varstan object with the fitted model.

When genT option is TRUE a t-student innovations ssm model (see Ardia (2010)) is generated see Fonseca, et. al (2019) for more details.

The default priors used in a ssm( ) model are:

For changing the default prior use the function set_prior().

Value

A varstan object with the fitted SSM model.

Author(s)

Asael Alonzo Matamoros.

References

Fonseca, T. and Cequeira, V. and Migon, H. and Torres, C. (2019). The effects of degrees of freedom estimation in the Asymmetric GARCH model with Student-t Innovations. arXiv doi: arXiv: 1910.01398.

See Also

Sarima auto.arima set_prior garch

Examples

1
2
3
4
5
 # Declaring a Holt model for the ipc data.
 sf1 = stan_Holt(ipc,iter = 500,chains = 1)

 # Declaring a Holt damped trend model for the ipc data.
 sf2 = stan_Holt(ipc,damped = TRUE,iter = 500,chains = 1)

bayesforecast documentation built on June 17, 2021, 5:14 p.m.