question: public static double [ ] empiricalStateFrequenciesPAUP ( PatternList patternList ) { int i , j , k ; double total , sum , x , w , difference ; DataType dataType = patternList . getDataType ( ) ; int stateCount = patternList . getStateCount ( ) ; int patternLength = patternList . getPatternLength ( ) ; int patternCount = patternList . getPatternCount ( ) ; double [ ] freqs = equalStateFrequencies ( patternList ) ; double [ ] tempFreq = new double [ stateCount ] ; int [ ] pattern ; boolean [ ] state ; int count = 0 ; do { for ( i = 0 ; i < stateCount ; i ++ ) tempFreq [ i ] = 0.0 ; total = 0.0 ; for ( i = 0 ; i < patternCount ; i ++ ) { pattern = patternList . getPattern ( i ) ; w = patternList . getPatternWeight ( i ) ; for ( k = 0 ; k < patternLength ; k ++ ) { state = dataType . getStateSet ( pattern [ k ] ) ; sum = 0.0 ; for ( j = 0 ; j < stateCount ; j ++ ) if ( state [ j ] ) sum += freqs [ j ] ; for ( j = 0 ; j < stateCount ; j ++ ) { if ( state [ j ] ) { x = ( freqs [ j ] * w ) / sum ; tempFreq [ j ] += x ; total += x ; } } } } difference = 0.0 ; for ( i = 0 ; i < stateCount ; i ++ ) { difference += Math . abs ( ( tempFreq [ i ] / total ) - freqs [ i ] ) ; freqs [ i ] = tempFreq [ i ] / total ; } count ++ ; } while ( difference > 1E-8 && count < 1000 ) ; return freqs ; }
target:  Returns a double array containing the empirically estimated frequencies for the states of patternList. This version of the routine should match the values produced by PAUP.