Learn R Programming

heplots (version 1.1-0)

logdetCI: Calculate confidence interval for log determinant of covariance matrices

Description

This function uses asymptotic results described by Cai et. al (2016), Theorem 1, to calculate approximate, normal theory confidence intervals (CIs) for the log determinant of one or more sample covariance matrices. Their results are translated into a CI via the approximation $$\log det( \widehat{\Sigma} ) - bias \pm z_{1 - \alpha/2} \times SE$$ where $\widehat{\Sigma}$ is the sample estimate of a population covariance matrix, $bias$ is a bias correction constant and $SE$ is a width factor for the confidence interval. Both $bias$ and $SE$ are functions of the sample size, $n$ and number of variables, $p$. This function is included here only to provide an approximation to graphical accuracy for use with Box's M test for equality of covariance matrices, boxM and its associated plot.boxM method.

Usage

logdetCI(cov, n, conf = 0.95, method = 2, bias.adj = TRUE)

Arguments

cov
a covariance matrix or a (named) list of covariance matrices, all the same size
n
sample size, or vector of sample sizes, one for each covariance matrix
conf
confidence level
method
Two methods are provided, based on their Colollary 1 and Colollary 2, each with different bias and SE values.
bias.adj
logical; set FALSE to exclude the bias correction term

Value

  • A data frame with one row for each covariance matrix. lower and upper are the boundaries of the confidence intervals.

Details

The properties of this CI estimator are unknown in small to moderate sample sizes, but it seems to be the only one available. It is therefore experimental in this version of the package and is subject to change in the future. The $bias$ term offsets the confidence interval from the sample estimate of $\log det( \widehat{\Sigma} )$. When $p$ is large relative to $n$, the confidence interval may not overlap the sample estimate.

References

Cai, T. T., Liang, T. & Zhou, H. H. (2016). Law of log determinant of sample covariance matrix and optimal estimation of differential enteropy for high-dimensional Gaussian distributions. JMA, to appear. Preprint: www.stat.yale.edu/~hz68/Covariance-Determinant.pdf

See Also

boxM, plot.boxM

Examples

Run this code
data(iris)
iris.mod <- lm(as.matrix(iris[,1:4]) ~ iris$Species)
iris.boxm <- boxM(iris.mod)
cov <- c(iris.boxm$cov, list(pooled=iris.boxm$pooled))
n <- c(rep(50, 3), 150)

CI <- logdetCI( cov, n=n, conf=.95, method=1)
CI
plot(iris.boxm, xlim=c(-14, -8), main="Iris data, Box's M test", gplabel="Species")
arrows(CI$lower, 1:4, CI$upper, 1:4, lwd=3, angle=90, len=.1, code=3)

CI <- logdetCI( cov, n=n, conf=.95, method=1, bias.adj=FALSE)
CI
plot(iris.boxm, xlim=c(-14, -8), main="Iris data, Box's M test", gplabel="Species")
arrows(CI$lower, 1:4, CI$upper, 1:4, lwd=3, angle=90, len=.1, code=3)

Run the code above in your browser using DataLab