F20_HW6_cluster_student-1.docx - Homework 6 Fall 2019...

This preview shows page 1 - 3 out of 8 pages.

Homework 6 Fall 2019 - Clustering Emely C Aleman Due Tuesday Oct 13, 11:59 PM ## Do not change code here. ## Use the DATA_HW6 data set to answer questions here. library (regclass) ## Loading required package: bestglm ## Loading required package: leaps ## Loading required package: VGAM ## Loading required package: stats4 ## Loading required package: splines ## Loading required package: rpart ## Loading required package: randomForest ## randomForest 4.6-14 ## Type rfNews() to see new features/changes/bug fixes. ## Important regclass change from 1.3: ## All functions that had a . in the name now have an _ ## all.correlations -> all_correlations, cor.demo -> cor_demo, etc. data (SURVEY09) DATA_HW6 <- SURVEY09[ , c ( 3 , 11 , 13 , 15 , 28 , 29 )] DATA_HW6 <- na.omit (DATA_HW6) colnames (DATA_HW6) <- c ( "Weight" , "GPA" , "WeeklyHourStudied" , "FB_Friends" , "TxtsPerDay" , "FootballGames" ) Use DATA_HW6 for all questions in this homework. Question 1: KMeans Clustering. 1) We need to scale variable values before performing the clustering analysis. This is because variables that have the most variation in its values would dominate the distance measure. From output of summary(DATA_HW6) , which variables (list two) will dominate the distance measure if we do not scale them? summary (DATA_HW6) ## Weight GPA WeeklyHourStudied FB_Friends TxtsPerDay FootballGames ## Min. : 16 Min. :1.250 Min. : 0.000 Min. : 1.0 Min. : -1.00 Min. : 0.000 ## 1st Qu.:130 1st Qu.:2.815 1st Qu.: 2.000 1st Qu.: 300.0 1st Qu.: 15.00 1st Qu.: 2.000 ## Median :150 Median :3.200 Median : 3.000 Median : 487.0 Median : 40.00 Median : 5.000
## Mean :156 Mean :3.172 Mean : 4.301 Mean : 572.7 Mean : 71.01 Mean : 5.168 ## 3rd Qu.:175 3rd Qu.:3.525 3rd Qu.: 5.000 3rd Qu.: 776.5 3rd Qu.: 100.00 3rd Qu.: 8.000 ## Max. :472 Max. :4.000 Max. :24.000 Max. : 5000.0 Max. :1000.00 Max. :14.000 SCALEDDATA <- scale (DATA_HW6) Response :

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture