Learn R Programming

factorstochvol (version 0.8.1)

covmat.fsvdraws: Extract posterior draws of the model-implied covariance matrix

Description

covmat extracts draws from the model-implied covariance matrix from an fsvdraws object for all points in time which have been stored.

Usage

"covmat"(x, ...)

Arguments

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

Value

Array of dimension m times m times draws times timepoints containing the posterior draws for the model-implied covariance matrix.

See Also

covmat covmat.fsvsim

Other extractors: runningcormat, runningcovmat

Examples

Run this code
## Not run: 
# set.seed(1)
# sim <- fsvsim(n = 500, series = 3, factors = 1) # simulate 
# res <- fsvsample(sim$y, factors = 1, keeptime = "all") # estimate
# covs <- covmat(res) # extract
# 
# # Trace plot of determinant of posterior covariance matrix
# # at time t = n = 500:
# detdraws <- apply(covs[,,,500], 3, det)
# ts.plot(detdraws)
# abline(h = mean(detdraws), col = 2)          # posterior mean
# abline(h = median(detdraws), col = 4)        # posterior median
# abline(h = det(covmat(sim)[,,500]), col = 3) # implied by DGP
# 
# # Trace plot of draws from posterior covariance of Sim1 and Sim2 at
# # time t = n = 500:
# ts.plot(covs[1,2,,500])
# abline(h = covmat(sim)[1,2,500], col = 3) # "true" value
# 
# # Smoothed kernel density estimate:
# plot(density(covs[1,2,,500], adjust = 2))
# 
# # Summary statistics:
# summary(covs[1,2,,500])
# ## End(Not run)

Run the code above in your browser using DataLab