R/isamic.R

Defines functions isamic.stride

isamic <- function (comm,clustering,sort=FALSE) 
{
    tmp <- const(comm,clustering)
    result <- apply(tmp,1,function(x)
        {2*sum(abs(as.numeric(x)-0.5))/ncol(tmp)})
    if (sort) 
        result <- rev(sort(result))
    result
}

isamic.stride <- function(stride,comm)
{
    spc <- ncol(comm)
    clusts <- ncol(stride$clustering)
    res <- matrix(0,nrow=clusts,ncol=spc)

    for (i in 1:clusts) {
        res[i,] <- isamic(comm,stride$clustering[,i])
    }
    res <- data.frame(res)
    names(res) <- names(comm)
    row.names(res) <- stride$seq
    res
}
                   
    

Try the labdsv package in your browser

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

labdsv documentation built on April 10, 2023, 5:08 p.m.