updatesummary {stochvol}R Documentation

Updating the Summary of MCMC Draws

Description

Creates or updates a summary of an svdraws object.

Usage

updatesummary(
  x,
  quantiles = c(0.05, 0.5, 0.95),
  esspara = TRUE,
  esslatent = FALSE
)

Arguments

x

svdraws object.

quantiles

numeric vector of posterior quantiles to be computed. The default is c(0.05, 0.5, 0.95).

esspara

logical value which indicates whether the effective sample size (ESS) should be calculated for the parameter draws. This is achieved by calling effectiveSize from the coda package. The default is TRUE.

esslatent

logical value which indicates whether the effective sample size (ESS) should be calculated for the latent log-volatility draws. This is achieved by calling effectiveSize from the coda package. The default is FALSE, because this can be quite time-consuming when many latent variables are present.

Details

updatesummary will always calculate the posterior mean and the posterior standard deviation of the raw draws and some common transformations thereof. Moroever, the posterior quantiles, specified by the argument quantiles, are computed. If esspara and/or esslatent are TRUE, the corresponding effective sample size (ESS) will also be included.

Value

The value returned is an updated list object of class svdraws holding

para

mcmc object containing the parameter draws from the posterior distribution.

latent

mcmc object containing the latent instantaneous log-volatility draws from the posterior distribution.

latent0

mcmc object containing the latent initial log-volatility draws from the posterior distribution.

y

argument y.

runtime

"proc_time" object containing the run time of the sampler.

priors

list containing the parameter values of the prior distribution, i.e. the arguments priormu, priorphi, priorsigma (and potentially nu).

thinning

list containing the thinning parameters, i.e. the arguments thinpara, thinlatent and keeptime.

summary

list containing a collection of summary statistics of the posterior draws for para, latent, and latent0.

To display the output, use 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 gives a graphical overview of the posterior distribution by calling volplot, traceplot and densplot and displaying the results on a single page.

Note

updatesummary does not actually overwrite the object's current summary, but in fact creates a new object with an updated summary. Thus, don't forget to overwrite the old object if this is want you intend to do. See the examples below for more details.

See Also

svsample

Examples

## Here is a baby-example to illustrate the idea.
## Simulate an SV time series of length 51 with default parameters:
sim <- svsim(51)

## Draw from the posterior:
res <- svsample(sim$y, draws = 2000, priorphi = c(10, 1.5))

## Check out the results:
summary(res)
plot(res)

## Look at other quantiles and calculate ESS of latents:
newquants <- c(0.01, 0.05, 0.25, 0.5, 0.75, 0.95, 0.99)
res <- updatesummary(res, quantiles = newquants, esslatent = TRUE)

## See the difference?
summary(res)
plot(res)


[Package stochvol version 3.2.4 Index]