=== versions === python 3.12.0 | scikit-learn 1.9.1 | spopt 0.8.0 | libpysal 4.15.1 | geopandas 1.2.0 | numpy 2.5.4 | pandas 3.1.0 === Output Areas === 1,115 Output Areas in 218 LSOAs, 142.3 km2 === Census 2021 variables === 27 candidate variables for 1,115 OAs; 0 missing values Cardiff: 362,289 usual residents; OA population median 313, range 101-1730 mean 50% min max Aged 0-14 17.2 17.3 0.0 44.9 Aged 20-24 9.3 5.6 0.0 79.4 Aged 25-44 29.3 27.4 1.0 68.4 Aged 65+ 15.4 13.6 0.0 91.1 Population density 7135.5 5802.5 53.9 47887.3 One-person households 31.8 29.7 7.8 85.1 Lone parents 8.2 5.8 0.0 53.5 Owns outright 29.0 26.3 0.0 75.0 Owns with mortgage 29.6 30.4 0.7 87.5 Social rented 17.1 7.2 0.0 91.1 Private rented 23.8 16.4 0.0 91.0 Detached 14.4 4.3 0.0 98.4 Terraced 29.7 23.9 0.0 97.1 Flats 25.5 15.1 0.0 100.0 Overcrowded 3.9 3.0 0.0 27.1 No car 25.7 24.0 0.0 82.4 Higher professional 14.8 13.5 0.2 44.6 Routine occupations 19.8 18.0 0.6 50.3 Full-time students 12.4 7.4 0.0 95.2 Degree level (L4+) 40.7 41.1 7.6 82.2 No qualifications 17.1 15.1 0.0 59.5 Unemployed 2.9 2.6 0.0 37.2 Bad health 6.1 5.2 0.0 36.6 Asian 9.1 6.6 0.0 54.2 Black 3.7 2.2 0.0 51.0 Born outside UK 16.0 12.7 1.0 79.5 Welsh speakers 12.3 11.1 0.0 47.0 === transformation, standardisation and correlation === median |skewness|: raw 1.38 -> IHS 0.59; most skewed raw: Unemployed 4.4, Black 3.5, Aged 20-24 3.4 |r| >= 0.8: Higher professional ~ Degree level (L4+): r = 0.88 |r| >= 0.8: Routine occupations ~ No qualifications: r = 0.87 |r| >= 0.8: No qualifications ~ Bad health: r = 0.81 |r| >= 0.8: Aged 20-24 ~ Full-time students: r = 0.80 dropping ['Degree level (L4+)', 'Owns with mortgage']: degree level duplicates higher professional (r = 0.88); the four tenure shares sum to ~100%, so one is redundant 25 variables go into the clustering === k-means: choosing k === k= 2: within-cluster sum of squares 21192 | silhouette 0.224 k= 3: within-cluster sum of squares 17401 | silhouette 0.241 k= 4: within-cluster sum of squares 15966 | silhouette 0.217 k= 5: within-cluster sum of squares 14763 | silhouette 0.169 k= 6: within-cluster sum of squares 13916 | silhouette 0.154 k= 7: within-cluster sum of squares 13286 | silhouette 0.161 k= 8: within-cluster sum of squares 12873 | silhouette 0.144 k= 9: within-cluster sum of squares 12474 | silhouette 0.128 k=10: within-cluster sum of squares 12152 | silhouette 0.130 k=11: within-cluster sum of squares 11856 | silhouette 0.122 k=12: within-cluster sum of squares 11550 | silhouette 0.116 k=4: 30 single-start runs vs the 100-start solution, median ARI 0.416; mean pairwise ARI 0.787 k=5: 30 single-start runs vs the 100-start solution, median ARI 0.959; mean pairwise ARI 0.833 k=6: 30 single-start runs vs the 100-start solution, median ARI 0.728; mean pairwise ARI 0.698 k=7: 30 single-start runs vs the 100-start solution, median ARI 0.708; mean pairwise ARI 0.710 k=8: 30 single-start runs vs the 100-start solution, median ARI 0.649; mean pairwise ARI 0.628 k=9: 30 single-start runs vs the 100-start solution, median ARI 0.641; mean pairwise ARI 0.613 chosen k = 7 === final k-means classification === k = 7: mean silhouette 0.161; OAs with negative silhouette 5.3% cluster 0 (250 OAs, 82,074 people): high Social rented 252, Lone parents 220, No qualifications 178, Routine occupations 171 | low Detached 33, Higher professional 37, Degree level (L4+) 54 cluster 1 (241 OAs, 77,080 people): high Detached 301, Owns outright 174, Higher professional 168, Aged 65+ 159 | low Social rented 11, Black 19, Flats 21 cluster 2 (188 OAs, 53,202 people): high Aged 65+ 160, Owns outright 137, Bad health 124, One-person households 116 | low Black 33, Full-time students 36, Aged 20-24 42 cluster 3 (160 OAs, 54,194 people): high Population density 294, Black 244, Asian 211, Born outside UK 190 | low Detached 24, Aged 65+ 56, Owns outright 59 cluster 4 (160 OAs, 50,693 people): high Terraced 162, Higher professional 150, Welsh speakers 142, Degree level (L4+) 136 | low Social rented 33, Overcrowded 51, Black 56 cluster 5 (58 OAs, 15,124 people): high Flats 348, Private rented 253, Born outside UK 195, Aged 25-44 187 | low Detached 4, Lone parents 24, Social rented 30 cluster 6 (58 OAs, 29,922 people): high Full-time students 506, Aged 20-24 459, Population density 287, Private rented 253 | low Detached 17, Aged 0-14 19, Aged 65+ 21 1. Social-rented family estates 2. Detached owner-occupier suburbs 3. Older settled homeowners 4. Dense multicultural inner city 5. Professional terraces 6. City-centre renters in flats 7. Student quarter === comparison with the official 2021/2 OAC === matched 1115 of 1115 OAs to the official classification official supergroups in Cardiff: 1 Retired Professionals 111; 2 Suburbanites and Peri-Urbanites 113; 3 Multicultural and Educated Urbanites 139; 4 Low-Skilled Migrant and Student Communities 141; 5 Ethnically Diverse Suburb-an Professionals 182; 6 Baseline UK 374; 7 Semi- and Un-Skilled Workforce 44; 8 Legacy Communities 11 ARI between our k-means and the official supergroups (8 classes, UK-wide): 0.282 ARI against the official groups (21 present): 0.323 oac_sg 1 2 3 4 5 6 7 8 kmeans 0 0 0 5 35 2 183 23 2 1 106 34 0 0 101 0 0 0 2 5 70 2 0 24 58 21 8 3 0 0 41 93 0 26 0 0 4 0 9 0 7 52 92 0 0 5 0 0 53 0 0 4 0 1 6 0 0 38 6 3 11 0 0 === MAUP: repeat at LSOA level === 218 LSOAs, k = 7: silhouette 0.212; ARI with the OA classification (each OA takes its LSOA's cluster) 0.416 LSOAs whose OAs fall in more than one OA-level cluster: 70%; max-min range of 'Full-time students' within LSOAs, median 5.9 points === contiguity: spatial weights === queen contiguity: mean 6.0 neighbours, islands 0, connected components 1 === SKATER === SKATER with 7 regions, floor 20 OAs: 2.0 s; region sizes (OAs) [399, 242, 141, 129, 108, 53, 43] === max-p === max-p, every region >= 20,000 residents: p = 16 regions in 411.0 s; region populations 20,025-26,734 === comparison: how much homogeneity does contiguity cost? === k-means (no contiguity) : 7 groups | share of variance explained 0.523 | contiguous pieces on the map 157 SKATER : 7 groups | share of variance explained 0.344 | contiguous pieces on the map 7 max-p : 16 groups | share of variance explained 0.464 | contiguous pieces on the map 16 ARI k-means vs SKATER 0.266; k-means vs max-p 0.205 for reference, aspatial k-means with k = 16 explains 0.614 wrote output/cardiff_oa_classification.gpkg, output/metrics.json and 7 figures