data(package = .packages(all.available = TRUE))

Introduction and descriptive statistics

In this assignment, we will cluster data using a data set taken from R.

library(ggplot2)
mydata <- force(midwest)
mydata$ID <- seq(1, nrow(mydata))
              
head(mydata, 6)
## # A tibble: 6 × 29
##     PID county   state  area poptotal popdensity popwhite popblack popamerindian
##   <int> <chr>    <chr> <dbl>    <int>      <dbl>    <int>    <int>         <int>
## 1   561 ADAMS    IL    0.052    66090      1271.    63917     1702            98
## 2   562 ALEXAND… IL    0.014    10626       759      7054     3496            19
## 3   563 BOND     IL    0.022    14991       681.    14477      429            35
## 4   564 BOONE    IL    0.017    30806      1812.    29344      127            46
## 5   565 BROWN    IL    0.018     5836       324.     5264      547            14
## 6   566 BUREAU   IL    0.05     35688       714.    35157       50            65
## # ℹ 20 more variables: popasian <int>, popother <int>, percwhite <dbl>,
## #   percblack <dbl>, percamerindan <dbl>, percasian <dbl>, percother <dbl>,
## #   popadults <int>, perchsd <dbl>, percollege <dbl>, percprof <dbl>,
## #   poppovertyknown <int>, percpovertyknown <dbl>, percbelowpoverty <dbl>,
## #   percchildbelowpovert <dbl>, percadultpoverty <dbl>,
## #   percelderlypoverty <dbl>, inmetro <int>, category <chr>, ID <int>
mydata$inmetroF <- factor(mydata$inmetro, 
                            levels = c("0", "1"), 
                            labels = c("No", "Yes"))

We selected the data set, then converted the variable “inmetro” into a factor, and applied a function to remove NA values.

library(tidyr)
mydata <- drop_na(mydata)
head(mydata)
## # A tibble: 6 × 30
##     PID county   state  area poptotal popdensity popwhite popblack popamerindian
##   <int> <chr>    <chr> <dbl>    <int>      <dbl>    <int>    <int>         <int>
## 1   561 ADAMS    IL    0.052    66090      1271.    63917     1702            98
## 2   562 ALEXAND… IL    0.014    10626       759      7054     3496            19
## 3   563 BOND     IL    0.022    14991       681.    14477      429            35
## 4   564 BOONE    IL    0.017    30806      1812.    29344      127            46
## 5   565 BROWN    IL    0.018     5836       324.     5264      547            14
## 6   566 BUREAU   IL    0.05     35688       714.    35157       50            65
## # ℹ 21 more variables: popasian <int>, popother <int>, percwhite <dbl>,
## #   percblack <dbl>, percamerindan <dbl>, percasian <dbl>, percother <dbl>,
## #   popadults <int>, perchsd <dbl>, percollege <dbl>, percprof <dbl>,
## #   poppovertyknown <int>, percpovertyknown <dbl>, percbelowpoverty <dbl>,
## #   percchildbelowpovert <dbl>, percadultpoverty <dbl>,
## #   percelderlypoverty <dbl>, inmetro <int>, category <chr>, ID <int>,
## #   inmetroF <fct>

Explanation of the data set:

The sample size of our data contains 437 rows and 28 variables.

  1. PID - Unique county identifier.

  2. county - County name.

  3. state - State to which county belongs to.

  4. area - Area of county (units unknown).

  5. poptotal - Total population.

  6. popdensity - Population density (person/unit area).

  7. popwhite - Number of whites.

  8. popblack - Number of blacks.

  9. popamerindian - Number of American Indians.

  10. popasian - Number of Asians.

  11. popother - Number of other races.

  12. percwhite - Percent white.

  13. percblack - Percent black.

  14. percamerindan - Percent American Indian.

  15. percasian - Percent Asian.

  16. percother - Percent other races.

  17. popadults - Number of adults.

  18. perchsd - Percent with high school diploma.

  19. percollege - Percent college educated.

  20. percprof - Percent with professional degree.

  21. poppovertyknown - Population with known poverty status.

  22. percpovertyknown - Percent of population with known poverty status.

  23. percbelowpoverty - Percent of people below poverty line.

  24. percchildbelowpovert - Percent of children below poverty line.

  25. percadultpoverty - Percent of adults below poverty line.

  26. percelderlypoverty - Percent of elderly below poverty line.

  27. inmetro - County considered in a metro area.

  28. category - Miscellaneous.

