question: public static double variance ( double [ ] x , double mean ) { double var = 0 ; int count = x . length ; for ( double aX : x ) { if ( Double . isNaN ( aX ) ) { count -- ; } else { double diff = aX - mean ; var += diff * diff ; } } if ( count < 2 ) { count = 1 ; } else { count = count - 1 ; } return var / ( double ) count ; }
target:  compute variance (ML estimator)