svsample simulates from the joint posterior distribution of the SV parameters mu, phi, sigma (and potentially nu), along with the latent log-volatilities h_0,...,h_n and returns the MCMC draws.svsample(y, draws = 10000, burnin = 1000, priormu = c(0, 100),
priorphi = c(5, 1.5), priorsigma = 1, priornu = NA,
thinpara = 1, thinlatent = 1, thintime = 1, quiet = FALSE,
startpara, startlatent, expert, ...)y can be an svsim object. In this case, the returns will be extracted and a warning is thrown.mu, the level of the log-volatility. The default value is c(0, 100), which constitutes a practically uninform(phi+1)/2, where phi denotes the persistence of the log-volatility. The default value is c(5, 1.5)sigma^2, where sigma denotes the volatility of log-volatility. More precisely, sigma^2 ~ priorsigma * chisq(df = 1). The default 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 ithinparath parameter draw is kept and returned. The default value is 1, corresponding to no thinning of the parameter draws i.e. every draw is stored.thinlatentth 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.thintime is different from 1, only every thintimeth latent log-volatility is being monitored. If, e.g., thintime = 3, the latent log-volatilities h_FALSE, implying verbose output.startpara must contain three elements named mu, phi, and sigma, where mu is an arbitrary nulength(x$y), containing the starting values for the latent log-volatility draws. The default value is rep(-10, length(x$y)).expert is provided, it may contain the folupdatesummary, controlling the type of statistics calculated for the posterior draws.svdraws holdingmcmc object containing the parameter draws from the posterior distribution.mcmc object containing the latent instantaneous log-volatility draws from the posterior distribution.mcmc object containing the latent initial log-volatility draws from the posterior distribution.yproc_time object containing the run time of the sampler.list containing the parameter values of the prior distribution, i.e. the arguments priormu, priorphi and priorsigma.list containing the thinning parameters, i.e. the arguments thinpara, thinlatent and thintime.list containing a collection of summary statistics of the posterior draws for para, latent, and latent0.print, summary and plot. The print method simply prints the posterior draws (which is very likely a lot of output); the summary method displays the summary statistics currently stored in the object; the plot method plot.svdraws gives a graphical overview of the posterior distribution by calling volplot, traceplot and densplot and displaying the results on a single page.svsim, updatesummary, predict.svdraws, plot.svdraws.## Simulate a short and highly persistent SV process
sim <- svsim(100, mu = -10, phi = 0.99, sigma = 0.2)
## Obtain 5000 draws from the sampler (that's not a lot)
draws <- svsample(sim$y, draws = 5000, burnin = 100,
priormu = c(-10, 1), priorphi = c(20, 1.5), priorsigma = 0.2)
## Check out the results
summary(draws)
plot(draws)Run the code above in your browser using DataLab