Description Usage Arguments Details Value Note See Also Examples
svsample_roll
performs rolling window estimation based on svsample.
A convenience function for backtesting purposes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67  svsample_roll(
y,
designmatrix = NA,
n_ahead = 1,
forecast_length = 500,
n_start = NULL,
refit_every = 1,
refit_window = c("moving", "expanding"),
calculate_quantile = c(0.01),
calculate_predictive_likelihood = TRUE,
keep_draws = FALSE,
parallel = c("no", "multicore", "snow"),
n_cpus = 1L,
cl = NULL,
...
)
svtsample_roll(
y,
designmatrix = NA,
n_ahead = 1,
forecast_length = 500,
n_start = NULL,
refit_every = 1,
refit_window = c("moving", "expanding"),
calculate_quantile = c(0.01),
calculate_predictive_likelihood = TRUE,
keep_draws = FALSE,
parallel = c("no", "multicore", "snow"),
n_cpus = 1L,
cl = NULL,
...
)
svlsample_roll(
y,
designmatrix = NA,
n_ahead = 1,
forecast_length = 500,
n_start = NULL,
refit_every = 1,
refit_window = c("moving", "expanding"),
calculate_quantile = c(0.01),
calculate_predictive_likelihood = TRUE,
keep_draws = FALSE,
parallel = c("no", "multicore", "snow"),
n_cpus = 1L,
cl = NULL,
...
)
svtlsample_roll(
y,
designmatrix = NA,
n_ahead = 1,
forecast_length = 500,
n_start = NULL,
refit_every = 1,
refit_window = c("moving", "expanding"),
calculate_quantile = c(0.01),
calculate_predictive_likelihood = TRUE,
keep_draws = FALSE,
parallel = c("no", "multicore", "snow"),
n_cpus = 1L,
cl = NULL,
...
)

y 
numeric vector containing the data (usually logreturns), which
must not contain zeros. Alternatively, 
designmatrix 
regression design matrix for modeling the mean. Must
have 
n_ahead 
number of time steps to predict from each time window. 
forecast_length 
the time horizon at the end of the data set that is used for backtesting. 
n_start 
optional the starting time point for backtesting.
Computed from 
refit_every 
the SV model is refit every 
refit_window 
one of 
calculate_quantile 
vector of numbers between 0 and 1.
These quantiles are predicted using 
calculate_predictive_likelihood 
boolean. If 
keep_draws 
boolean. If 
parallel 
one of 
n_cpus 
optional positive integer, the number of CPUs to be used in case of
parallel computations. Defaults to 
cl 
optional socalled SNOW cluster object as implemented in package

... 
Any extra arguments will be forwarded to

Functions svtsample_roll
, svlsample_roll
, and svtlsample_roll
are
wrappers around svsample_roll
with convenient default values for the SV
model with terrors, leverage, and both terrors and leverage, respectively.
The value returned is a list object of class svdraws_roll
holding a list item for every time window. The elements of these list items are
indices 
a list object containing two elements: 
quantiles 
the input parameter 
refit_every 
the input parameter 
predictive_likelihood 
present only if 
predictive_quantile 
present only if 
fit 
present only if 
prediction 
present only if 
To display the output, use print
and summary
. The
print
method simply prints a short summary of the setup;
the summary
method displays the summary statistics
of the backtesting.
The function executes svsample
(length(y)  arorder  n_ahead  n_start + 2) %/% refit_every
times.
svsim
, specify_priors
, svsample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39  # Simulate from the true model
sim < svsim(200)
# Perform rolling estimation using the vanilla SV
# model and default priors
roll < svsample_roll(sim, draws = 5000, burnin = 2000,
keep_draws = TRUE,
forecast_length = 10,
n_ahead = 1, refit_every = 1,
refit_window = "moving",
calculate_predictive_likelihood = TRUE,
calculate_quantile = c(0.01, 0.05))
# Perform rolling estimation by making use
# of two CPU cores, advanced priors, and multiple
# chains with preset initial values. Let us combine
# that with an AR(2) specification
prior_beta < sv_multinormal(c(1,0,1), rbind(c(1, 0, 0.1),
c(0, 0.3, 0.04),
c(0.1, 0.04, 0.1)))
priorspec < specify_priors(rho = sv_beta(4, 4),
latent0_variance = sv_constant(1),
beta = prior_beta,
nu = sv_exponential(0.05))
startpara < list(list(mu = 9, phi = 0.3),
list(mu = 11, sigma = 0.1, phi = 0.95),
list(phi = 0.99))
roll < svsample_roll(sim, draws = 5000, burnin = 2000,
designmatrix = "ar2",
priorspec = priorspec,
startpara = startpara,
parallel = "snow", n_cpus = 2,
n_chains = 3,
keep_draws = TRUE,
forecast_length = 10,
n_ahead = 1, refit_every = 1,
refit_window = "expanding",
calculate_predictive_likelihood = TRUE,
calculate_quantile = c(0.01, 0.05))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.