Description Usage Arguments Details Value Examples

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

1 | ```
LRT.stat(tab)
``` |

`tab` |
A |

Suppose that `tab`

consists of counts from *K* populations (rows) in *C* categories. The likelihood ratio test statistic is computed as

*
2 ∑_ij O_ij log(p_ij/p_0j),
*

where *O_ij* is the observed number of counts in the *i*th row and *j*th column of `tab`

, *p_ij = O_ij/(∑_j O_ij)* is the unconstrained estimate of the proportion of category *j* in population *i*, and *p_0j = ∑_i O_ij / ∑_ij O_ij* is the estimate of this proportion under *H_0* that the populations have indentical proportions in each category. If any column has only zeros it is removed before calculating the LRT statistic.

The calculated value of the LRT statistic.

1 2 3 4 5 6 |

```
Loading required package: rstan
Loading required package: ggplot2
Loading required package: StanHeaders
rstan (Version 2.16.2, packaged: 2017-07-03 09:24:58 UTC, GitRev: 2e1f913d3ca3)
For execution on a local, multicore CPU with excess RAM we recommend calling
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())
A B C D
pop1 5 3 0 3
pop2 4 10 2 5
[1] 4.187832
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.