stan_SVM: Fitting a Stochastic volatility model.

View source: R/stan_models.R

stan_SVMR Documentation

Fitting a Stochastic volatility model.

Description

Fitting a Stochastic Volatility model (SVM) in Stan.

Usage

stan_SVM(
  ts,
  arma = c(0, 0),
  xreg = NULL,
  chains = 4,
  iter = 2000,
  warmup = floor(iter/2),
  adapt.delta = 0.9,
  tree.depth = 10,
  prior_mu0 = NULL,
  prior_sigma0 = NULL,
  prior_ar = NULL,
  prior_ma = NULL,
  prior_alpha = NULL,
  prior_beta = NULL,
  prior_breg = NULL,
  series.name = NULL,
  ...
)

Arguments

ts

a numeric or ts object with the univariate time series.

arma

Optionally, a specification of the ARMA model,same as order parameter: the two components (p, q) are the AR order,and the MA order.

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.

chains

an integer of the number of Markov Chains chains to be run. By default, chains = 4.

iter

an integer of total iterations per chain including the warm-up. By default, iter = 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 iteration should not be larger than iter.By default, warmup = 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.

prior_mu0

The prior distribution for the location parameter in an ARIMA model. By default, sets student(7,0,1) prior.

prior_sigma0

The prior distribution for the scale parameter in an ARIMA model. By default, declares a student(7,0,1) prior.

prior_ar

The prior distribution for the auto-regressive parameters in an ARMA model. By default, sets normal(0,0.5) priors.

prior_ma

The prior distribution for the moving average parameters in an ARMA model. By default, sets the normal(0,0.5) priors.

prior_alpha

The prior distribution for the auto-regressive parameters in a SVM model. By default, set a normal(0, 0.5) prior.

prior_beta

The prior distribution for the exponential intercept parameter in a SVM model. By default, uses a normal(0,0.5) prior.

prior_breg

The prior distribution for the regression coefficient parameters in an ARIMAX model. By default, sets student(7,0,1) priors.

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.

Value

A varstan object with the fitted SVM model.

Author(s)

Asael Alonzo Matamoros

References

Sangjoon,K. and Shephard, N. and Chib.S (1998). Stochastic Volatility: Likelihood Inference and Comparison with ARCH Models. Review of Economic Studies. 65(1), 361-93. url: https://www.jstor.org/stable/2566931.

Tsay, R (2010). Analysis of Financial Time Series. Wiley-Interscience. 978-0470414354, second edition.

Shumway, R.H. and Stoffer, D.S. (2010).Time Series Analysis and Its Applications: With R Examples. Springer Texts in Statistics. isbn: 9781441978646. First edition.

See Also

garch, and set_prior

Examples


 # Declares a SVM model for the IPC data
 sf1 = stan_SVM(ipc,arma = c(1,1),iter = 500,chains = 1)



bayesforecast documentation built on June 8, 2025, 10:42 a.m.