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

predcond

Predicts means and variances conditionally on the factors


Description

predcond simulates from the posterior predictive distribution of the data, conditionally on realized values of the factors. This has the advantage that the predictive density can be written as the product of the marginals but introduces sampling uncertainty that grows with the number of factors used.

Usage

predcond(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.

...

Ignored.

Value

List of class fsvpredcond containing two elements:

  • meansArray containing the draws of the predictive means.

  • varsArray containing the draws of the predictive variances.

See Also

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

Examples

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

# Predict 1 day ahead:
predobj <- predcond(res, each = 5)

# Draw from the predictive distribution:
preddraws <- matrix(rnorm(length(predobj$mean[,,1]),
                    mean = predobj$mean[,,1],
                    sd = predobj$vols[,,1]), nrow = 4)

# Visualize the predictive distribution
pairs(t(preddraws), col = rgb(0,0,0,.1), pch = 16)

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.