MDSVfit | R Documentation |
Method for fitting the MDSV model on log-retruns and realized variances (uniquely or jointly).
MDSVfit(
N,
K,
data,
ModelType = 0,
LEVIER = FALSE,
start.pars = list(),
dis = "lognormal",
...
)
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. |
ModelType |
An integer designing the type of model to be fit. |
LEVIER |
if |
start.pars |
List of staring parameters for the optimization routine. These are not usually required unless the optimization has problems converging. |
... |
Further options for the |
fixed.pars |
A vector of the position of the parameters of the model to be fixed |
fixed.values |
A vector containing the value of parameters of the model to be fixed. Must have the same length as fixed.pars |
The MDSV optimization routine set of feasible starting points which are used to initiate the MDSV recursion. The
likelihood calculation is performed in C++
through the Rcpp package. The optimization is perform using
the solnp solver of the Rsolnp package and additional options can be supply to the fonction.
The leverage effect is taken into account according to the FHMV model (see Augustyniak et al., 2019). While fitting 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 MDSVfit
. This class has a summary,
print and plot methods to summarize, print and plot the results. See
summary.MDSVfit
, print.MDSVfit
and plot.MDSVfit
for more details.
To fixe some parameter in the optimization, you can use the deux optionnal parameters :
A list consisting of:
ModelType : type of model to be fitted.
LEVIER : wheter the fit 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.
convergence : 0 if convergence, 1 if not.
estimates : estimated 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.
data : data use for the fitting.
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
For filtering MDSVfilter
, bootstrap forecasting MDSVboot
, simulation MDSVsim
and rolling estimation and forecast MDSVroll
.
## 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 <- MDSVfit(K = K, N = N, data = sp500, ModelType = ModelType, LEVIER = LEVIER)
# Summary
summary(out)
# Plot
plot(out,c("dis","nic"))
# 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
# Model estimation
out <- MDSVfit(K = K, N = N, data = nasdaq, ModelType = ModelType, LEVIER = LEVIER)
# Summary
summary(out)
# Plot
plot(out,"nic")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.