cluster analysis (k-mean) - additional option

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

cluster analysis (k-mean) - additional option

Iwona Pil
hello,

if anyone knows how to modify the syntax for the k-mean cluster analysis to counted in one macro solution for 2, 3, 4 and 5 clusters? I remember that it was a small change in the macro...

Reply | Threaded
Open this post in threaded view
|

Re: cluster analysis (k-mean) - additional option

Art Kendall
I noticed that nobody responded to this post.

(1) take a look at TWOSTEP which can give you a range of solutions and AIC or BIC as an aid for a stopping rule.

David - ignore this post.

(2) do not bother with a macro.

simply copy and paste your syntax 3 more times.

using the editor substitute 3 for the 2, then 4 for the 2, then 5 for the 2.
so you have
/CRITERIA=CLUSTER(2)
/CRITERIA=CLUSTER(3)
/CRITERIA=CLUSTER(4)
/CRITERIA=CLUSTER(5)

That is basically what a macro would do.

However unless you have a huge number of cases, you should consider CLUSTER.
Art Kendall
Social Research Consultants
On 11/12/2013 2:02 PM, iwopil [via SPSSX Discussion] wrote:
hello,

if anyone knows how to modify the syntax for the k-mean cluster analysis to counted in one macro solution for 2, 3, 4 and 5 clusters? I remember that it was a small change in the macro...




If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/cluster-analysis-k-mean-additional-option-tp5723007.html
To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: cluster analysis (k-mean) - additional option

Bruce Weaver
Administrator
"David - ignore this post."

Art, you didn't think that would really work, did you?  ;-)

This is untested.

DEFINE !QC (!POS !TOKENS(1) / !POS !TOKENS(1))
!DO !n = !1 !TO !2
QUICK CLUSTER {your variable list}
  /CRITERIA=CLUSTER(!n)
 { other sub-commands you want }
.
!DOEND
!ENDDEFINE

!QC 2 5.


Art Kendall wrote
I noticed that nobody
        responded to this post.
       
        (1) take a look at TWOSTEP which can give you a range of
        solutions and AIC or BIC as an aid for a stopping rule.
       
        David - ignore this post.
       
        (2) do not bother with a macro.
       
        simply copy and paste your syntax 3 more times.
       
        using the editor substitute 3 for the 2, then 4 for the 2, then
        5 for the 2.
        so you have
      /CRITERIA=CLUSTER(2)
        /CRITERIA=CLUSTER(3)
            /CRITERIA=CLUSTER(4)
          /CRITERIA=CLUSTER(5)
         
          That is basically what a macro would do.
         
          However unless you have a huge number of cases, you should
          consider CLUSTER.
       
      Art Kendall
Social Research Consultants
      On 11/12/2013 2:02 PM, iwopil [via SPSSX Discussion] wrote:
   
     hello,
     
     
      if anyone knows how to modify the syntax for the k-mean cluster
      analysis to counted in one macro solution for 2, 3, 4 and 5
      clusters? I remember that it was a small change in the macro...
     
     
     
     
     
        If you reply to this email, your
          message will be added to the discussion below:
        http://spssx-discussion.1045642.n5.nabble.com/cluster-analysis-k-mean-additional-option-tp5723007.html 
     
     
        To start a new topic under SPSSX Discussion, email
        [hidden email] 
        To unsubscribe from SPSSX Discussion, click
          here .
        NAML
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: cluster analysis (k-mean) - additional option

Art Kendall
no i didn't but writing a macro for 4 short snippets of syntax  could be over kill.

Also it would be better to use TWOSTEP and hierarchical clustering  so that one can decide how many clusters to retain by something other than gut feeling.
Art Kendall
Social Research Consultants
On 11/23/2013 5:58 PM, Bruce Weaver [via SPSSX Discussion] wrote:
"David - ignore this post."

Art, you didn't think that would really work, did you?  ;-)

This is untested.

DEFINE !QC (!POS !TOKENS(1) / !POS !TOKENS(1))
!DO !n = !1 !TO !2
QUICK CLUSTER {your variable list}
  /CRITERIA=CLUSTER(!n)
 { other sub-commands you want }
.
!DOEND
!ENDDEFINE

!QC 2 5.


Art Kendall wrote
I noticed that nobody
        responded to this post.
       
        (1) take a look at TWOSTEP which can give you a range of
        solutions and AIC or BIC as an aid for a stopping rule.
       
        David - ignore this post.
       
        (2) do not bother with a macro.
       
        simply copy and paste your syntax 3 more times.
       
        using the editor substitute 3 for the 2, then 4 for the 2, then
        5 for the 2.
        so you have
      /CRITERIA=CLUSTER(2)
        /CRITERIA=CLUSTER(3)
            /CRITERIA=CLUSTER(4)
          /CRITERIA=CLUSTER(5)
         
          That is basically what a macro would do.
         
          However unless you have a huge number of cases, you should
          consider CLUSTER.
       
      Art Kendall
