Thresher

Share:

Usage

1
2
3
Thresher(data, nm = deparse(substitute(data)), FUZZ = 0.005,
         metric = "pearson", linkage="ward.D2",
         method = c("broken.stick", "auer.gervini"))

Arguments

data
nm
FUZZ
metric
linkage
method

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (data, nm = deparse(substitute(data)), FUZZ = 0.005, 
    metric = "pearson", method = c("broken.stick", "auer.gervini")) 
{
    std <- scale(data)
    spca <- SamplePCA(t(std))
    ag <- AuerGervini(spca)
    method <- match.arg(method)
    pcdim <- switch(method, broken.stick = bsDimension(spca), 
        auer.gervini = agDimension(ag))
    deltaDim <- max(1, pcdim)
    lambda <- sqrt(spca@variances)
    loadings <- sweep(spca@components, 2, lambda, "*")
    delta <- sqrt(apply(loadings[, 1:deltaDim, drop = FALSE]^2, 
        1, sum))
    gc <- hclust(distanceMatrix(std, metric), "ward")
    new("Thresher", name = nm, data = data, spca = spca, loadings = loadings, 
        gc = gc, pcdim = pcdim, delta = delta, ag = ag)
  }