Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: 2-stages cluster analysis
From
Stas Kolenikov <[email protected]>
To
[email protected]
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
<[email protected]> 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/