public static double CramersV(double[][] matrix){
  int row, col, nrows, ncols, min;
  double n=0;
  nrows=matrix.length;
  ncols=matrix[0].length;
  for (row=0; row < nrows; row++) {
    for (col=0; col < ncols; col++) {
      n+=matrix[row][col];
    }
  }
  min=nrows < ncols ? nrows - 1 : ncols - 1;
  if ((min == 0) || Utils.eq(n,0))   return 0;
  return Math.sqrt(chiVal(matrix,false) / (n * (double)min));
}

public static double CramersV ( double [ ] [ ] matrix ) { int row , col , nrows , ncols , min ; double n = 0 ; nrows = matrix . length ; ncols = matrix [ 0 ] . length ; for ( row = 0 ; row < nrows ; row ++ ) { for ( col = 0 ; col < ncols ; col ++ ) { n += matrix [ row ] [ col ] ; } } min = nrows < ncols ? nrows - 1 : ncols - 1 ; if ( ( min == 0 ) || Utils . eq ( n , 0 ) ) return 0 ; return Math . sqrt ( chiVal ( matrix , false ) / ( n * ( double ) min ) ) ; }
computes cramer ' s v for a contingency table .
