R/fom.r

Defines functions fom

Documented in fom

# FOM =Figure of Merit, a measure that decreases with improved clustering #
# Copyright Per Broberg 20APR01 #
fom<-function(data,cluster){
temp<-numeric(ncol(data))
for (i in 1:ncol(data)){
   temp[i]<-sqrt(sum(na.omit(aggregate(data[,-i],list(cluster),ssqvar<-function(x) var(x)*(length(x)-1))[,-1])))
}
return(sum(temp)/sqrt((nrow(data)-length(table(cluster)))/nrow(data)))
}

Try the SAGx package in your browser

Any scripts or data that you put into this service are public.

SAGx documentation built on Nov. 8, 2020, 8:18 p.m.