diagnostic_plot {VBel} | R Documentation |
Check the convergence of a data set computed by compute_GVA
Description
Plots mu and variance in a time series plot to check for convergence of the computed data (i.e. Full-Covariance Gaussian VB Empirical Likelihood Posterior)
Usage
diagnostic_plot(dataList, muList, cList)
Arguments
dataList |
Named list of data generated from compute_GVA |
muList |
Array of indices of mu_arr to plot. (default:all) |
cList |
Matrix of indices of variance to plot, 2xn matrix, each row is (col,row) of variance matrix |
Value
Matrix of variance of C_FC
Examples
# Generate toy variables
seedNum <- 100
set.seed(seedNum)
n <- 100
p <- 10
lam0 <- matrix(0, nrow = p)
# Calculate z
mean <- rep(1, p)
sigStar <- matrix(0.4, p, p) + diag(0.6, p)
z <- mvtnorm::rmvnorm(n = n-1, mean = mean, sigma = sigStar)
# Calculate intermediate variables
zbar <- 1/(n-1) * matrix(colSums(z), nrow = p)
sumVal <- matrix(0, nrow = p, ncol = p)
for (i in 1:p) {
zi <- matrix(z[i,], nrow = p)
sumVal <- sumVal + (zi - zbar) %*% matrix(zi - zbar, ncol = p)
}
sigHat <- 1/(n-2) * sumVal
# Initial values for GVA
mu_0 <- matrix(zbar, p, 1)
C_0 <- 1/sqrt(n) * t(chol(sigHat))
# Define h-function
h <- function(zi, th) { matrix(zi - th, nrow = 10) }
# Define h-gradient function
delthh <- function(z, th) { -diag(p) }
# Set other initial values
delth_logpi <- function(theta) {-0.0001 * theta}
elip <- 10^-5
T <- 5 # Number of iterations for GVA
T2 <- 5 # Number of iterations for AEL
rho <- 0.9
a <- 0.00001
ansGVA <-compute_GVA(mu_0, C_0, h, delthh, delth_logpi, z, lam0, rho, elip,
a, T, T2, fullCpp = TRUE)
diagnostic_plot(ansGVA)
diagnostic_plot(ansGVA, muList = c(1,4))
diagnostic_plot(ansGVA, cList = matrix(c(1,1, 5,6, 3,3), ncol = 2))
[Package VBel version 1.0.1 Index]