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   Matt Loke <sciacallojo@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
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.
 
Thanks,
Matt

> Date: Tue, 14 Sep 2010 10:19:14 -0500
> Subject: Re: st: 2-stages cluster analysis
> From: skolenik@gmail.com
> To: statalist@hsphsun2.harvard.edu
> 
> 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/
 		 	   		  
*
*   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