Cluster Analysis

From RAJ INFO
Revision as of 03:00, 15 February 2012 by Raj (talk | contribs) (Created page with "Category:R = Cluster Analysis = == Formatting the Data == <pre> > mydata <- na.omit(mydata) # listwise deletion of missing > mydata <- scale(mydata) # standardize variable...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Cluster Analysis

Formatting the Data


> mydata <- na.omit(mydata) # listwise deletion of missing
> mydata <- scale(mydata) # standardize variables

#  (Opyional) Determine number of clusters
> wss <- (nrow(mydata)-1)*sum(apply(mydata,2,var)) for (i in 2:15)
> wss[i] <- sum(kmeans(mydata, centers=i)$withinss)
> plot(1:15, wss, type="b", xlab="Number of Clusters", ylab="Within groups sum of squares")


Kmeans Clustering

Hierarcheal Clustering