hpca: hclust_pca

View source: R/subpca.R

hpcaR Documentation

hclust_pca

Description

A type of pca that uses a hierarchical clustering to define a set of nested regions for pca compression.

Usage

hpca(
  X,
  hclus,
  cuts,
  est_method = c("fixed", "gcv", "shrink"),
  ncomp = rep(1, length(cuts) + 1),
  center = TRUE,
  scale = FALSE,
  shrink_method = "GSURE"
)

Arguments

X

the data matrix

hclus

a hierarchical clustering instance with as many objects as there are rows in X

cuts

desired number of clusters at each level of the hierarchy (must be increasing)

ncomp

the number of components to estimate at each level

Examples


grid <- expand.grid(1:10, 1:10)
X <- matrix(rnorm(100*50), 100, 50)
cuts <- c(4, 8, 16)
hclus <- hclust(dist(grid))
hres1 <- hpca(X, hclus, cuts, est_method="fixed", ncomp=c(4,1,1,1))
ncomp(hres1) == (sum(cuts) +4)

hres2 <- hpca(X, hclus, cuts, est_method="shrink")
hres3 <- hpca(X, hclus, cuts, est_method="gcv")


bbuchsbaum/neuropls documentation built on April 17, 2022, 8:46 a.m.