For clustering purposes, I have decided to use these variables, and now I will show the descriptive statistics

summary(mydata[,c(30,18,19,20,23)])
##  inmetroF     perchsd        percollege        percprof       percbelowpoverty
##  No :287   Min.   :46.91   Min.   : 7.336   Min.   : 0.5203   Min.   : 2.180  
##  Yes:150   1st Qu.:71.33   1st Qu.:14.114   1st Qu.: 2.9980   1st Qu.: 9.199  
##            Median :74.25   Median :16.798   Median : 3.8142   Median :11.822  
##            Mean   :73.97   Mean   :18.273   Mean   : 4.4473   Mean   :12.511  
##            3rd Qu.:77.20   3rd Qu.:20.550   3rd Qu.: 4.9493   3rd Qu.:15.133  
##            Max.   :88.90   Max.   :48.079   Max.   :20.7913   Max.   :48.691

Explanation of the parameters

  1. Minimum percollege: The minimum percent of a college educated a Midwest county in this data set has is 7.34%.

  2. Maximum percbelowpoverty: The maximum percent of people below poverty line a Midwest county in this data set has is 48.69%.

  3. Mean percprof: A Midwest counties in this data set have on average 4.45% people with professional degree. ## Research question:

Can we group these units (counties) based on the procent of people within them with professional degree, percent of college educated, percent of people with high school diploma and percent of people below poverty line?

To check whether this data is suitable for clustering, I will use Hopkins statistics.

First, I will standardize the variables that will be used.

mydata$perchsd_z <- scale(mydata$perchsd)
mydata$percollege_z <- scale(mydata$percollege)
mydata$percprof_z <- scale(mydata$percprof)
mydata$percbelowpoverty_z <- scale(mydata$percbelowpoverty)

Now, I will check that the previously standardized variables that will be used for clustering are not too strongly correlated among themselves.

library(Hmisc)
## 
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:base':
## 
##     format.pval, units
rcorr(as.matrix(mydata[ , c("perchsd_z", "percollege_z", "percprof_z","percbelowpoverty_z")]),
      type = "pearson")
##                    perchsd_z percollege_z percprof_z percbelowpoverty_z
## perchsd_z               1.00         0.78       0.63              -0.59
## percollege_z            0.78         1.00       0.89              -0.28
## percprof_z              0.63         0.89       1.00              -0.15
## percbelowpoverty_z     -0.59        -0.28      -0.15               1.00
## 
## n= 437 
## 
## 
## P
##                    perchsd_z percollege_z percprof_z percbelowpoverty_z
## perchsd_z                    0.000        0.000      0.000             
## percollege_z       0.000                  0.000      0.000             
## percprof_z         0.000     0.000                   0.002             
## percbelowpoverty_z 0.000     0.000        0.002

We can see some correlation among the variables; however, we will retain them as cluster variables nonetheless.

Now I will check for outliers within this data. To do so, let’s observe the measure of dissimilarity.

mydata$Dissimilarity <- sqrt(mydata$perchsd_z^2 + mydata$percollege_z^2 + mydata$percprof_z^2 + mydata$percbelowpoverty_z^2 )
head(mydata[order(-mydata$Dissimilarity), ], 10)
## # A tibble: 10 × 35
##      PID county  state  area poptotal popdensity popwhite popblack popamerindian
##    <int> <chr>   <chr> <dbl>    <int>      <dbl>    <int>    <int>         <int>
##  1  1277 WASHTE… MI    0.041   282937      6901.   236390    31720          1076
##  2  3020 MENOMI… WI    0.021     3890       185.      416        0          3469
##  3   570 CHAMPA… IL    0.058   173025      2983.   146506    16559           331
##  4   715 MONROE  IN    0.024   108978      4541.   102752     2835           216
##  5  2993 DANE    WI    0.073   367085      5029.   344617    10511          1201
##  6   582 DU PAGE IL    0.02    781666     39083.   714905    15462           962
##  7   599 JACKSON IL    0.036    61067      1696.    51991     6342           109
##  8   691 HAMILT… IN    0.024   108936      4539    106764      676           163
##  9   741 TIPPEC… IN    0.03    130598      4353.   122013     2660           320
## 10  2046 HOLMES  OH    0.025    32849      1314.    32706       52            24
## # ℹ 26 more variables: popasian <int>, popother <int>, percwhite <dbl>,
## #   percblack <dbl>, percamerindan <dbl>, percasian <dbl>, percother <dbl>,
## #   popadults <int>, perchsd <dbl>, percollege <dbl>, percprof <dbl>,
## #   poppovertyknown <int>, percpovertyknown <dbl>, percbelowpoverty <dbl>,
## #   percchildbelowpovert <dbl>, percadultpoverty <dbl>,
## #   percelderlypoverty <dbl>, inmetro <int>, category <chr>, ID <int>,
## #   inmetroF <fct>, perchsd_z <dbl[,1]>, percollege_z <dbl[,1]>, …

