AGcurve: Wrapper for producing an AG-curve.

Description Usage Arguments Details Value Author(s) Examples

Description

Convenient wrapper for producing an AG-curve from spatial coordinates.

Usage

1
AGcurve(xy, method = "ward.D", dS = NULL)

Arguments

xy

A numeric array of spatial coordinates.

method

A character string passed to hclustDist() that specifies the hierarchical clustering method to be passed to stats::hclust.

dS

An optional numeric value passed to hclustDist() that specifies the denominator used in down-scaling each value of input xy.

Details

hclustDist returns a data frame consisting of the numbers of clusters as a function of height in the dendrogram.

Value

Returns a data frame of height and k values describing the AG-curve suitable for plotting.

Author(s)

Bjorn J. Brooks

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
xy <- data.frame(x=sample(1:100, size=20,   # Some example coordinates
                          replace=TRUE,     # weighted toward 1
                          prob=2^(100:1)),
                 y=sample(1:100, size=20,
                          replace=TRUE,
                          prob=2^(100:1)))
rownames(xy) <- LETTERS[1:20]               # Set names of coord points
fit <- hclustDist(xy, method="single")      # Dendrogram
AG <- AGcurve(xy, method="single")          # AG-curve

# Plot
par(mfrow=c(1,2))                           # Set multiplot panels
layout(matrix(c(1,2,2), nrow=1, ncol=3))    # Customize size of plot panels
plot(fit, xlab='Cluster Group')             # Plot dendrogram
plot(AG$k, AG$h, type='b',
     xlab='Numnber of Clusters (k)',        # Plot AG-curve
     ylab='Height, h[k]',
     main='AG-curve (corresponds to rate of branching in dendrogram)')

bjornbrooks/AGcurve documentation built on June 19, 2019, 12:41 a.m.