LRT.stat {MADPop}R Documentation

Likelihood ratio test statistic for contingency tables

Description

Calculate the likelihood ratio test statistic for general two-way contingency tables.

Usage

LRT.stat(tab)

Arguments

tab

A K x C matrix (contingency table) of counts. See details.

Details

Suppose that tab consists of counts from KK populations (rows) in CC categories. The likelihood ratio test statistic is computed as

2i=1Kj=1NOijlog(pijA/pj0), 2 \sum_{i=1}^K \sum_{j=1}^N O_{ij} \log(p^A_{ij}/p^0_{j}),

where OijO_{ij} is the observed number of counts in the iith row and jjth column of tab, pijA=Oij/j=1COijp^A_{ij} = O_{ij}/\sum_{j=1}^C O_{ij} is the unconstrained estimate of the proportion of category jj in population ii, and pj0=i=1KOij/i=1Kj=1COijp^0_j = \sum_{i=1}^K O_{ij} / \sum_{i=1}^K\sum_{j=1}^C O_{ij} is the estimate of this proportion under H0H_0 that the populations have indentical proportions in each category. If any column has only zeros it is removed before calculating the LRT statistic.

Value

The calculated value of the LRT statistic.

Examples

# simple contingency table
ctab <- rbind(pop1 = c(5, 3, 0, 3),
                pop2 = c(4, 10, 2, 5))
colnames(ctab) <- LETTERS[1:4]
ctab
LRT.stat(ctab) # likelihood ratio statistic

[Package MADPop version 1.1.7 Index]