[ 
https://issues.apache.org/jira/browse/MATH-878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13475216#comment-13475216
 ] 

Ted Dunning commented on MATH-878:
----------------------------------

{quote}
Could you provide pls. some reference data for rootLogLikelihoodRatio test?
{quote}
>From Mahout (with a few extras added just now)
{code}
  @Test
  public void testRootLogLikelihood() {
    // positive where k11 is bigger than expected.
    assertTrue(LogLikelihood.rootLogLikelihoodRatio(904, 21060, 1144, 283012) > 
0.0);

    // negative because k11 is lower than expected
    assertTrue(LogLikelihood.rootLogLikelihoodRatio(36, 21928, 60280, 623876) < 
0.0);

    assertEquals(Math.sqrt(2.772589), LogLikelihood.rootLogLikelihoodRatio(1, 
0, 0, 1), 0.000001);
    assertEquals(-Math.sqrt(2.772589), LogLikelihood.rootLogLikelihoodRatio(0, 
1, 1, 0), 0.000001);
    assertEquals(Math.sqrt(27.72589), LogLikelihood.rootLogLikelihoodRatio(10, 
0, 0, 10), 0.00001);

    assertEquals(Math.sqrt(39.33052), LogLikelihood.rootLogLikelihoodRatio(5, 
1995, 0, 100000), 0.00001);
    assertEquals(-Math.sqrt(39.33052), LogLikelihood.rootLogLikelihoodRatio(0, 
100000, 5, 1995), 0.00001);

    assertEquals(Math.sqrt(4730.737), 
LogLikelihood.rootLogLikelihoodRatio(1000, 1995, 1000, 100000), 0.001);
    assertEquals(-Math.sqrt(4730.737), 
LogLikelihood.rootLogLikelihoodRatio(1000, 100000, 1000, 1995), 0.001);

    assertEquals(Math.sqrt(5734.343), 
LogLikelihood.rootLogLikelihoodRatio(1000, 1000, 1000, 100000), 0.001);
    assertEquals(Math.sqrt(5714.932), 
LogLikelihood.rootLogLikelihoodRatio(1000, 1000, 1000, 99000), 0.001);
  }
{code}
                
> G-Test (Log-Likelihood ratio - LLR test) in math.stat.inference
> ---------------------------------------------------------------
>
>                 Key: MATH-878
>                 URL: https://issues.apache.org/jira/browse/MATH-878
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.1, 3.2, 4.0
>         Environment: Netbeans
>            Reporter: Radoslav Tsvetkov
>              Labels: features, test
>             Fix For: 3.1
>
>         Attachments: MATH-878_gTest_12102012.patch, MATH-878_gTest.patch, 
> vcs-diff16294.patch
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> 1. Implementation of G-Test (Log-Likelihood ratio LLR test for independence 
> and goodnes-of-fit)
> 2. Reference: http://en.wikipedia.org/wiki/G-test
> 3. Reasons-Usefulness: G-tests are tests are increasingly being used in 
> situations where chi-squared tests were previously recommended. 
> The approximation to the theoretical chi-squared distribution for the G-test 
> is better than for the Pearson chi-squared tests. In cases where Observed 
> >2*Expected for some cell case, the G-test is always better than the 
> chi-squared test.
> For testing goodness-of-fit the G-test is infinitely more efficient than the 
> chi squared test in the sense of Bahadur, but the two tests are equally 
> efficient in the sense of Pitman or in the sense of Hodge and Lehman. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to