Rev 7509 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{mona}\alias{mona}\title{MONothetic Analysis Clustering of Binary Variables}\description{Returns a list representing a divisive hierarchical clustering ofa dataset with binary variables only.}\usage{mona(x, trace.lev = 0)% FIXME: allow early stopping}\arguments{\item{x}{data matrix or data frame in which each row corresponds to anobservation, and each column corresponds to a variable. Allvariables must be binary. A limited number of missing values (\code{NA}s)is allowed. Every observation must have at least one value differentfrom \code{\link{NA}}. No variable should have half of its valuesmissing. There must be at least one variable which has no missingvalues. A variable with all its non-missing values identical isnot allowed.}\item{trace.lev}{logical or integer indicating if (and how much) thealgorithm should produce progress output.}}\value{an object of class \code{"mona"} representing the clustering.See \code{\link{mona.object}} for details.}\details{\code{mona} is fully described in chapter 7 of Kaufman and Rousseeuw (1990).It is \dQuote{monothetic} in the sense that each division is based on asingle (well-chosen) variable, whereas most other hierarchical methods(including \code{agnes} and \code{diana}) are \dQuote{polythetic}, i.e. they useall variables together.The \code{mona}-algorithm constructs a hierarchy of clusterings,starting with one large cluster. Clusters are divided until allobservations in the same cluster have identical values for all variables.\crAt each stage, all clusters are divided according to the values of onevariable. A cluster is divided into one cluster with all observations havingvalue 1 for that variable, and another cluster with all observations havingvalue 0 for that variable.The variable used for splitting a cluster is the variable with the maximaltotal association to the other variables, according to the observations in thecluster to be splitted. The association between variables f and gis given by a(f,g)*d(f,g) - b(f,g)*c(f,g), where a(f,g), b(f,g), c(f,g),and d(f,g) are the numbers in the contingency table of f and g.[That is, a(f,g) (resp. d(f,g)) is the number of observations for which f and gboth have value 0 (resp. value 1); b(f,g) (resp. c(f,g)) is the number ofobservations for which f has value 0 (resp. 1) and g has value 1 (resp. 0).]The total association of a variable f is the sum of its associations to allvariables.}\section{Missing Values (\code{\link{NA}}s)}{The mona-algorithm requires \dQuote{pure} 0-1 values. However,\code{mona(x)} allows \code{x} to contain (not too many)\code{\link{NA}}s. In a preliminary step, these are \dQuote{imputed},i.e., all missing values are filled in. To do this, the same measureof association between variables is used as in the algorithm. When variablef has missing values, the variable g with the largest absolute associationto f is looked up. When the association between f and g is positive,any missing value of f is replaced by the value of g for the sameobservation. If the association between f and g is negative, then any missingvalue of f is replaced by the value of 1-g for the sameobservation.}\note{In \pkg{cluster} versions before 2.0.6, the algorithm entered aninfinite loop in the boundary case of one variable, i.e.,\code{ncol(x) == 1}, which currently signals an error (because thealgorithm now in C, haes not correctly taken account of this special case).%% FIXME ("patches are welcome")}\seealso{\code{\link{agnes}} for background and references;\code{\link{mona.object}}, \code{\link{plot.mona}}.}\examples{data(animals)ma <- mona(animals)ma## Plot similar to Figure 10 in Struyf et al (1996)plot(ma)## One place to see if/how error messages are *translated* (to 'de' / 'pl'):ani.NA <- animals; ani.NA[4,] <- NAaniNA <- within(animals, { end[2:9] <- NA })aniN2 <- animals; aniN2[cbind(1:6, c(3, 1, 4:6, 2))] <- NAani.non2 <- within(animals, end[7] <- 3 )ani.idNA <- within(animals, end[!is.na(end)] <- 1 )try( mona(ani.NA) ) ## error: .. object with all values missingtry( mona(aniNA) ) ## error: .. more than half missing valuestry( mona(aniN2) ) ## error: all have at least one missingtry( mona(ani.non2) ) ## error: all must be binarytry( mona(ani.idNA) ) ## error: ditto}\keyword{cluster}