# Observation/case weighting in cluster analysis

Sampling weights, the inverse probability of a unit's selection into the sample, and other more complex and adjusted weights are very often used in the social sciences. There is statistical software that allows weighting of observations/cases, like the hclust function from the R-package cluster.

In regression analysis, there is an ongoing debate when the usage of observation weights is appropriate (see e.g. Winship/Radbill 1994). I could not find anything concerning observation weights in textbooks about cluster analysis, if weighting is discussed, it is mostly about variable weighting. One exemption is the manual of the R-package WeightedCluster, which discusses observation weighting in more detail. The documentation of the cluster package is not very helpful, as it only shows a trivial example using the weighting option hclust(..., members="...") where the number or weight of cases is untouched.

1. Therefore, I am looking for references and recommendations with observation/case weighting in cluster analysis, especially hierarchical cluster analysis.
2. As I could not find the actual formula for the hclust(..., members="...") function : Which parameters changes in the hierarchical cluster algorithm if one uses observation weights? How does that affect the algorithm?

In order to get an idea of the difference between clustering with and without case weights, here is an example using weights from survey data and the R-code:

require(survey)
data(api)
whc <- hclust(dist(apiclus2[, c("pct.resp", "meals")]), method="ward.D2",
members=apiclus2\$pw)
uwhc <- hclust(dist(apiclus2[, c("pct.resp", "meals")]), method="ward.D2")
opar <- par(mfrow = c(1, 2))
plot(whc,  labels = FALSE, hang = -1, main = "Weighted survey data")
plot(uwhc, labels = FALSE, hang = -1, main = "Unweighted survey data")


### References

• Studer, M., 2013: WeightedCluster Library Manual. A practical guide to creating typologies of trajectories in the social sciences with R. LIVES Working Papers 24. Lausanne.
• Winship, C. & L. Radbill, 1994: Sampling Weights and Regression Analysis. Sociological Methods & Research 23: 230–257.
• If you cluster observations, "weighting" of observations is simply changing frequencies among them (whatever consideration led to compute the weights). Is it so from your question's perspective? Commented Dec 10, 2014 at 18:50
• @ttnphns Yes, that's what I also understood from the literature. But I could not find how hclust does the trick. Does it simply expand observations using the vector given in "members"? Which seems the most easy way to me. However, I did not find the explanation in ?hclust, especially the example part, very clear. If I use sampling weights, the initial set of observations is changed and I am essentially constructing a new dendrogram instead of "restarting it in the middle". Commented Dec 10, 2014 at 22:37
• If only I could help you with an R package... But, logically, expanding frequencies of some observations will (1) change the shape of dendrogram for some methods of agglomeration, (2) not change the number of distinct branches since an expanded case is a tight bunch = a "boosted" branch. I once had an answer on a somewhat similar question regarding SPSS, where hierarhical clustering doesn't automatically support weighting. Commented Dec 11, 2014 at 4:11