# MC.Xsc.statistics: Size and Power for the One Sample RAD Probability-Mean Test... In HMP: Hypothesis Testing and Power Calculations for Comparing Metagenomic Samples from HMP

## Description

This Monte-Carlo simulation procedure provides the power and size of the one sample RAD probability-mean test, using the Generalized Wald-type statistic.

## Usage

 `1` ```MC.Xsc.statistics(Nrs, numMC = 10, fit, pi0 = NULL, type = "ha", siglev = 0.05) ```

## Arguments

 `Nrs` A vector specifying the number of reads/sequence depth for each sample. `numMC` Number of Monte-Carlo experiments. In practice this should be at least 1,000. `fit` A list (in the format of the output of dirmult function) containing the data parameters for evaluating either the size or power of the test. `pi0` The RAD-probability mean vector. If the type is set to `"hnull"` then pi0 is set by the sample in fit. `type` If `"hnull"`: Computes the size of the test. If `"ha"`: Computes the power of the test. (default) `siglev` Significance level for size of the test / power calculation. The default is 0.05.

## Details

Note: Though the test statistic supports an unequal number of reads across samples, the performance has not yet been fully tested.

## Value

Size of the test statistics (under `"hnull"`) or power (under `"ha"`) of the test.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24``` ``` data(saliva) data(throat) data(tonsils) ### Get a list of dirichlet-multinomial parameters for the data fit.saliva <- DM.MoM(saliva) fit.throat <- DM.MoM(throat) fit.tonsils <- DM.MoM(tonsils) ### Set up the number of Monte-Carlo experiments ### We use 1 for speed, should be at least 1,000 numMC <- 1 ### Generate the number of reads per sample ### The first number is the number of reads and the second is the number of subjects nrs <- rep(15000, 25) ### Computing size of the test statistics (Type I error) pval1 <- MC.Xsc.statistics(nrs, numMC, fit.tonsils, fit.saliva\$pi, "hnull") pval1 ### Computing Power of the test statistics (Type II error) pval2 <- MC.Xsc.statistics(nrs, numMC, fit.throat, fit.tonsils\$pi) pval2 ```

### Example output

```Loading required package: dirmult

Attaching package: 'HMP'

The following object is masked from 'package:dirmult':

weirMoM

 0.5
 1
```

HMP documentation built on Aug. 31, 2019, 5:05 p.m.