Based on this we can say that some units could be problematic, but we will see later in none of the units have a high dissimilarity which warrants a removal

library(factoextra)
## Warning: package 'factoextra' was built under R version 4.3.2
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
distance <- get_dist(mydata[c("perchsd_z", "percollege_z", "percprof_z", "percbelowpoverty_z")],
                     method = "euclidian") 
distance2 <- distance^2 
fviz_dist(distance2,
          gradient = list(low = "yellow", mid = "lightgrey", high = "blue"))

get_clust_tendency(mydata[c("perchsd_z", "percollege_z", "percprof_z", "percbelowpoverty_z")],
                   n = nrow(mydata) - 1,
                   graph = FALSE)
## $hopkins_stat
## [1] 0.9059319
## 
## $plot
## NULL

We want the Hopkins value to be above 0.5 at the very least as a cut-off rule-of-the-thumb point. I got roughly 0.91, witch is great and says that the data is clusterable according to Hopkins, but we will see just how well later on.

Clustering

Dendogram

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:Hmisc':
## 
##     src, summarize
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
WARD <- mydata[c("perchsd_z", "percollege_z", "percprof_z", "percbelowpoverty_z")] %>%
           get_dist(method = "euclidian") %>%
           hclust(method = "ward.D2")

WARD
## 
## Call:
## hclust(d = ., method = "ward.D2")
## 
## Cluster method   : ward.D2 
## Distance         : euclidean 
## Number of objects: 437
fviz_dend(WARD)
## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
## of ggplot2 3.3.4.
## ℹ The deprecated feature was likely used in the factoextra package.
##   Please report the issue at <https://github.com/kassambara/factoextra/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

Let’s show how dividing our data into three cluster groups will look in a dendrogram below, coloring cluster groups for easier visualization.

fviz_dend(WARD,
          k = 3,
          cex = 0.5,
          palette = "jama",
          color_labels_by_k = TRUE,
          rect = TRUE)

As evident, additional subdivision would make small differences between groups, hence we opt for 3 cluster groups.

mydata$ClusterWard <- cutree(WARD,
                             k = 3)
head(mydata[c(1,36)])
## # A tibble: 6 × 2
##     PID ClusterWard
##   <int>       <int>
## 1   561           1
## 2   562           2
## 3   563           2
## 4   564           1
## 5   565           2
## 6   566           1

Now, I will specify initial leaders, which will later be reassigned using K-means.

Initial_leaders <- aggregate(mydata[ , c("perchsd_z", "percollege_z", "percprof_z", "percbelowpoverty_z")],
                             by = list(mydata$ClusterWard),
                             FUN = mean)
Initial_leaders
##   Group.1  perchsd_z percollege_z percprof_z percbelowpoverty_z
## 1       1  0.2139857   -0.2055062 -0.2300911         -0.4989241
## 2       2 -0.9095312   -0.6520829 -0.5565015          0.7740752
## 3       3  1.1414154    1.5284558  1.4126560         -0.3446235

We have obtained initial leaders in each cluster group for each of the standardized variables. Now I will assign K-means and observe for reassignment.

K_MEANS <- hkmeans(mydata[c("perchsd_z", "percollege_z", "percprof_z", "percbelowpoverty_z")], 
                   k = 3,
                   hc.metric = "euclidean",
                   hc.method = "ward.D2")

