src/NGrams/Statistic2D.php
/**
    * Calculate the Odds Ratio
    * @param array $ngram Array of ngrams with frequencies
    * @return float Return the calculated value
    */
Calculate the Odds Ratio
@param array $ngram Array of ngrams with frequencies
@return float Return the calculated value
Calculate the Odds Ratio @param array $ngram Array of ngrams with frequencies @return float Return the calculated value
static public function odds(array $ngram, int $totalNgrams) : float
    {
        $var = self::setStatVariables($ngram, $totalNgrams);
        if ($var['RminusJ'] == 0) {
    	    $var['RminusJ'] = 1;
        }
        if ($var['LminusJ'] == 0) {
    	    $var['LminusJ'] = 1;
        }
        $term1 = $var['jointFrequency'] * $var['n22'];
        $term2 = $var['RminusJ'] * $var['LminusJ'];
        $odds = $term1/$term2;
        return $odds;
    }
static public function odds ( array $ ngram , int $ totalNgrams ) : float { $ var = self :: setStatVariables ( $ ngram , $ totalNgrams ) ; if ( $ var [ 'RminusJ' ] == 0 ) { $ var [ 'RminusJ' ] = 1 ; } if ( $ var [ 'LminusJ' ] == 0 ) { $ var [ 'LminusJ' ] = 1 ; } $ term1 = $ var [ 'jointFrequency' ] * $ var [ 'n22' ] ; $ term2 = $ var [ 'RminusJ' ] * $ var [ 'LminusJ' ] ; $ odds = $ term1 / $ term2 ; return $ odds ; }
Calculate the Odds Ratio
 @param array $ngram Array of ngrams with frequencies
 @return float Return the calculated value
Calculate the Odds Ratio @param array $ngram Array of ngrams with frequencies @return float Return the calculated value