svsample
.svsample2
is a minimal overhead version of svsample
with slightly different default arguments and a simplified return value structure. It is intended to be used mainly for one-step updates where speed is an issue, e.g., as a plug-in into other MCMC samplers. Note that absolutely no input checking is performed, thus this function is to be used with proper care!
svsample2(y, draws = 1, burnin = 0, priormu = c(0, 100),
priorphi = c(5, 1.5), priorsigma = 1, priornu = NA,
priorlatent0 = "stationary", thinpara = 1, thinlatent = 1,
thintime = 1, keeptau = FALSE, quiet = TRUE, startpara, startlatent)
numeric vector containing the data (usually log-returns), which must not contain zeroes.
single number greater or equal to 1, indicating the number of draws after burn-in (see below). Will be automatically coerced to integer. The defaults value is 1.
single number greater or equal to 0, indicating the number of draws discarded as burn-in. Will be automatically coerced to integer. The default value is 0.
numeric vector of length 2, indicating mean and standard deviation for the Gaussian prior distribution of the parameter mu
, the level of the log-volatility. The default value is c(0, 100)
, which constitutes a practically uninformative prior for common exchange rate datasets, stock returns and the like.
numeric vector of length 2, indicating the shape parameters for the Beta prior distribution of the transformed parameter (phi+1)/2
, where phi
denotes the persistence of the log-volatility. The default value is c(5, 1.5)
, which constitutes a prior that puts some belief in a persistent log-volatility but also encompasses the region where phi
is around 0.
single positive real number, which stands for the scaling of the transformed parameter sigma^2
, where sigma
denotes the volatility of log-volatility. More precisely, sigma^2 ~ priorsigma * chisq(df = 1)
. The default value is 1
, which constitutes a reasonably vague prior for many common exchange rate datasets, stock returns and the like.
numeric vector of length 2 (or NA
), indicating the lower and upper bounds for the uniform prior distribution of the parameter nu
, the degrees-of-freedom parameter of the conditional innovations t-distribution. The default value is NA
, fixing the degrees-of-freedom to infinity. This corresponds to conditional standard normal innovations, the pre-1.1.0 behavior of stochvol.
either a single non-negative number or the string 'stationary'
(the default, also the behavior before version 1.3.0). When priorlatent0
is equal to 'stationary'
, the stationary distribution of the latent AR(1)-process is used as the prior for the initial log-volatility h_0
. When priorlatent0
is equal to a number \(B\), we have \(h_0 \sim N(\mu, B\sigma^2)\) a priori.
single number greater or equal to 1, coercible to integer. Every thinpara
th parameter draw is kept and returned. The default value is 1, corresponding to no thinning of the parameter draws -- every draw is stored.
single number greater or equal to 1, coercible to integer. Every thinlatent
th latent variable draw is kept and returned. The default value is 1, corresponding to no thinning of the latent variable draws, i.e. every draw is kept.
single number greater or equal to 1, coercible to integer. If thintime
is different from 1, only every thintime
th latent log-volatility is being monitored. If, e.g., thintime = 3
, the latent log-volatilities h_1,h_4,h_7,...
will be kept. The default value is 1, meaning that all latent variables h_1,h_2,h_3,...
are stored.
logical value indicating whether the 'variance inflation factors' should be stored (used for the sampler with conditional t innovations only). This may be useful to check at what point(s) in time the normal disturbance had to be 'upscaled' by a mixture factor and when the series behaved 'normally'.
logical value indicating whether the progress bar and other informative output during sampling should be omitted. The default value is TRUE
, implying non-verbose output.
compulsory named list, containing the starting values for the parameter draws. startpara
must contain three elements named mu
, phi
, and sigma
, where mu
is an arbitrary numerical value, phi
is a real number between -1
and 1
, and sigma
is a positive real number. Moreover, if priornu
is not NA
, startpara
must also contain an element named nu
(the degrees of freedom parameter for the t-innovations).
compulsory vector of length length(x$y)
, containing the starting values for the latent log-volatility draws.
A list with three components:
3
times draws
matrix containing the parameter draws. If priornu
is not NA
, this is a 4
times draws
matrix.
length(y)
times draws
matrix containing draws of the latent variables h_1, …, h_n
.
Vector of length draws
containing the draw(s) of the initial latent variable h_0
.
Expert use only! For most applications, the use of svsample
is recommended.
As opposed to the ordinary svsample
, the default values differ for draws
, burnin
, and quiet
. Note that currently neither expert
nor …
arguments are provided.