R/crit_cataMean.R

Defines functions .crit_cataMean

.crit_cataMean=function(Xj){
  #Xj list

  n=nrow(Xj[[1]])
  nblo=length(Xj)
  nvar=ncol(Xj[[1]])

  # the compromise C:
  C=matrix(0,n,nvar)
  for (j in 1:nblo) {C=C+Xj[[j]]}
  C=C/nblo

  # the sum of distances between the weighted scalar product matrices
  # and the consensus
  dw=rep(0,nblo)
  for (j in 1:nblo) {
    a=Xj[[j]]-C
    dw[j]=sum(diag(a%*%t(a)))
  }
  Q=sum(dw)

  return(list(C=C,Q=Q))

}

Try the ClustBlock package in your browser

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

ClustBlock documentation built on March 24, 2026, 9:08 a.m.