This is the development repository of the R
package stochvol
.
You find the same information as a pkgdown
website here.
The package provides methods to estimate the stochastic volatility model, potentially with conditionally heavy tails and/or with leverage.
Using functions svsample
, svtsample
, svlsample
, and svtlsample
, one can conduct Bayesian inference on all parameters, including the time-varying volatilities (the states in the state space).
The same functionality is reachable using the formula interface of svlm
.
Additional features:
- Prediction, plotting, residual extraction work with the usual functions in
R
(predict
,plot
, andresiduals
) - Choose from a range of prior distrubutions; see
help("specify_priors", package="stochvol")
- Built-in support for linear regression and autoregressive processes with stochastic volatility errors; look for function argument
designmatrix
- Easy interfacing with
bayesplot
functions through theas.array()
specialization - Rolling or expanding window estimation can be used for backtesting; see
help("svsample_roll", package="stochvol")
- Run independent Markov chains using
R
's cross-platform parallelization; look for function argumentsn_chains
,parallel
,n_cpus
, andcl
(for "cluster") - For plug&play Bayesian modeling, when stochastic volatility is part of a larger model, fast-access functions can speed up execution in
R
; seehelp("svsample_fast_cpp", package="stochvol")
- For advanced users, there is a
C++
interface; see e.g.help("update_fast_sv", package="stochvol")
- For teaching purposes, you can fix any parameter to a known value using
sv_constant
as the prior specification
Type into your R
session:
install.packages("stochvol")
For more information, please visit the CRAN page of the package.
Type into your R
session:
if (!require("remotes")) {
install.packages("remotes")
}
remotes::install_github(
repo = "https://github.com/gregorkastner/stochvol")
The best introduction is the combination of our vignettes:
- Dealing with Stochastic Volatility in Time Series Using the R Package stochvol
- Modeling Univariate and Multivariate Stochastic Volatility in R with stochvol and factorstochvol
For individual functions, please refer to the help pages after installing the package.
For instance, for svsample
, execute
help("svsample", package = "stochvol")
For more information, please visit stochvol's CRAN page.