Re: [R] cluster.stats

From: Laura Poggio <laura.poggio_at_gmail.com>
Date: Sat, 14 Jun 2008 18:29:49 +0200

Thank you very much for your answer.
I tried to run the function on my data and now I am getting this message of error
Error in as.dist(dmat[clustering == i, clustering == i]) : (subscript) logical subscript too long

Below the code I am using (version2.7.0 of R with all packages updated):

data <- <- as(img, "data.frame")[1:1] #(where img is a small image 256 px x 256 px)
kl <- kmeans(data, 5)
library(fpc)
cluster.stats(data, kl$cluster)

Thank you for any hints on the reasons and meaning of the error!

Laura

2008/6/13 Christian Hennig <chrish_at_stats.ucl.ac.uk>:

> Dear Laura,
>
> Dear list,
>> I just tried to use the function cluster.stat in the package fpc.
>> I just have a couple of questions about the syntax:
>>
>> cluster.stats(d,clustering,alt.clustering=NULL,
>> silhouette=TRUE,G2=FALSE,G3=FALSE)
>>
>> 1) the distance object (d) is an object obtained by the function dist() on
>> my own original matrix?
>>
>
> d is allowed to be an object of class dist or a dissimilarity matrix.
> The answer to your question depends on what your "original matrix" is. If
> it is something on which you can compute a distance by dist(), you're right,
> at least if dist() delivers the distance you are interested in.
>
> 2) clustering is the clusters vector as result of one of the many
>> clustering
>> methods?
>>
>
> The help page tells you what clustering can be. So it could be the
> clustering/partition vector of a clustering method or it could be something
> else. Note that cluster.stats doesn't depend on any particular clustering
> method. It computes the statistics regardless of where the clustering vector
> comes from.
>
> Best regards,
> Christian
>
>
>> Thank you very much in advance and sorry for such basic question, but I
>> did
>> not manage to clarify my mind.
>>
>> Laura
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
> *** --- ***
> Christian Hennig
> University College London, Department of Statistical Science
> Gower St., London WC1E 6BT, phone +44 207 679 1698
> chrish@stats.ucl.ac.uk, www.homepages.ucl.ac.uk/~ucakche<http://www.homepages.ucl.ac.uk/%7Eucakche>
>

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 14 Jun 2008 - 16:38:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 14 Jun 2008 - 18:30:41 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive