Function and data format for doing vector-based clustering in R -


i need run clustering on correlations of data row vectors, is, instead of using individual variables clustering predictor variables, intend use correlations between vector of variables between data rows.

is there function in r vector-based clustering. if not , need manually, right data format feed in function such cmeans or kmeans? say, have m variables , n data rows, m variables constitute 1 vector each data row. have n x n matrix correlation or cosine. can matrix plugged in clustering function directly or processing required?

many thanks.

you can transform correlation matrix dissimilarity matrix, instance 1-cor(x) (or 2-cor(x) or 1-abs(cor(x))).

# sample data n <- 200 k <- 10 x <- matrix( rnorm(n*k), nr=k ) x <- x * row(x) # 10 dimensions, less information in of them  # clustering library(cluster) r <- pam(1-cor(x), diss=true, k=5)  # check results plot(prcomp(t(x))$x[,1:2], col=r$clustering, pch=16, cex=3) 

Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -