Learn R Programming

bspcov (version 1.0.0)

summary.bspcov: Summary of Posterior Distribution

Description

Provides the summary statistics for posterior samples of covariance matrix.

Usage

# S3 method for bspcov
summary(object, cols, rows, ...)

Value

summary

a table of summary statistics including empirical mean, standard deviation, and quantiles for posterior samples

Arguments

object

an object from bandPPP, bmspcov, sbmspcov, and thresPPP.

cols

a scalar or a vector including specific column indices.

rows

a scalar or a vector including specific row indices greater than or equal to columns indices.

...

additional arguments for the summary function.

Author

Seongil Jo

Examples

Run this code

set.seed(1)
n <- 20
p <- 5

# generate a sparse covariance matrix:
True.Sigma <- matrix(0, nrow = p, ncol = p)
diag(True.Sigma) <- 1
Values <- -runif(n = p*(p-1)/2, min = 0.2, max = 0.8)
nonzeroIND <- which(rbinom(n=p*(p-1)/2,1,prob=1/p)==1)
zeroIND = (1:(p*(p-1)/2))[-nonzeroIND]
Values[zeroIND] <- 0
True.Sigma[lower.tri(True.Sigma)] <- Values
True.Sigma[upper.tri(True.Sigma)] <- t(True.Sigma)[upper.tri(True.Sigma)]
if(min(eigen(True.Sigma)$values) <= 0){
  delta <- -min(eigen(True.Sigma)$values) + 1.0e-5
  True.Sigma <- True.Sigma + delta*diag(p)
}

# generate a data
X <- MASS::mvrnorm(n = n, mu = rep(0, p), Sigma = True.Sigma)

# compute sparse, positive covariance estimator:
fout <- bspcov::sbmspcov(X = X, Sigma = diag(diag(cov(X))))
summary(fout, cols = c(1, 3, 4), rows = c(1, 3, 4))
summary(fout, cols = 1, rows = 1:p)

Run the code above in your browser using DataLab