Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I'm doing shopping cart analyses my dataset is set of transaction vectors, with the items the products being bought.

When applying k-means on the transactions, I will always get some result. A random matrix would probably also show some clusters.

Is there a way to test whether the clustering I find is a significant one, or that is can be very well be a coincidence. If yes, how can I do it.

share|improve this question
add comment

3 Answers

Regarding shopping cart analysis, I think that the main objective is to individuate the most frequent combinations of products bought by the customers. The association rules represent the most natural methodology here (indeed they were actually developed for this purpose). Analysing the combinations of products bought by the customers, and the number of times these combinations are repeated, leads to a rule of the type ‘if condition, then result’ with a corresponding interestingness measurement. You may also consider Log-linear models in order to investigate the associations between the considered variables.

Now as for clustering, here are some information that may come in handy:

At first consider Variable clustering. Variable clustering is used for assessing collinearity, redundancy, and for separating variables into clusters that can be scored as a single variable, thus resulting in data reduction. Look for the varclus function (package Hmisc in R)

Assessment of the clusterwise stability: function clusterboot {R package fpc}

Distance based statistics for cluster validation: function cluster.stats {R package fpc}

As mbq have mentioned, use the silhouette widths for assessing the best number of clusters. Watch this. Regarding silhouette widths, see also the optsil function.

Estimate the number of clusters in a data set via the gap statistic

For calculating Dissimilarity Indices and Distance Measures see dsvdis and vegdist

EM clustering algorithm can decide how many clusters to create by cross validation, (if you can't specify apriori how many clusters to generate). Although the EM algorithm is guaranteed to converge to a maximum, this is a local maximum and may not necessarily be the same as the global maximum. For a better chance of obtaining the global maximum, the whole procedure should be repeated several times, with different initial guesses for the parameter values. The overall log-likelihood figure can be used to compare the different final configurations obtained: just choose the largest of the local maxima. You can find an implementation of the EM clusterer in the open-source project WEKA

This is also an interesting link.

Also search here for Finding the Right Number of Clusters in k-Means and EM Clustering: v-Fold Cross-Validation

Finally, you may explore clustering results using clusterfly

share|improve this answer
1  
+1 Wow, nice list. –  mbq Jul 27 '10 at 9:51
    
Indeed, this is too much! –  chl Sep 16 '10 at 20:49
add comment
up vote 6 down vote accepted

This is a method using Monte Carlo to show whether a result is correct.

Our Null Hypothesis H_0 is that our dataset does not have an interesting clustering. Our alternative hypothesis H_1 is that our dataset contains an interesting clustering.

Hereby we think of interesting as, more interesting than the clustering structure of a random dataset with the same row and column margins. Of course other constraints could be chosen, but to loose constraints will make our result too general, and to narrow constraints will fix the clustering to much, therefore making our result insignificant automatically. The margins, as we will see, are a good choice because of the methods existing for randomizing with it.

Let's define as our test statistic the clustering error (squared in-cluster distance), T from Π_0. The value for our original dataset is t.

We don't know anything about this distribution, except that we can draw samples from it. Which makes it a good candidate for Monte Carlo.

Now we draw n (i.i.d) random samples from Π_0 and calculate the empirical p-value with the formula p_emp = 1 / (n+1) * (Σ_i=1-n I(t_i >= t) + 1)

The random sampling can be done by swap randomization. In simple words, a square is searched with on two opposite corners an 1 and on the other two corners a 0. Then the corners are flipped. This is keeping the column and row margins. The procedure is repeated enough times until the dataset is randomized enough (this will take some experiments). More info about this can be found in Assessing Data Mining Results via Swap Randomization by Gionis et. al.

One method to do this is defining the distribution of your data and taking the clustering error as test-statistic t.

For example, if we consider all data sets with the same row and column margins as being our data distribution, than we can take n random matrices Xi from this distribution and calculate the clustering error for them. Then we can calculate the emperical p-value by the formula

share|improve this answer
add comment

There is something like silhouette, which to some extent defines statistic that determines the cluster quality (for instance it is used in optimizing k). Now a possible Monte Carlo would go as follows: you generate a lot of random dataset similar to your original (for instance by shuffling values between rows in each column), cluster and obtain a distribution of mean silhouette that then may be used to test significance of silhouette in real data. Still I admin that I have never tried this idea.

share|improve this answer
1  
This remind me of a poster I saw at the Human Brain Mapping 2010 conference. Tom Nichols used parametric bootstrap to assess the stability of the cophenetic correlation and silhouette in hierarchical clustering, but see his poster: j.mp/9yXObA. –  chl Aug 26 '10 at 13:27
    
@chl Thanks; indeed recently I have seen similar thing done in my lab; the result was that the clusters are not significant though :-/ –  mbq Aug 26 '10 at 15:50
    
I agree that this sounds like bootstrapping. –  Vass Sep 20 '11 at 17:41
    
(FYI: interpretation of silhouette value). Also, note that the silhouette value is not defined for the k = 1 cluster, so we cannot compare the hypothesis k=1 (i.e. dataset is unclustered) vs. k>1 (dataset is clustered) using the silhouette value. –  Franck Dernoncourt Nov 28 '13 at 19:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.