power.est: power.calc

View source: R/mpress.R

power.estR Documentation

power.calc

Description

power.calc() calculates the number of samples to dectect a difference between microbiomes with two different metadata values.

Usage

power.est(in.phyloseq, metadata.var, metadata.vals, start.n = 5,
  alpha = 0.05, beta = 0.95, dist.metric = "bray", deseq.val = 0,
  n.rep = 100, burn.in = 10, verbose = T, binom = F,
  switch.val = 0, seed.val = 0)

Arguments

in.phyloseq

Required. The collection of microbiome samples to use. Required to be a class phyloseq data

metadata.var

Required. The column name in the metadata values that is being compared for the power.

metadata.vals

Required. Vector with the values to be compared.

alpha

Alpha value used to test the microbiome differences. Default is 0.05

beta

Beta value used to test proportion of estimated samples that contain significant differences. Default is 0.95

dist.metric

String giving the distance metric to use between the microbiome samples. Default "bray" (Bray-Curtis). Available options can be seen with distanceMethodList.

deseq.val

Value to use for the DESeq2 run to trim the taxa. if the value is 0,use all taxa (Default); if the value is between 0 and 1, all taxa with an FDR below the value will be selected; otherwise, if the value is >=1, that number of top taxa by FDR will be selected

n.rep

Maximum number of replicates to run before final check if above the beta threshold. Default = 100.

burn.in

Value to burning in for the binomial test. Default is 10

verbose

Flag to prints intermediate values to the screen. Default = F

binom

Flag to use the binomial test to stop low mapping values. Default = F

switch.val

sample number at which to automatically swap between sampling and simulation. Default = 0, or only swap once sample number exceeds the number of samples

seed.val

Value to set seed value for troubleshooting. Default = 0 (not set)

start.

The sample size at which to start the tests. Default is 5.

Value

Returns a class MPrESS variable with the sample number in addition to runtime information for use in verification

Examples

#The following data is from Chavda et al 2016 which phylotyped Enterobacter genomes

#Additional printing and plotting options are availible with plot() and print(). For more information refer to ?plot.mpress and ?print.mpress
#The following data is from Zhang et al 2015 using Microbiome data from multiple sites in China
# Our example uses the data underpinning the tree shown in Figure 2

library(mpress);
#Loading in the Chinese metadata file
data(ChinaData);
data(SpainData);

#Use summary() to examine the data loaded
summary(china.power)

#Other microbiomes: china.trim from data(ChinaData): unnamed OTUs removed
#                  spain.ibs.trim from

#Use plot() to see the plot of the power and p-value in the different sample numbers
plot(china.power)

JCVenterInstitute/MPress documentation built on Jan. 1, 2023, 11:55 a.m.