Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: 2-stages cluster analysis


From   Stas Kolenikov <skolenik@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: 2-stages cluster analysis
Date   Tue, 14 Sep 2010 10:19:14 -0500

On Tue, Sep 14, 2010 at 6:01 AM, Giancarlo Musto
<sciacallojo@hotmail.com> wrote:
> I'd like to run on stata a cluster analysis in 2 stages, but I could not figure out how to do it. To be precise, in the first stage I need to create clusters on the basis of a set of variables, s1, and in the second stage I need to create clusters, within the groups formed in the first stage, using a different set of variables, s2.

I am not quite sure what you mean, but is it something like this?

cluster <method> <the first set of variables>, generate( stage1cl )
levelsof stage1cl
local stage1clusters `r(levelsof)'
forvalues k=1/`stage1clusters' {
   cluster <method> <the second set of variables>, generate( stage2cl`k')
}
egen stage2cl = group( stage2cl* ), missing

-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index