K_MEANS
## Hierarchical K-means clustering with 3 clusters of sizes 262, 110, 65
## 
## Cluster means:
##    perchsd_z percollege_z percprof_z percbelowpoverty_z
## 1  0.1973987   -0.1267734 -0.1800978         -0.3741222
## 2 -1.2320770   -0.8092080 -0.6545191          1.0120768
## 3  1.2893848    1.8804233  1.8335803         -0.2047450
## 
## Clustering vector:
##   [1] 1 2 1 1 2 1 2 1 1 3 1 1 2 1 3 3 1 1 3 1 1 3 1 1 1 2 1 2 1 2 2 1 2 1 2 1 1
##  [38] 1 3 2 2 1 1 2 3 1 3 1 3 1 2 1 1 1 3 3 3 1 1 1 2 1 2 2 1 1 1 2 1 1 1 3 2 1
##  [75] 2 2 2 1 2 1 1 1 2 3 2 1 1 1 1 1 2 1 1 1 2 2 2 1 3 1 1 1 1 3 1 1 1 3 1 1 1
## [112] 1 1 1 2 2 1 1 1 3 1 1 2 1 1 2 1 1 1 1 3 1 1 3 1 1 1 1 1 1 1 2 1 1 1 2 1 1
## [149] 1 1 3 1 2 1 3 1 1 1 1 2 2 2 1 2 2 3 1 1 1 1 1 1 3 2 1 1 2 1 1 2 3 1 1 1 1
## [186] 3 1 1 1 2 1 1 1 1 2 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 3 3 1 2 1 3
## [223] 1 1 3 2 3 1 1 2 3 1 3 2 3 2 2 1 3 1 3 2 2 1 2 3 1 3 1 3 2 1 1 2 1 2 3 2 2
## [260] 1 2 2 1 3 2 2 1 1 1 1 2 1 1 1 3 2 1 2 1 1 2 3 1 2 2 1 1 1 1 1 1 2 2 1 3 1
## [297] 1 3 1 1 2 3 1 2 3 3 2 3 3 1 2 1 2 2 2 1 2 2 1 1 2 1 1 1 1 1 1 1 1 2 1 1 2
## [334] 3 2 1 2 2 1 1 2 2 2 1 1 1 1 2 1 2 1 1 1 3 1 1 1 1 2 1 1 1 1 3 1 2 1 1 3 3
## [371] 1 2 1 1 2 1 1 3 1 1 1 3 3 1 1 2 1 1 1 1 1 2 1 2 1 1 3 1 2 1 1 1 1 1 2 3 1
## [408] 2 1 1 3 1 1 1 3 1 1 1 1 2 3 1 2 1 1 2 1 2 1 1 1 1 3 1 2 3 1
## 
## Within cluster sum of squares by cluster:
## [1] 242.2792 199.4147 284.7501
##  (between_SS / total_SS =  58.3 %)
## 
## Available components:
## 
##  [1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss"
##  [6] "betweenss"    "size"         "iter"         "ifault"       "data"        
## [11] "hclust"

Sizes of respective cluster groups:

  1. cluster group 1 encompasses 262 of the 437 units (59,9%),

  2. cluster group 2 encompasses 110 of the 437 units (25,1%),

  3. cluster group 3 encompasses 65 of the 437 units (15%).

The ratio between sums of squares of between groups divided by total sum of squares should be high, because we want groups to differ from one another while being internally homogeneous. We got the resoult of 58.3% which is okay.

Next is graphic representation.

fviz_cluster(K_MEANS, 
             palette = "jama", 
             repel = FALSE,
             ggtheme = theme_classic())

mydata$ClusterK_Means <- K_MEANS$cluster
head(mydata[c("perchsd_z", "percollege_z", "percprof_z", "percbelowpoverty_z")])
## # A tibble: 6 × 4
##   perchsd_z[,1] percollege_z[,1] percprof_z[,1] percbelowpoverty_z[,1]
##           <dbl>            <dbl>          <dbl>                  <dbl>
## 1         0.195            0.217        -0.0379                 0.124 
## 2        -2.44            -1.12         -0.655                  3.83  
## 3        -0.792           -0.198         0.0172                -0.0858
## 4         0.258           -0.159        -0.104                 -1.03  
## 5        -0.874           -0.606        -0.448                  0.196 
## 6         0.456            0.101        -0.486                 -0.410

