Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: clustering analysis


From   Sergio Correia <[email protected]>
To   [email protected]
Subject   Re: st: clustering analysis
Date   Tue, 6 Dec 2005 16:15:35 -0500

the cluster commands uses a "randomized start". So you just need to write this
set seed 123456
before each cluster kmeans..


Eg:

sysuse auto
set seed 123456
cluster kmeans price, k(2)
set seed 123456
cluster kmeans price, k(2)
set seed 123456
cluster kmeans price, k(2)
list  _*

You will see they all belong to the same group

Sergio

On 06 Dec 2005 17:31:35 +0000, Vasilis.Sarafidis <[email protected]> wrote:
> Statalist,
>
> I am using the command "cluster kmeans" in order to cluster a sample of
> objects on the basis of predefined attributes.
>
> The thing is that everytime I run the command, the identity of the clusters
> changes, although the allocation of the objects is always the same. In
> other words, if there are 2 clusters only, then the first cluster takes one
> time the value of 1 and another time the value of 2. And vice versa for
> cluster 2.
>
> The problem is that in my case I want to simulate some attributes and check
> how well does the clustering command do (on average) in allocating the
> objects into the correct clusters.
>
> Notice that all the objects are ordered, in the sense that the first N/2
> objects (that belong to the first cluster) are entered first.
>
> Is there any way I can tell the program to make the identity of the first
> cluster always equal to 1 and the identity of the second cluster equal to
> 2? Then in each replication I can easily find out whether the
> cross-sections have been allocated in the correct cluster.
>
> Many thanks for your help.
>
> Vasilis
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index