Revision 823295fe4c382069229ac77435da6e5bb14155b9 authored by Matthias Templ on 11 January 2013, 16:29:55 UTC, committed by cran-robot on 11 January 2013, 16:29:55 UTC
1 parent bea0f62
Raw File
robVariation.R
`robVariation` <-
function(x, robust=TRUE){
    rvars <- matrix(0, ncol=ncol(x), nrow=ncol(x))
	if(robust){
    for( i in 1:ncol(x)){
      for( j in 1:ncol(x)){
        if( i < j ) rvars[i,j] <- (mad(log(x[,i]/x[,j])))^2
      }
    }
	} else{
		for( i in 1:ncol(x)){
			for( j in 1:ncol(x)){
				if( i < j ) rvars[i,j] <- (var(log(x[,i]/x[,j])))
			}
		}		
	}
	rvars[lower.tri(rvars)] <- rvars[upper.tri(rvars)]
    return(rvars) 
}

back to top