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

runningcormat

Extract summary statistics for the posterior correlation matrix which have been stored during sampling


Description

runningcormat extracts summary statistics from the model-implied correlation matrix from an fsvdraws object for one point in time.

Usage

runningcormat(x, i, statistic = "mean", type = "cor")

Arguments

x

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

i

A single point in time.

statistic

Indicates which statistic should be extracted. Defaults to 'mean'.

type

Indicates whether covariance (cov) or correlation (cor) should be extracted.

Value

Matrix containing the requested correlation matrix summary statistic.

See Also

Other extractors: cormat.fsvdraws(), covmat.fsvdraws(), runningcovmat()

Examples

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

cor100mean <- runningcormat(res, 100) # extract mean at t = 100
cor100sd <- runningcormat(res, 100, statistic = "sd") # extract sd
lower <- cor100mean - 2*cor100sd
upper <- cor100mean + 2*cor100sd

true <- cormat(sim, 100)[,,1] # true value

# Visualize mean +/- 2sd and data generating values
par(mfrow = c(3,3), mar = c(2, 2, 2, 2))
for (i in 1:3) {
 for (j in 1:3) {
  plot(cor100mean[i,j], ylim = range(lower, upper), pch = 3,
  main = paste(i, j, sep = ' vs. '), xlab = '', ylab = '')
  lines(c(1,1), c(lower[i,j], upper[i,j]))
  points(true[i,j], col = 3, cex = 2)
 }
}

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.