Re: [R] k-means / role of 'nstart'

From: Prof Brian Ripley <>
Date: Fri 02 Dec 2005 - 22:43:36 EST

On Fri, 2 Dec 2005, Charles Raux wrote:

> the k-means {stats} help and the Hartigan&Won paper say nothing about
> the way random sets works (parameter nstart). I would expect to get
> the different results for each random initial set but I always obtain
> only one result: how is it selected?

The code works as documented. It tries 'nstart' random starts, but reports (as it says)

      The data given by 'x' is clustered by the k-means method, which
      aims to partition the points into k groups such that the sum of
      squares from points to the assigned cluster centres is minimized.

that is the clustering with the smallest value of the criterion.

You could just read the code for the details.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Fri Dec 02 23:14:58 2005

This archive was generated by hypermail 2.1.8 : Sat 03 Dec 2005 - 02:27:52 EST