Sergio,
This appears to do the job! Thank you very much for your help!
Vasilis
On Dec 6 2005, Sergio Correia wrote:
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/
--
If I could get my membership fee back, I'd resign from the human race.
Fred Allen (1894 - 1956)
*
* 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/