[R] Pseudo F statistics with index.G1

Kennedy henrik.aldberg at gmail.com
Tue Jul 6 10:32:48 CEST 2010


Hello,

I have done some clustering with Agnes and want to calculate the pseudo F
statistics using index.G1. It works for a low number of clusters but when i
increase the number of clusters i eventually get the following message:

Error in apply(x[cl == i, ], 2, mean) : 
  dim(X) must have a positive length

The following code produces an example comparable to the data i am
clustering:

library(cluster)
library(ade4)
library(R2HTML)
library(e1071)
library(class)
library(rgl)
library(MASS)
library(clusterSim)

# Create a symmetric matrix with ones on the diagonal
mat <- diag(1,27,27)
f <- runif(sum(26:1),0,1)
mat[lower.tri(mat)] <- f
mat <- t(mat)
mat[lower.tri(mat)] <- f

# Cluster with Agnes
A <- agnes(mat,diss=T,method="average")
C <- cutree(A,k=7)   # Value of k = the number of clusters
F <- index.G1(mat,C)

The code above works for k=2:6 but then the error message appears. 


Sincerely

Henrik
-- 
View this message in context: http://r.789695.n4.nabble.com/Pseudo-F-statistics-with-index-G1-tp2279216p2279216.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list