Learn R Programming

ClustGeo (version 2.1)

choicealpha: Choice of the mixing parameter

Description

This function calculates the proportion of inertia explained by the partitions in K clusters for a range of mixing parameters alpha. When the proportion of explained inertia calculated with D0 decreases, the proportion of explained inertia calculated with D1 increases. The plot of the two curves of explained inertia (one for D0 and one for D1) helps the user to choose the mixing parameter alpha.

Usage

choicealpha(D0, D1, range.alpha, K, wt = NULL, scale = TRUE, graph = TRUE)

Arguments

D0

a dissimilarity matrix of class dist. The function as.dist can be used to transform an object of class matrix to object of class dist.

D1

an other dissimilarity matrix of class dist.

range.alpha

a vector of real values between 0 and 1.

K

the number of clusters.

wt

vector with the weights of the observations. By default, wt=NULL corresponds to the case where all observations are weighted by 1/n.

scale

if TRUE the two dissimilarity matrices are scaled i.e. divided by their max.

graph

if TRUE, two graphics (proportion and normalized proportion of explained inertia) are drawn.

Value

An object with S3 class "choicealpha" and the following components:

Q

a matrix of dimension length(range.alpha) times 2 with the proportion of explained inertia calculated with D0 (first column) and calculated with D1 (second column)

Qnorm

a matrix of dimension length(range.alpha) times 2 with the proportion of normalized explained inertia calculated with D0 (first column) and calculated with D1 (second column)

References

M. Chavent, V. Kuentz-Simonet, A. Labenne, J. Saracco. ClustGeo: an R package for hierarchical clustering with spatial constraints. Comput Stat (2018) 33: 1799-1822.

See Also

plot.choicealpha, hclustgeo

Examples

Run this code
# NOT RUN {
data(estuary)
D0 <- dist(estuary$dat) # the socio-demographic distances
D1 <- as.dist(estuary$D.geo) # the geographic distances between the cities
range.alpha <- seq(0,1,0.1)
K <- 5
cr <- choicealpha(D0,D1,range.alpha,K,graph=TRUE)
cr$Q # proportion of explained pseudo inertia
cr$Qnorm # normalized proportion of explained pseudo inertia

# }

Run the code above in your browser using DataLab