Showing tables with the observations from the hierarchical and the K Means method

table(mydata$ClusterWard)
## 
##   1   2   3 
## 184 160  93
table(mydata$ClusterK_Means)
## 
##   1   2   3 
## 262 110  65
table(mydata$ClusterWard, mydata$ClusterK_Means)
##    
##       1   2   3
##   1 184   0   0
##   2  50 110   0
##   3  28   0  65

Group 1 originally had 184 counties as per Hierarchical clustering and then it received 50 counties from Group 2 and 28 counties from Group 3 because of reclassification as per the K means clustering method and now it has 262 counties

Centroids <- K_MEANS$centers
Centroids
##    perchsd_z percollege_z percprof_z percbelowpoverty_z
## 1  0.1973987   -0.1267734 -0.1800978         -0.3741222
## 2 -1.2320770   -0.8092080 -0.6545191          1.0120768
## 3  1.2893848    1.8804233  1.8335803         -0.2047450
library(ggplot2)
library(tidyr)

Figure <- as.data.frame(Centroids)
Figure$id <- 1:nrow(Figure)
Figure <- pivot_longer(Figure, cols = c("perchsd_z", "percollege_z", "percprof_z", "percbelowpoverty_z"))

Figure$Groups <- factor(Figure$id, 
                        levels = c(1, 2, 3), 
                        labels = c("1", "2", "3"))

Figure$nameFactor <- factor(Figure$name, 
                            levels = c("perchsd_z", "percollege_z", "percprof_z", "percbelowpoverty_z"), 
                            labels = c("perchsd_z", "percollege_z", "percprof_z", "percbelowpoverty_z"))

ggplot(Figure, aes(x = nameFactor, y = value)) +
  geom_hline(yintercept = 0) +
  theme_bw() +
  geom_point(aes(shape = Groups, col = Groups), size = 3) +
  geom_line(aes(group = id), linewidth = 1) +
  ylab("Averages") +
  xlab("Cluster variables") +
  ylim(-2.5, 2.5)

fit <- aov(cbind(perchsd_z, percollege_z, percprof_z, percbelowpoverty_z) ~ as.factor(ClusterK_Means), 
                 data = mydata)

summary(fit)
##  Response 1 :
##                            Df Sum Sq Mean Sq F value    Pr(>F)    
## as.factor(ClusterK_Means)   2 285.25 142.627  410.63 < 2.2e-16 ***
## Residuals                 434 150.75   0.347                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##  Response 2 :
##                            Df Sum Sq Mean Sq F value    Pr(>F)    
## as.factor(ClusterK_Means)   2 306.08 153.040  511.23 < 2.2e-16 ***
## Residuals                 434 129.92   0.299                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##  Response 3 :
##                            Df Sum Sq Mean Sq F value    Pr(>F)    
## as.factor(ClusterK_Means)   2 274.15 137.076  367.58 < 2.2e-16 ***
## Residuals                 434 161.85   0.373                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##  Response 4 :
##                            Df Sum Sq Mean Sq F value    Pr(>F)    
## as.factor(ClusterK_Means)   2 152.07  76.035  116.22 < 2.2e-16 ***
## Residuals                 434 283.93   0.654                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

H0: Mean(variable Cluster 1) = Mean(variable Cluster 2) = Mean(variable Cluster 3)

H1: At least one mean is different.

We reject H0 at (p<0.001) and can say that at least one mean(for all the clustering variables) is significantly different

Validation of the resoults

chisq_results <- chisq.test(mydata$inmetroF, as.factor(mydata$ClusterK_Means))

chisq_results
## 
##  Pearson's Chi-squared test
## 
## data:  mydata$inmetroF and as.factor(mydata$ClusterK_Means)
## X-squared = 83.393, df = 2, p-value < 2.2e-16
round(chisq_results$expected, 2)
##                
## mydata$inmetroF      1     2     3
##             No  172.07 72.24 42.69
##             Yes  89.93 37.76 22.31
round(chisq_results$observed, 2)
##                
## mydata$inmetroF   1   2   3
##             No  172 100  15
##             Yes  90  10  50
round(chisq_results$res, 2)
##                
## mydata$inmetroF     1     2     3
##             No  -0.01  3.27 -4.24
##             Yes  0.01 -4.52  5.86

