Description Usage Arguments Details Value Author(s) Examples
Convenient wrapper for producing an AG-curve from spatial coordinates.
1 |
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. |
hclustDist returns a data frame consisting of the numbers of clusters as a function of height in the dendrogram.
Returns a data frame of height and k values describing the AG-curve suitable for plotting.
Bjorn J. Brooks
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)')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.