private boolean rule5 ( double sample ) { if ( ! hasMean ( ) ) { return false ; } if ( rule5LastThree . size ( ) == 3 ) { switch ( rule5LastThree . removeLast ( ) ) { case ">" : -- rule5Above ; break ; case "<" : -- rule5Below ; break ; } } if ( Math . abs ( sample - mean . getResult ( ) ) > twoDeviations ) { if ( sample > mean . getResult ( ) ) { ++ rule5Above ; rule5LastThree . push ( ">" ) ; } else { ++ rule5Below ; rule5LastThree . push ( "<" ) ; } } else { rule5LastThree . push ( "" ) ; } return rule5Above >= 2 || rule5Below >= 2 ; }
At least 2 of 3 points in a row are > 2 standard deviations from the mean in the same direction