Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Commands for cluster analysis


From   "Ping Zheng" <[email protected]>
To   <[email protected]>
Subject   st: Commands for cluster analysis
Date   Sun, 18 Sep 2005 19:24:19 +0100

Thanks to Rose,Ken,and Edward re commands for cluster analysis, which
are really helpful. Some relevant results as below, please give me your
thoughts.

Many thanks
Ping

. tabstat lex lim ldistance lrgdp lrggdp lrlend lrreer lwage linflation,
by(g4fdi)

Summary statistics: mean
  by categories of: g4fdi 

   g4fdi |       lex       lim  ldista~e     lrgdp    lrggdp    lrlend
---------+------------------------------------------------------------
       1 |  11.70287  11.75353  7.830754  1.788064  .2604277 -.2605892
       2 |  11.11111  11.37182  8.533195   .319844  1.336287 -.0405031
       3 |  9.363998  9.583518  8.239245  1.694589  1.210532 -.1789846
       4 |  13.39098  13.31562  8.092588  -.719144   1.22336  .0408911
---------+------------------------------------------------------------
   Total |  11.27346   11.4112  8.244404  .6569397   1.11764 -.0906255
----------------------------------------------------------------------

   g4fdi |    lrreer     lwage  linfla~n
---------+------------------------------
       1 | -.7085942  5.779295  1.447508
       2 | -.0132627  7.681588  .8773309
       3 |   .530788  7.087625  1.462201
       4 | -.1026447  7.380286  .8768234
---------+------------------------------
   Total |  .0112206  7.169584  1.119322
----------------------------------------

. tabstat lex lim ldistance lrgdp lrggdp lrlend lrreer lwage linflation,
by(g2fdi)

Summary statistics: mean
  by categories of: g2fdi 

   g2fdi |       lex       lim  ldista~e     lrgdp    lrggdp    lrlend
---------+------------------------------------------------------------
       1 |  12.45223  12.55147  8.240625 -.0015547  1.149241 -.0392598
       2 |  9.911988  10.09418  8.248768  1.417501  1.081141  -.149953
---------+------------------------------------------------------------
   Total |  11.27346   11.4112  8.244404  .6569397   1.11764 -.0906255
----------------------------------------------------------------------

   g2fdi |    lrreer     lwage  linfla~n
---------+------------------------------
       1 | -.2421599  7.238282  .9433997
       2 |  .3038751  7.090239  1.322512
---------+------------------------------
   Total |  .0112206  7.169584  1.119322
----------------------------------------
. 
. cluster stop g2fdi

+---------------------------+
|             |  Calinski/  |
|  Number of  |  Harabasz   |
|  clusters   |  pseudo-F   |
|-------------+-------------|
|      2      |   202.88    |
+---------------------------+

. cluster stop g3fdi

+---------------------------+
|             |  Calinski/  |
|  Number of  |  Harabasz   |
|  clusters   |  pseudo-F   |
|-------------+-------------|
|      3      |   153.19    |
+---------------------------+

. cluster stop g4fdi

+---------------------------+
|             |  Calinski/  |
|  Number of  |  Harabasz   |
|  clusters   |  pseudo-F   |
|-------------+-------------|
|      4      |   137.33    |
+---------------------------+

. cluster stop g5fdi

+---------------------------+
|             |  Calinski/  |
|  Number of  |  Harabasz   |
|  clusters   |  pseudo-F   |
|-------------+-------------|
|      5      |   139.52    |
+---------------------------+

. tab g2fdi

      g2fdi |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        231       53.60       53.60
          2 |        200       46.40      100.00
------------+-----------------------------------
      Total |        431      100.00

. xtreg  lfdi lex lim ldistance lrgdp lrggdp lrlend lrreer lwage
linflation td cd, i(g2fdi) re

Random-effects GLS regression                   Number of obs      =
397
Group variable (i): g2fdi                       Number of groups   =
2

R-sq:  within  = 0.6105                         Obs per group: min =
168
       between = 1.0000                                        avg =
198.5
       overall = 0.7794                                        max =
229

Random effects u_i ~ Gaussian                   Wald chi2(11)      =
1360.38
corr(u_i, X)       = 0 (assumed)                Prob > chi2        =
0.0000

------------------------------------------------------------------------
------
        lfdi |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------
------
         lex |   1.032928   .0881265    11.72   0.000     .8602035
1.205653
         lim |   .3999493   .0979743     4.08   0.000     .2079232
.5919754
   ldistance |  -.1566927   .1476902    -1.06   0.289    -.4461603
.1327748
       lrgdp |   .2453054    .062861     3.90   0.000        .1221
.3685107
      lrggdp |   .1690027   .0682614     2.48   0.013     .0352129
.3027925
      lrlend |   .3372758   .1800593     1.87   0.061    -.0156339
.6901855
      lrreer |   .1218383   .0632187     1.93   0.054     -.002068
.2457446
       lwage |   .1485923   .1002688     1.48   0.138    -.0479309
.3451156
  linflation |  -.0464581   .0819025    -0.57   0.571    -.2069842
.1140679
          td |  -.4917145   .1543484    -3.19   0.001    -.7942319
-.1891972
          cd |   .2796337   .2823572     0.99   0.322    -.2737763
.8330436
       _cons |  -7.873095   1.589752    -4.95   0.000    -10.98895
-4.757238
-------------+----------------------------------------------------------
------
     sigma_u |          0
     sigma_e |  1.1475962
         rho |          0   (fraction of variance due to u_i)
------------------------------------------------------------------------
------

. tab g4fdi

      g4fdi |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |         63       14.62       14.62
          2 |        147       34.11       48.72
          3 |        117       27.15       75.87
          4 |        104       24.13      100.00
------------+-----------------------------------
      Total |        431      100.00

. xtreg  lfdi lex lim ldistance lrgdp lrggdp lrlend lrreer lwage
linflation td cd, i(g4fdi) re

Random-effects GLS regression                   Number of obs      =
397
Group variable (i): g4fdi                       Number of groups   =
4

R-sq:  within  = 0.5548                         Obs per group: min =
63
       between = 0.9978                                        avg =
99.3
       overall = 0.7794                                        max =
140

Random effects u_i ~ Gaussian                   Wald chi2(11)      =
1360.38
corr(u_i, X)       = 0 (assumed)                Prob > chi2        =
0.0000

------------------------------------------------------------------------
------
        lfdi |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------
------
         lex |   1.032928   .0881265    11.72   0.000     .8602035
1.205653
         lim |   .3999493   .0979743     4.08   0.000     .2079232
.5919754
   ldistance |  -.1566927   .1476902    -1.06   0.289    -.4461603
.1327748
       lrgdp |   .2453054    .062861     3.90   0.000        .1221
.3685107
      lrggdp |   .1690027   .0682614     2.48   0.013     .0352129
.3027925
      lrlend |   .3372758   .1800593     1.87   0.061    -.0156339
.6901855
      lrreer |   .1218383   .0632187     1.93   0.054     -.002068
.2457446
       lwage |   .1485923   .1002688     1.48   0.138    -.0479309
.3451156
  linflation |  -.0464581   .0819025    -0.57   0.571    -.2069842
.1140679
          td |  -.4917145   .1543484    -3.19   0.001    -.7942319
-.1891972
          cd |   .2796337   .2823572     0.99   0.322    -.2737763
.8330436
       _cons |  -7.873095   1.589752    -4.95   0.000    -10.98895
-4.757238
-------------+----------------------------------------------------------
------
     sigma_u |          0
     sigma_e |  1.1609532
         rho |          0   (fraction of variance due to u_i)
------------------------------------------------------------------------
------


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index