Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

predh

Predicts factor and idiosyncratic log-volatilities h


Description

predh simulates from the posterior predictive distribution of the latent log-variances h, both for factors as well as for idiosyncratic series.

Usage

predh(x, ahead = 1, each = 1)

Arguments

x

Object of class 'fsvdraws', usually resulting from a call to fsvsample.

ahead

Vector of timepoints, indicating how many steps to predict ahead.

each

Single integer (or coercible to such) indicating how often should be drawn from the posterior predictive distribution for each draw that has been stored during MCMC sampling.

Value

List of class fsvpredh containing two elements:

  • idihArray containing the draws of the latent idiosyncratic log-volatilities.

  • factorhArray containing the draws of the latent factor log-volatilities.

See Also

Other predictors: predcond(), predcor(), predcov(), predloglikWB(), predloglik(), predprecWB()

Examples

set.seed(1)
sim <- fsvsim(series = 3, factors = 1) # simulate 
res <- fsvsample(sim$y, factors = 1) # estimate

# Predict 1, 10, and 100 days ahead:
predobj <- predh(res, ahead = c(1, 10, 100))

# Trace plot of draws from posterior predictive factor log-variance
# (one, ten, and 100 days ahead):
plot.ts(predobj$factorh[1,,])

# Smoothed kernel density estimates of predicted volas:
plot(density(exp(predobj$factorh[1,,"1"]/2), adjust = 2))
lines(density(exp(predobj$factorh[1,,"10"]/2), adjust = 2), col = 2)
lines(density(exp(predobj$factorh[1,,"100"]/2), adjust = 2), col = 3)

factorstochvol

Bayesian Estimation of (Sparse) Latent Factor Stochastic Volatility Models

v0.10.2
GPL (>= 2)
Authors
Gregor Kastner [aut, cre] (<https://orcid.org/0000-0002-8237-8271>), Darjus Hosszejni [ctb] (<https://orcid.org/0000-0002-3803-691X>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.