Displaying 20 results from an estimated 20 matches for "withinss".
2010 Aug 18
1
Plotting K-means clustering results on an MDS
...sure to my raw
data would have been inappropriate)
canto.MDS<-cmdscale(canto)
I then figured out what would be my optimum k-value by plotting the within
sums of squares for K1-K15
> wss <- (nrow(canto.MDS)-1)*sum(apply(canto.MDS,2,var))
> wss[2] <- sum(kmeans(canto.MDS,centers=2)$withinss)
> wss[3] <- sum(kmeans(canto.MDS,centers=3)$withinss)
> wss[4] <- sum(kmeans(canto.MDS,centers=4)$withinss)
> wss[5] <- sum(kmeans(canto.MDS,centers=5)$withinss)
> wss[6] <- sum(kmeans(canto.MDS,centers=6)$withinss)
> wss[7] <- sum(kmeans(canto.MDS,centers=7)$wit...
2003 Jun 05
1
kmeans (again)
...cluster
centers...
Now a small dataset:
> data<-matrix(c(-1,0,2,2.5,7,9,0,3,0,6,1,4),6,2)
If I use rows 3 and 4 as cluster centers and a single iteration of kmeans I
get:
> kmeans(data,data[c(3,4),],1)
$cluster
[1] 1 1 1 1 2 2
$centers
[,1] [,2]
1 0.875 2.25
2 8.000 2.50
$withinss
[1] 32.9375 6.5000
$size
[1] 4 2
If I now use rows 1 and 6 as cluster centers I get exactly the same solution
after the first iteration:
> kmeans(data,data[c(1,6),],1)
$cluster
[1] 1 1 1 1 2 2
$centers
[,1] [,2]
1 0.875 2.25
2 8.000 2.50
$withinss
[1] 32.9375 6.5000
$size
[1] 4 2
So...
2003 Feb 13
1
k- means cluster analysis
...0.10, -0.31,
-0.19, 0.18, -0.26,
-0.23, -0.37, -0.23)
I've got two different solutions when I ran this function over a few times:
kmeans(x, centers=2)
The first solution gives the following:
$cluster
[1] 2 2 1 2 1 2 2 2 1 2 2 1 2 2 2 2
$centers
[,1]
1 0.1325000
2 -0.2783333
$withinss
[1] 0.0646750 0.4033667
$size
[1] 4 12
The second solution gives the following:
$cluster
[1] 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1
$centers
[,1]
1 -0.1313333
2 -0.8400000
$withinss
[1] 0.5035733 0.0000000
$size
[1] 15 1
I don't understand why this is happening, and how do I choose betwee...
2013 Jan 24
1
Help regarding kmeans output. need to save the clusters into different directories/folders.
...4 4 2 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
Within cluster sum of squares by cluster:
[1] 2.731015e+26 8.785281e+22 4.726557e+26 3.513411e+22 5.092071e+25
(between_SS / total_SS = 98.9 %)
Available components:
[1] "cluster" "centers" "totss" "withinss"
"tot.withinss"
[6] "betweenss" "size"
*Now how to I save these 5 clusters into 5 separate folders? *
Please advise,
Thanks.
[[alternative HTML version deleted]]
2003 Apr 14
2
kmeans clustering
...37 columns--clustering rows)
> c1<-kmeans(data,3,20)
> c1
$cluster
[1] 1 1 1 1 1 1 1 3 3 3 1 3 1 3 3 1 1 1 1 3 1 3 3 1 1 1 3 3 1 1 3 1 1 1 1 3
3
[38] 3 1 1 1 3 1 1 1 1 3 3 3 1 1 1 1 1 1 3 1 3 1 1 3 1 1 1 1 3 1 1 1 1 1 1 3
1
[75] 1 3 1 3 1 1 1 1 3 1 1 1 1 1 3 1 1 3 1 1 3 3 1 2 1 1
$withinss
[1] 1037.5987 0.0000 666.9701
$size
[1] 68 1 31
> c4<-kmeans(data,3,20)
$withinss
[1] 0.0000 865.7628 851.1214
$size
[1] 1 54 45
Does any one tell me why the results are very different with the same
dataset and parameters when I run some times this command
'kmeans(data,3,20)...
2001 Mar 13
1
kmeans cluster stability
...bership changes.
Using RW1022 under Windows NT & Windows 2000
>kmeans(pottery[,1:5], 4, 20)
[...snip]
$size
[1] 7 3 9 7
[...snip]
$size
[1] 7 10 4 5
[...snip]
$size
[1] 6 10 5 5
yields a different answer every time a run it. Sometimes the answer is
different only in the order of withinss (and the ordering of the numbers of
cases assigned to each group). Other times there are completely different
centers, withinss and completely different cluster configurations. This
variability doesn't happen in either S-Plus 2000 or S-Plus 6.0 (Beta 2).
I can see from the help that the R...
2013 Jun 24
1
K-means results understanding!!!
...1 5 5
5 1
[39] 3 1 5 5 3 1 1 1 1 5 5 1 4 1 3 5 5 5 5 5 5 1
Within cluster sum of squares by cluster:
[1] 0.6702803 0.0000000 0.2453294 0.1860180 1.3535263
(between_SS / total_SS = 76.8 %)
Available components:
[1] "cluster" "centers" "totss" "withinss"
"tot.withinss"
[6] "betweenss" "size"
>
Q3)I would like to understand which raw data are in which cluster ? Does
somebody knows how to access the table of raw data which are in the same
cluster ?
Thanks for help
DZU
--
View this message in...
2003 Jun 06
1
Kmeans again
...same small example:
> dados<-matrix(c(-1,0,2,2.5,7,9,0,3,0,6,1,4),6,2)
I will choose observations 3 and 4 for initial centers and just one iteration. The results are
> A<-kmeans(dados,dados[c(3,4),],1)
> A
$cluster
[1] 1 1 1 1 2 2
$centers
[,1] [,2]
1 0.875 2.75
2 8.000 2.50
$withinss
[1] 38.9375 6.5000
$size
[1] 4 2
If I do it by hand, after one iteration, the results are
$cluster
[1] 1 2 1 2 1 2
So I think that something is wrong with the function kmeans; probably the initial centers given by the user are not being taken into account.
2007 Dec 05
1
Information criteria for kmeans
...kmeans? It should
be something like:
k <- 2
vars <- 4
nobs <- 100
dat <- rbind(matrix(rnorm(nobs, sd = 0.3), ncol = vars),
matrix(rnorm(nobs, mean = 1, sd = 0.3), ncol = vars))
colnames(dat) <- paste("var",1:4)
(cl <- kmeans(dat, k))
schwarz <- sum(cl$withinss)+ vars*k*log(nobs)
Thanks for your help,
Serguei
________________________________________
Austrian Institute of Economic Research (WIFO)
P.O.Box 91 Tel.: +43-1-7982601-231
1103 Vienna, Austria Fax: +43-1-7989386
Mail: Serguei.Kaniovski@wifo.ac.at
http://www.wifo.a...
2008 Aug 10
1
R function, sink() and empty file
...""))
file <- read.table(paste("R_out/", filename, ".txt", sep=""))
obj <- kmenas(file, 5)
sink(paste("R_out/res", filename, ".txt", sep=""))
"Kluster centers"
obj$centers
"Within size for clusters"
obj$withinss
"Cluster size"
obj$size
sink()
}
[[alternative HTML version deleted]]
2012 Jan 14
1
Error: unexpected '<' in "<" when modifying existing functions
...centers) <- list(1L:k, dimnames(x)[[2L]])
+ cluster <- Z$c1
+ if (!is.null(rn <- rownames(x)))
+ names(cluster) <- rn
+ totss <- sum(scale(x, scale = FALSE)^2)
+ print(Z$iter)
+ structure(list(cluster = cluster, centers = centers, totss = totss,
+ withinss = Z$wss, tot.withinss = best, betweenss = totss -
+ best, size = Z$nc, iter = Z$iter), class = "kmeans")
+ }
> <environment: namespace:stats>
Error: unexpected '<' in "<"
2012 Jun 27
1
Error: figure margins too large
...ame(mydataS)
#removes "coden" variable
myvars <- names(mydataS2) %in% c("coden")
mydataSNc <- mydataS2[!myvars]
#Determine number of clusters
wss <- (nrow(mydataSNc)-1)*sum(apply(mydataSNc,2,var))
for (i in 2:15)
wss[i] <- sum(kmeans(mydataSNc, centers=i)$withinss)
plot(1:15, wss, type="b", xlab="Number of Clusters",ylab="Within groups sum of squares")
#perform Kmeans with 2 clusters
kmSNc2 <- kmeans(mydataSNc,2)
#print conponents of kmSNc2
print(kmSNc2)
#plot 2 clusters
plot(mydataSNc, col = kmSNc2$cluster)
#plot...
2013 Jul 26
1
variación en los resultados de k medias (Alfredo Alvarez)
Buen día, no sé si estoy utilizando bien la lista, es la primera vez. Si lo
hago mal me corrigen por favor.
Sobre tu comentario Pedro, muchas gracias. Lo qeu entiendo con tu
sugerencia de set.seed es qeu de esa forma fijas los resultados, pero no
estoy seguro si otra agrupación funcione mejor. Es decir me interesa un
método de agrupación que genere la "mejor" agrupación y como los
2003 Jun 03
1
kmeans
...-1.0 0
[2,] 0.0 3
[3,] 2.0 0
[4,] 2.5 6
[5,] 7.0 1
[6,] 9.0 4
> plot(dados)
> dados<-matrix(c(-1,0,2,2.5,7,9,0,5,0,6,1,4),6,2)
> plot(dados)
> A<-kmeans(dados,dados[c(3,4),],1)
> A
$cluster
[1] 1 1 1 1 2 2
$centers
[,1] [,2]
1 0.875 2.75
2 8.000 2.50
$withinss
[1] 38.9375 6.5000
$size
[1] 4 2
Any hints?
Thanks a lot
Luis Silva
2004 May 11
1
AW: Probleme with Kmeans...
...1018 [29] 0.9034660 1.2406042 0.9529861 3.3889001 0.8462411 0.8338748 1.8540691 [36] 1.3624104 6.9509700
> kmeans(univ,ncl)
$cluster
[1] 5 3 5 5 4 5 3 3 3 3 1 3 5 3 4 1 2 5 1 3 3 5 3 1 5 5 5 5 3 3 3 1 3 3 2 3 4
$centers
[,1]
1 3.5806021
2 2.0872314
3 0.9808016
4 5.9624282
5 0.5968146
$withinss
[1] 0.4622251 0.1087293 0.3637454 1.7637280 0.1768656
$size
[1] 5 2 16 3 11
Thanks a lot,
Unung Istopo
On Tue, 2004-05-11 at 17:19, TEMPL Matthias wrote:
> Hello,
> When clustering with kmeans, your data should have more than one
> variable. Matthias
2006 Apr 05
1
"partitioning cluster function"
...all" "silinfo" "data"
But "kmeans" has:
K-means clustering with 2 clusters of sizes 50, 50
Cluster means:
Clustering vector:
Within cluster sum of squares by cluster:
Available components:
[1] "cluster" "centers" "withinss" "size"
[[alternative HTML version deleted]]
2011 Feb 21
0
r-square for cluster
...<- subset(grid40km.data,grid40km.cluster==i, select=c(X1, X2, X3, X4, X5))
SSgroup <- (nrow(data_group-1)*sum(apply(data_group,2,var))) # SS for all variables for a given cluster
SStot_grid40km=append(SStot_grid40km, SSgroup,after=length(SStot_grid40km))
}
ssw_grid40km = sum(SStot_grid40km) #withinSS (??) as the sum of SS for all clusters
ssbetween_grid40km = SSTot-ssw_grid40km
RSQ_grid40km2 = ssbetween_grid40km/SSTot # R-square
Am I right? Does this correspond to SAS's R2?
Many thanks,
Yan
Ressources Naturelles Canada
Service Canadien des Forêts - Centre de Foresterie des Laurenti...
2003 Mar 05
2
problem with cclust[er] package
I have checked that section already.
Sorry, I should have mentioned that.
Memory limit increase does not work.
Installtion of msvcrt.dll does not work
either.
Thank you.
-----Original Message-----
From: ripley at stats.ox.ac.uk [mailto:ripley at stats.ox.ac.uk]
Sent: Wednesday, March 05, 2003 2:44 PM
To: Igor Oleinik
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] problem with cclust[er]
2015 Apr 29
2
cantidad de datos
...hacer varios kmedias con diferente número de clusters y comprobar como varía la suma de cuadrados entre cluster para "elegir" el número óptimo.
# 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")
El 29/04/15 a las 19:42, Alva Valiente, Ricardo (RIAV) escribió:
El inconveniente con un K-medias, es que se tiene que se tiene que pre definir el número de segmentos, pero es...
2015 Apr 29
2
cantidad de datos
El inconveniente con un K-medias, es que se tiene que se tiene que pre definir el número de segmentos, pero eso es algo con lo q no cuento. La solución de Javier me parece q sería la única opción.
Atte.
Ricardo Alva Valiente
-----Mensaje original-----
De: R-help-es [mailto:r-help-es-bounces en r-project.org] En nombre de javier.ruben.marcuzzi en gmail.com
Enviado el: miércoles, 29 de abril de