ICtest

CRAN status CRAN downloads Monthly downloads R-CMD-check

In linear dimension reduction the data are transformed into components of which only a few are assumed to carry the information of interest, while the remaining ones are considered noise. What makes a component interesting depends on the method. In principal component analysis (PCA) these are the components with large variances, in independent component analysis (ICA) and non-Gaussian component analysis (NGCA) the non-Gaussian components, and in supervised dimension reduction such as sliced inverse regression (SIR) the components which carry information about the response. The package ICtest provides tests and estimates for the number of these interesting, or informative, components, which also explains its name.

Main features

Note that PCAlrt(), PCAaugHD(), FOBIaug() and SIRaug() are so far available only in the development version.

Installation

The released version can be installed from CRAN:

install.packages("ICtest")

The development version can be installed from GitHub:

# install.packages("remotes")
remotes::install_github("klauschN/ICtest")

Example

As an example we consider simulated data with three components whose variances are larger than those of the remaining seven, rotated by a random orthogonal matrix.

library(ICtest)
set.seed(1)
n <- 200
p <- 10
Z <- matrix(rnorm(n * p), ncol = p) %*% diag(c(3, 2.5, 2, rep(1, 7)))
X <- Z %*% t(rorth(p))

A forward search with the asymptotic test for subsphericity estimates the number of interesting components.

kSearch(X, PCAasymp)
#> Results for estimated k = 3:
#> 
#>  PCA subsphericity test using cov
#> 
#> data:  X
#> T = 27.921, df = 27, p-value = 0.415
#> alternative hypothesis: the last 7 eigenvalues are not equal
#> 
#> Tested k values and respective p-values:
#> k = 0, p-value = < 2.2e-16
#> k = 1, p-value = < 2.2e-16
#> k = 2, p-value = < 2.2e-16
#> k = 3, p-value = 0.415

The ladle estimator gives the same answer, and its criterion can be plotted with ggplot2.

pcaLadle <- PCAladle(X)
pcaLadle$k
#> [1] 3
ggladleplot(pcaLadle, main = "", xlab = "k") +
  geom_vline(xintercept = pcaLadle$k, linetype = "dashed") +
  scale_x_continuous(breaks = 0:(p - 1)) + theme_bw()

More examples are given in the vignettes, see vignette(package = "ICtest").

References

The methods are described in the following papers, among others:

To cite the package itself, see citation("ICtest"). Bug reports and suggestions are welcome as issues.