Group 2 has significantly lower than expected non metro counties and significantly higher than expected metro counties, Group 3 has significantly higher than expected non metro counties and significantly lower than expected metro counties

Based on percentage of white population.

fit <- aov(percwhite ~ as.factor(ClusterK_Means), 
           data = mydata)

summary(fit)
##                            Df Sum Sq Mean Sq F value   Pr(>F)    
## as.factor(ClusterK_Means)   2   1287   643.4   13.54 1.97e-06 ***
## Residuals                 434  20614    47.5                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

H0: Mean(percwhite Cluster 1) = Mean(percwhite Cluster 2) = Mean(percwhite Cluster 3)

H1: At least one mean is different.

We reject H0 at (p<0.001) and can say that at least one mean is significantly different. In this way we are able to validate our analysis using the precent of wtite population.

aggregate(mydata$percwhite, 
          by = list(mydata$ClusterK_Means), 
          FUN = "mean")
##   Group.1        x
## 1       1 96.55279
## 2       2 95.53962
## 3       3 91.58231

Based on the population density.

fit <- aov(popdensity ~ as.factor(ClusterK_Means), 
           data = mydata)

summary(fit)
##                            Df    Sum Sq   Mean Sq F value  Pr(>F)    
## as.factor(ClusterK_Means)   2 3.350e+09 1.675e+09   32.65 6.2e-14 ***
## Residuals                 434 2.226e+10 5.130e+07                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

H0: Mean(popdensity Cluster 1) = Mean(popdensity Cluster 2) = Mean(popdensity Cluster 3)

H1: At least one mean is different.

We reject H0 at (p<0.001) and can say that at least one mean is significantly different. In this way we are able to validate our analysis using the precent of population density.

aggregate(mydata$popdensity, 
          by = list(mydata$ClusterK_Means), 
          FUN = "mean")
##   Group.1        x
## 1       1 2200.787
## 2       2 1353.108
## 3       3 9665.624

Based on percentage of asian population.

aggregate(mydata$percasian, 
          by = list(mydata$ClusterK_Means), 
          FUN = "mean")
##   Group.1         x
## 1       1 0.3681829
## 2       2 0.2021141
## 3       3 1.4496938
fit <- aov(percasian ~ as.factor(ClusterK_Means), 
           data = mydata)

summary(fit)
##                            Df Sum Sq Mean Sq F value Pr(>F)    
## as.factor(ClusterK_Means)   2  72.87   36.43   159.7 <2e-16 ***
## Residuals                 434  99.01    0.23                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

H0: Mean(percasian Cluster 1) = Mean(percasian Cluster 2) = Mean(percasian Cluster 3)

H1: At least one mean is different.

We reject H0 at (p<0.001) and can say that at least one mean is significantly different. In this way we are able to validate our analysis using the precent of asian population.

Conclusion:

Group 1 is the largest group having 59.9%(252/437) counties. Its characterized by the counties having slightly above average percentage of the population having a high school diploma, slightly below average percentage of the college educated, slightly below average percentage of the population having a professional degree while having a slightly below average percentage of the population below poverty line. In terms of demographics, it has counties with an average of 95% white population, with a population density of 2201 per unit area. Its Asian population percentage is 0.37

Group 2 is the second largest group having 25.17%(110/437) counties. Its characterized by the counties having a significantly below average percentage of the population having a high school diploma, significantly below average percentage of the college educated, slightly below average percentage of the population having a professional degree while having a significantly above average percentage of the population below poverty line. In terms of demographics, it has a significantly lower than expected non metro counties and significantly higher than expected metro counties. It has counties with an average of 96% white population, with the lowest population density of 1353 per unit area. Its Asian population percentage is also the lowest at 0.20

Group 3 is the third largest group having 14.9%(65/437) counties. Its characterized by the counties having a significantly above average percentage of the population having a high school diploma, significantly above average percentage of the college educated, significantly above average percentage of the population having a professional degree while having a slightly below average percentage of the population below poverty line. In terms of demographics, significantly higher than expected non metro counties and significantly lower than expected metro counties. It has counties with an average of 91% white population, with the highest population density of 9665 per unit area. Its Asian population percentage is also the highest at 1.44