Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

RE: st: 2-stages cluster analysis

From   Matt Loke <>
To   <>
Subject   RE: st: 2-stages cluster analysis
Date   Tue, 21 Sep 2010 06:10:13 +0200

Thanks for your help. Nevertheless, I need you to explain me the command lines you posted. Indeed, the command cluster creates three variables (stage1cl_id, stage1cl_ord and stage1cl_hgt). I thought that the one you were referring to was stage1cl_hgt. Anyway, the loop gives me a syntax error.
I'll take also advantage to explain better what I need to do. I have observations at the individuals level. I want to create groups of individuals based on the age and the geographic location. Then, within these groups I'd like to obtain subgroups based on bunch of other variables.
I hope I was clearer.

> Date: Tue, 14 Sep 2010 10:19:14 -0500
> Subject: Re: st: 2-stages cluster analysis
> From:
> To:
> On Tue, Sep 14, 2010 at 6:01 AM, Giancarlo Musto
> <> 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
> Small print: I use this email account for mailing lists only.
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index