chi2_likelihood(M)

Computes the Likelihood Ratio test using the data in matrix M. Matrix M must be a contingency table.


See also chi2_goodness chi2_kappa chi2_mcnemar chi2_risk 


Example


The contingency table below shows some facts about drinking, and heart attacks:


Alcoholic
Heart attack
Total
Yes
No
Yes
4
1
5
No
2
5
7
Total
6
6
12

Entering the basic data in a matrix we obtain:

M = ( 4, 1; 2, 5)

/ 4 1 \

\ 2 5 /


We now use function chi2_totable to transform the matrix into a proper contingency table

M=chi2_totable(M)

/ "" "" "" "" \

| ""  4  1  5 |

| ""  2  5  7 |

\ ""  6  6 12 /


Using the function chi2_likelihood we obtain,

chi2_likelihood(M)


Likelihood Ratio Test.

Results:

Test statistics Xlr : 3.2557338578632082

P value: 0.07117407117035468