Social Research Consultants
      On 11/12/2013 2:02 PM, iwopil [via SPSSX Discussion] wrote:
   
     hello,
     
     
      if anyone knows how to modify the syntax for the k-mean cluster
      analysis to counted in one macro solution for 2, 3, 4 and 5
      clusters? I remember that it was a small change in the macro...
     
     
     
     
     
        If you reply to this email, your
          message will be added to the discussion below:
        http://spssx-discussion.1045642.n5.nabble.com/cluster-analysis-k-mean-additional-option-tp5723007.html 
     
     
        To start a new topic under SPSSX Discussion, email
        [hidden email] 
        To unsubscribe from SPSSX Discussion, click
          here .
        NAML
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.



If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/cluster-analysis-k-mean-additional-option-tp5723007p5723271.html
To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: cluster analysis (k-mean) - additional option

Kirill Orlov
Why gut feeling, Art? We usually compare (a range of) cluster solutions by a clustering criterion (including those BIC/AIC) after we got and saved all the solutions (and I have a number of popular clustering criterions on my page rivita.ru/spssmacros_en.shtml to do it). The TWOSTEP's in-built option to estimate the number of clusters during the clusterization looks attractive feature but actually is risky. I, in particular, may recommend using it only with really big data.

24.11.2013 4:28, Art Kendall пишет:

Also it would be better to use TWOSTEP and hierarchical clustering  so that one can decide how many clusters to retain by something other than gut feeling.

Reply | Threaded
Open this post in threaded view
|

Re: cluster analysis (k-mean) - additional option

Art Kendall
Yes TWOSTEP like all exploratory heuristic algorithms has risky aspects.
That is why I recommend also looking at multiple hierarchical solutions also.  I usually recommend using a few randomizations of cases when using QUICK CLUSTER and TWOSTEP.

It is good to know about those macros. They look great, I'll give them a try.
You seem to have many tools on you page that would be related to math psych. Is that your background?
These tools are also the kinds of things that are subjects at the Classification Society and the International Federation of Classification Societies. Do you follow them?

However, an OP who does not know how to change 1 character in a snippet of syntax, is hardly going to be trying to use macros.
Art Kendall
Social Research Consultants
On 11/24/2013 12:13 AM, Kirill Orlov [via SPSSX Discussion] wrote:
Why gut feeling, Art? We usually compare (a range of) cluster solutions by a clustering criterion (including those BIC/AIC) after we got and saved all the solutions (and I have a number of popular clustering criterions on my page rivita.ru/spssmacros_en.shtml to do it). The TWOSTEP's in-built option to estimate the number of clusters during the clusterization looks attractive feature but actually is risky. I, in particular, may recommend using it only with really big data.

24.11.2013 4:28, Art Kendall пишет:

Also it would be better to use TWOSTEP and hierarchical clustering  so that one can decide how many clusters to retain by something other than gut feeling.




If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/cluster-analysis-k-mean-additional-option-tp5723007p5723274.html
To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: cluster analysis (k-mean) - additional option

David Marso
Administrator
"However, an OP who does not know how to change 1 character in a snippet of syntax, is hardly going to be trying to use macros."
Drum Roll!

Art Kendall wrote
Yes TWOSTEP like all
        exploratory heuristic algorithms has risky aspects.
      That is why I recommend also looking at multiple hierarchical
      solutions also.  I usually recommend using a few randomizations of
      cases when using QUICK CLUSTER and TWOSTEP.
     
      It is good to know about those macros. They look great, I'll give
      them a try.
      You seem to have many tools on you page that would be related to
      math psych. Is that your background?
      These tools are also the kinds of things that are subjects at the
      Classification Society and the International Federation of
      Classification Societies. Do you follow them?
     
      However, an OP who does not know how to change 1 character in a
      snippet of syntax, is hardly going to be trying to use macros.
      Art Kendall
Social Research Consultants
      On 11/24/2013 12:13 AM, Kirill Orlov [via SPSSX Discussion] wrote:
   
   
     
      Why gut feeling, Art? We usually compare (a range of) cluster
      solutions by a clustering criterion (including those BIC/AIC) after

      we got and saved all the solutions (and I have a number of
      popular clustering criterions on my page
      rivita.ru/spssmacros_en.shtml to do it). The TWOSTEP's in-built
      option to estimate the number of clusters during the
      clusterization looks attractive feature but actually is risky. I,
      in particular, may recommend using it only with really big data.
     
      24.11.2013 4:28, Art Kendall пишет:
     
     
       
       
         Also it would be
            better to use TWOSTEP and hierarchical clustering  so that
            one can decide how many clusters to retain by something
            other than gut feeling.
       
     
     
     
     
     
     
        If you reply to this email, your
          message will be added to the discussion below:
        http://spssx-discussion.1045642.n5.nabble.com/cluster-analysis-k-mean-additional-option-tp5723007p5723274.html 
     
     
        To start a new topic under SPSSX Discussion, email
        [hidden email] 
        To unsubscribe from SPSSX Discussion, click
          here .
        NAML
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"