Hi ftr,
I must correct myself and apologize, for something is wrong indeed. I
tried R with your datafile of August 26 and got good results even with
the same initial centers.
> library("haven")
+ data <- read_sav("ESS11 4.2 sample.sav")
+ head(data)
> > # A tibble: 6 × 7
idno pspwght cntry country community2 ego2 order2
<dbl> <dbl> <chr+lbl> <dbl+lbl> <dbl> <dbl> <dbl>
1 50057 4.00 AT [Austria] 1 [Austria] 1.12 0.0724 -0.111
2 50248 0.509 AT [Austria] 1 [Austria] -0.940 -1.02 0.636
3 50311 1.39 AT [Austria] 1 [Austria] 1.04 0.373 0.982
4 50427 1.73 AT [Austria] 1 [Austria] -0.307 0.309 0.571
5 50441 1.03 AT [Austria] 1 [Austria] 0.146 0.352 1.73
6 50465 0.468 AT [Austria] 1 [Austria] 1.32 -0.349 -1.17
> df <- as.data.frame(data[,5:7])
+ df <- df[!is.na(df$community2),]
+ df <- df[!is.na(df$ego2),]
+ df <- df[!is.na(df$order2),]
+ dim(df)
[1] 4668 3
> set.seed(654321)
+ res3 <- kmeans(df, centers=3)
+ res3$size
[1] 1162 1954 1552
> centers <- matrix(c(2.02, -4.44, .58, .61, -2.30, -2.99, -3.33,
-2.62, 2.59), ncol = 3)
+ centers
> [,1] [,2] [,3]
[1,] 2.02 0.61 -3.33
[2,] -4.44 -2.30 -2.62
[3,] 0.58 -2.99 2.59
> set.seed(654321)
+ resc <- kmeans(df, centers=centers)
+ resc$size
> > [1] 1958 1222 1488
>
On 8/29/26 16:03, Frans Houweling wrote:
Hi,
I am by no means an expert.
You get NaN because cluster 3 has no cases. That's because no case is
closer to the 3rd cluster centers than to the other ones. Why do you
see a contradiction with factor analysis? Factor analysis studies
variables, not respondents.
On 8/28/26 22:10, ftr wrote:
Hi,
I look for guidance how to understand the following result of a Quick
Cluster analysis. Before the cluster analysis I factor analysed
Schwartz's 21 Human Values item, dropped cases with a response set
and got a KMO of .89 for the factor analysis. The factors are close
to the study hypotheses.
Now I want to use the three factors community, ego, and order to
create a typology and start with k=3 clusters. For this step I took a
10% sample of the initial more than 50,000 cases to reduce
computation time. The three input factors are standardised before the
clustering. All cases with missing data are excluded (listwise
deletion).
The result is incomprehensible to me. Where does the NaN result for
one cluster may come from ? And the sizes of the 3 clusters are so
different that there must be an error somewhere.
Any ideas ?
Thanks in advance
-ftr
Descriptive Statistics
N Mean Std Dev Minimum Maximum
community2 4738,97 ,01 ,89 -3,73 2,38
ego2 4738,97 ,00 ,92 -3,26 2,53
order2 4738,97 -,03 ,85 -3,28 2,24
Valid N (listwise) 5155,35
Missing N (listwise) 416,38
QUICK CLUSTER zcommunity2 zego2 zorder2
/CRITERIA=CLUSTERS(3) NOINITIAL
/MISSING=EXCLUDE
/PRINT=INITIAL CLUSTER
/SAVE=CLUSTER(clus3t) DISTANCE(distclus3t).
Initial Cluster Centers
Cluster
1 2 3
Z-score of community2 ,04 1,06 ,70
Z-score of ego2 ,84 1,10 -,72
Z-score of order2 -,84 1,10 -,40
Final Cluster Centers
Cluster
1 2 3
Z-score of community2 -,05 1,37 NaN
Z-score of ego2 -,10 2,75 NaN
Z-score of order2 -,09 2,50 NaN
Number of Cases in each Cluster
Count
Cluster 1 2132
2 81
3 0
Valid 2213