MDSVfilter: MDSV Filtering

View source: R/MDSVfilter.R

MDSVfilterR Documentation

MDSV Filtering

Description

Method for filtering the MDSV model on log-retruns and realized variances (uniquely or jointly).

Usage

MDSVfilter(
  N,
  K,
  data,
  para,
  ModelType = 0,
  LEVIER = FALSE,
  calculate.VaR = TRUE,
  VaR.alpha = c(0.01, 0.05),
  dis = "lognormal"
)

Arguments

N

An integer designing the number of components for the MDSV process

K

An integer designing the number of states of each MDSV process component

data

A univariate or bivariate data matrix. Can only be a matrix of 1 or 2 columns. If data has 2 columns, the first one has to be the log-returns and the second the realized variances.

para

A vector of parameters use for the MDSV filtering on data. For more informations see Details.

ModelType

An integer designing the type of model to be fit. 0 for univariate log-returns, 1 for univariate realized variances and 2 for joint log-return and realized variances.

LEVIER

if TRUE, estime the MDSV model with leverage.

calculate.VaR

Whether to calculate forecast Value at Risk during the estimation.

VaR.alpha

The Value at Risk tail level to calculate.

Details

The MDSVfilter help to simply filter a set of data with a predefined set of parameters. Like in MDSVfit, the likelihood calculation is performed in C++ through the Rcpp package. According to Augustyniak et al., (2021), the para consist on a vector of :

  • \omega probability of success of the stationnary distribution of the Markov chain. (0 < \omega < 1).

  • a highest persistance of the component of the MDSV process. (0 < a < 1).

  • b decroissance rate of the persistances. (1 < b).

  • \sigma^2 unconditionnal variance of the MDSV process.

  • \nu_0 states defined parameter. (0 < \nu_0 < 1).

  • \gamma parameter of the realized variances innovation. This parameter is required only if ModelType = 1 or ModelType = 2. (0 < \gamma).

  • \xi parameter of realized variances equation in joint estimation. This parameter is required only if ModelType = 2.

  • \phi parameter of realized variances equation in joint estimation. This parameter is required only if ModelType = 2.

  • \delta1 parameter of realized variances equation in joint estimation. This parameter is required only if ModelType = 2.

  • \delta2 parameter of realized variances equation in joint estimation. This parameter is required only if ModelType = 2.

  • l leverage effect parameter. This parameter is required only if LEVIER = TRUE. (0 < l).

  • \theta leverage effect parameter. This parameter is required only if LEVIER = TRUE. (0 < \theta < 1).

The leverage effect is taken into account according to the FHMV model (see Augustyniak et al., 2019). While filtering an univariate realized variances data, log-returns are required to add leverage effect. AIC and BIC are computed using the formulas :

  • AIC : L - k

  • BIC : L - (k/2)*log(n)

where L is the log-likelihood, k is the number of parameters and n the number of observations in the dataset. The class of the output of this function is MDSVfilter. This class has a summary, print and plot methods to summarize, print and plot the results. See summary.MDSVfilter, print.MDSVfilter and plot.MDSVfilter for more details.

Value

A list consisting of:

  • ModelType : type of model to be filtered.

  • LEVIER : wheter the filter take the leverage effect into account or not.

  • N : number of components for the MDSV process.

  • K : number of states of each MDSV process component.

  • data : data use for the filtering.

  • dates : vector or names of data designing the dates.

  • estimates : input parameters.

  • LogLikelihood : log-likelihood of the model on the data.

  • AIC : Akaike Information Criteria of the model on the data.

  • BIC : Bayesian Information Criteria of the model on the data.

  • Levier : numeric vector representing the leverage effect at each date. Levier is 1 when no leverage is detected

  • filtred_proba : matrix containing the filtred probabilities P(C_t=c_i | x_1,\dots, x_t) of the Markov Chain.

  • smoothed_proba : matrix containing the smoothed probabilities P(C_t=c_i | x_1,\dots, x_T) of the Markov Chain.

  • Marg_loglik : marginal log-likelihood corresponding to the log-likelihood of log-returns. This is only return when ModelType = 2.

  • VaR : Value-at-Risk compute empirically.

References

Augustyniak, M., Bauwens, L., & Dufays, A. (2019). A new approach to volatility modeling: the factorial hidden Markov volatility model. Journal of Business & Economic Statistics, 37(4), 696-709. https://doi.org/10.1080/07350015.2017.1415910

Augustyniak, M., Dufays, A., & Maoude, K.H.A. (2021). Multifractal Discrete Stochastic Volatility.

See Also

For fitting MDSVfit, bootstrap forecasting MDSVboot, simulation MDSVsim and rolling estimation and forecast MDSVroll.

Examples

## Not run: 
# MDSV(N=2,K=3) without leverage on univariate log-returns S&P500
data(sp500)        # Data loading
N         <- 2     # Number of components
K         <- 3     # Number of states
ModelType <- 0     # Univariate log-returns
LEVIER    <- FALSE # No leverage effect

# Model estimation
out_fit   <- MDSVfit(K = K, N = N, data = sp500, ModelType = ModelType, LEVIER = LEVIER)
# Model filtering
para      <-out_fit$estimates # parameter
out_filter<- MDSVfilter(K = K, N = N, data = sp500, para = para, ModelType = ModelType, LEVIER = LEVIER)
# Summary
summary(out_filter)
# Plot
plot(out_filter)


# MDSV(N=3,K=3) with leverage on joint log-returns and realized variances NASDAQ
data(nasdaq)      # Data loading
N         <- 3    # Number of components
K         <- 3    # Number of states
ModelType <- 2    # Joint log-returns and realized variances
LEVIER    <- TRUE # No leverage effect

para      <- c(omega = 0.52, a = 0.99, b = 2.77, sigma = 1.95, v0 = 0.72, 
              xi = -0.5, varphi = 0.93, delta1 = 0.93, delta2 = 0.04, shape = 2.10,
              l = 0.78, theta = 0.876)
# Model filtering
out       <- MDSVfilter(K = K, N = N,data = nasdaq, para = para, ModelType = ModelType, LEVIER = LEVIER)
# Summary
summary(out)
# Plot
plot(out)

## End(Not run)


Abdoulhaki/MDSV documentation built on July 6, 2024, 4:03 p.m.