# UM.eqtest: Equality tests for two multinomial samples In MADPop: MHC Allele-Based Differencing Between Populations

## Description

Generate multinomial samples from a common probability vector and calculate the Chi-square and Likelihood Ratio test statistics.

## Usage

 `1` ```UM.eqtest(N1, N2, p0, nreps, verbose = TRUE) ```

## Arguments

 `N1` Size of sample 1. `N2` Size of sample 2. `p0` Common probability vector from which to draw the multinomial samples. Can also be a matrix, in which case each simulation randomly draws with replacement from the rows of p0. `nreps` Number of replications of the simulation. `verbose` Logical. If `TRUE` prints message every `5000` replications.

## Details

The chi-squared and likelihood ratio test statistics are calculated from multinomial samples (Y_11, Y_21),…,(Y_1M, Y_2M), where

Y_km ~ind Multinomial(N_k, p_m),

where p_m is the mth row of `p0`.

## Value

An `nreps x 2` matrix with the simulated chi-squared and LR values.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```# bootstrapped p-value calculation against equal genotype proportions # in lakes Michipicoten and Simcoe # contingency table popId <- c("Michipicoten", "Simcoe") ctab <- UM.suff(fish215[fish215\$Lake %in% popId,])\$tab ctab # MLE of probability vector p.MLE <- colSums(ctab)/sum(ctab) # sample sizes N1 <- sum(ctab[1,]) # Michipicoten N2 <- sum(ctab[2,]) # Simcoe # bootstrapped test statistics (chi^2 and LRT) T.boot <- UM.eqtest(N1 = N1, N2 = N2, p0 = p.MLE, nreps = 1e3) # observed test statistics T.obs <- c(chi2 = chi2.stat(ctab), LRT = LRT.stat(ctab)) # p-values rowMeans(t(T.boot) > T.obs) ```

MADPop documentation built on May 1, 2019, 6:47 p.m.