Fits a stochastic volatility model with feedback (optional) to a univariate time series of returns via quasi-MLE.
SV.mle(returns, gamma = 0, phi = 0.95, sQ = 0.1, alpha = NULL, sR0 = 1, mu1 = -3, sR1 = 2,
rho = NULL, feedback = FALSE)
Returned invisibly:
one-step-ahead predicted log-volatility
corresponding root MSPE
table of estimates and estimated standard errors
In addition to the one step ahead predicted log-volatility, corresponding root MSPE, and table of estimates returned invisibly, the estimates and SEs are printed and a graph of (1) the data with the predicted log-volatility, and (2) the normal mixture are displayed in one graphic.
single time series of returns
feedback coefficient - included if feedback=TRUE
(does not have to be specified)
initial value of the log-volatility AR parameter (does not have to be specified)
initial value of the standard deviation of log-volatility noise (does not have to be specified)
initial value of the log-returns^2 constant parameter (does not have to be specified)
initial value of the log-returns^2 normal mixture standard deviation parameter (component 0 - does not have to be specified)
initial value of the log-returns^2 normal mixture mean parameter (component 1 - does not have to be specified)
initial value of the log-returns^2 normal mixture standard deviation parameter (component 1 - does not have to be specified)
correlation between the state noise and observation noise (so called "leverage"). If feedback=TRUE
this will be included if given a proper numerical value; if NULL (default) it is not included because
it is often not significant when the feedback coefficient is included.
if TRUE feedback is included in the model; default is FALSE.
D.S. Stoffer
The returns are \(r_t\) (input this). The log-volatility process is \(x_t\) and \(y_t = \log r_t^2\).
If feedback=TRUE
, the model is
$$x_{t+1} = \gamma r_t + \phi x_t + \sigma w_t \qquad y_t = \alpha + x_t + \eta_t$$
where \(w_t\) is standard normal noise. The observation error \(\eta_t\) is a mixture of
two normals, \(N(0, \sigma_0^2)\) and \(N(\mu_1, \sigma_1^2)\). The state
and observation noise can be correlated if \(\rho\) is given a value between -1 and 1.
If feedback=FALSE
, \(\gamma\) and \(\rho\) are not included in the model.
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/blob/master/NEWS.md.
The webpages for the texts and some help on using R for time series analysis can be found at https://nickpoison.github.io/.
SV.mcmc
if (FALSE) {
SV.mle(sp500.gr, feedback=TRUE)
SV.mle(nyse)
}
Run the code above in your browser using DataLab