GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Text::NSP::Measures::4D::MI::ll(3) User Contributed Perl Documentation Text::NSP::Measures::4D::MI::ll(3)

Text::NSP::Measures::4D::MI::ll - Perl module that implements Loglikelihood measure of association for 4-grams.

Basic Usage use Text::NSP::Measures::4D::MI::ll;

  $ll_value = calculateStatistic( 
                                  n1111=>8,
                                  n1ppp=>306,
                                  np1pp=>83,
                                  npp1p=>83,
                                  nppp1=>57,
                                  n11pp=>8,
                                  n1p1p=>8,
                                  n1pp1=>8,
                                  np11p=>83,
                                  np1p1=>56,
                                  npp11=>56,
                                  n111p=>8,
                                  n11p1=>8,
                                  n1p11=>8,
                                  np111=>56,
                                  npppp=>15180);

  if( ($errorCode = getErrorCode()))
  {
    print STDERR $erroCode." - ".getErrorMessage()."\n";
  }
  else
  {
    print getStatisticName."value for 4-gram is ".$ll_value."\n";
  }

The log-likelihood ratio measures the devitation between the observed data and what would be expected if <word1>, <word2>, <word3> and <word4> were independent.The higher the score, the less evidence there is in favor of concluding thatthe words are independent.

The expected values for the internal cells are calculated by taking the product of their associated marginals and dividing by the sample size, for example:

            n1ppp * np1pp * npp1p * nppp1
   m111=   -------------------------------
                       npppp ^ 3

Then the deviation between observed and expected values for each internal cell is computed to arrive at the log-likelihood value.

  Log-Likelihood = 2 * [n1111 * log ( n1111 / m1111 ) + n1112 * log ( n1112 / m1112 ) + 
                       n1121 * log ( n1121 / m1121 ) + n1122 * log ( n1122 / m1122 ) + 
                       n1211 * log ( n1211 / m1211 ) + n1212 * log ( n1212 / m1212 ) + 
                       n1221 * log ( n1221 / m1221 ) + n1222 * log ( n1222 / m1222 ) + 
                       n2111 * log ( n2111 / m2111 ) + n2112 * log ( n2112 / m2112 ) + 
                       n2121 * log ( n2121 / m2121 ) + n2122 * log ( n2122 / m2122 ) + 
                       n2211 * log ( n2211 / m2211 ) + n2212 * log ( n2212 / m2212 ) + 
                       n2221 * log ( n2221 / m2221 ) + n2222 * log ( n2222 / m2222 )];

calculateStatistic($count_values) - This method calculates the ll value
INPUT PARAMS : $count_values .. Reference of an hash containing the count values computed by the count.pl program.

RETURN VALUES : $loglikelihood .. Loglikelihood value for this 4-gram.

getStatisticName() - Returns the name of this statistic
INPUT PARAMS : none

RETURN VALUES : $name .. Name of the measure.

Ted Pedersen, University of Minnesota Duluth <tpederse@d.umn.edu>

Satanjeev Banerjee, Carnegie Mellon University <satanjeev@cmu.edu>

Amruta Purandare, University of Pittsburgh <amruta@cs.pitt.edu>

Bridget Thomson-McInnes, University of Minnesota Twin Cities <bthomson@cs.umn.edu>

Saiyam Kohli, University of Minnesota Duluth <kohli003@d.umn.edu>

Last updated: $Id: ll.pm,v 1.1 2008/11/22 18:53:13 btmcinnes Exp $

  @article{Dunning93,
            author = {Dunning, T.},
            title = {Accurate Methods for the Statistics of
          Surprise and Coincidence},
            journal = {Computational Linguistics},
            volume = {19},
            number = {1},
            year = {1993},
            pages = {61-74}
            url = L<http://www.comp.lancs.ac.uk/ucrel/papers/tedstats.pdf>}

  @inproceedings{moore:2004:EMNLP,
                author    = {Moore, Robert C.},
                title     = {On Log-Likelihood-Ratios and the Significance of Rare
              Events },
                booktitle = {Proceedings of EMNLP 2004},
                editor = {Dekang Lin and Dekai Wu},
                year      = 2004,
                month     = {July},
                address   = {Barcelona, Spain},
                publisher = {Association for Computational Linguistics},
                pages     = {333--340}
                url = L<http://acl.ldc.upenn.edu/acl2004/emnlp/pdf/Moore.pdf>}

<http://groups.yahoo.com/group/ngram/>

<http://www.d.umn.edu/~tpederse/nsp.html>

Copyright (C) 2000-2006, Ted Pedersen, Satanjeev Banerjee, Amruta Purandare, Bridget Thomson-McInnes and Saiyam Kohli

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to

    The Free Software Foundation, Inc.,
    59 Temple Place - Suite 330,
    Boston, MA  02111-1307, USA.

Note: a copy of the GNU General Public License is available on the web at <http://www.gnu.org/licenses/gpl.txt> and is included in this distribution as GPL.txt.

2008-11-22 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.