public double getVariance ( ) { if ( ! DATA_LIST . isEmpty ( ) ) { double sum = 0 ; double sumOfSquares = 0 ; double average = 0 ; for ( DataPoint dataPoint : DATA_LIST ) { sumOfSquares += ( dataPoint . getValue ( ) * dataPoint . getValue ( ) ) ; sum += dataPoint . getValue ( ) ; } average = sum / DATA_LIST . size ( ) ; return ( sumOfSquares / DATA_LIST . size ( ) ) - average * average ; } return 0 ; }
Returns the calculated varianz of the current data