(15 points) 3. Consider the following data set shown in Table 2. Place the objects in the data set in two clusters using

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

(15 points) 3. Consider the following data set shown in Table 2. Place the objects in the data set in two clusters using

Post by answerhappygod »

15 Points 3 Consider The Following Data Set Shown In Table 2 Place The Objects In The Data Set In Two Clusters Using 1
15 Points 3 Consider The Following Data Set Shown In Table 2 Place The Objects In The Data Set In Two Clusters Using 1 (106.6 KiB) Viewed 22 times
this is the code I have so far.
f <= file.choose("Social.csv")
df <- read.csv("Social.csv")
data("Social")
summary(Social)
head(Social)
Social <-data("Social")
storm_data1 <- select(Social, c(1:9))
data <- selectc(Social,2:5)
kmean <- kmeans(data,5)
kmean$centers
kmean$cluster
autoplot(kmean, data, frame = TRUE)
wssplot <- function(data, nc=15, seed=1234){
wss <- (nrow(data)-1)*sum(apply(data,2,var))
for (i in 2:nc){
set.seed(seed)
wss <- sum(kmeans(data,
centers=i)$withinss)}
plot(1:nc, wss, type="b", xlab="Number of Clusters",
ylab="Within groups sum of
squares")
wss
}
wssplot(data)
(15 points) 3. Consider the following data set shown in Table 2. Place the objects in the data set in two clusters using k-means. Andrew and Carolina are selected as the initial centroids of the two clusters. Find the cluster to which each object belongs to using k-means with one iteration and re-compute the centroids of the two clusters. Create a scatter plot for the data set and the re- computed centroids. The cluster to which each object belongs to is represented by color of the object in the plot. A B с 11 1 Name Age Educational level 2 Andrew (A) 55 1 А B с 3 Bernhard (B) 43 2 4 37 5 Carolina (C) Dennis (D) 5 82 3 6 Eve (E) 23 3.2 7 Fred (F) 46 5
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply