FourHnullplaneD: Bootstrap Distribution Around the Null Plane

View source: R/FourHnullplaneD.R

FourHnullplaneDR Documentation

Bootstrap Distribution Around the Null Plane

Description

Calculates the distribution of bootstrap samples around the null expectation for Union vs. Intersection models.

Usage

FourHnullplaneD(boots)

Arguments

boots

(Required) Output matrix from the FourHbootstrap function

Details

For each bootstrap sample, FourHnullplaneD uses the fraction of microbes shared by both progenitors to calculate null model expectations for the value of \mathcal{U} and \mathcal{I}. It then calculates the difference between the observed and expected values along the intersection and union dimensions \mathcal{I}-\mathcal{I}_{null} and \mathcal{U}-\mathcal{U}_{null}. Finally, FourHnullplaneD plots a histogram of the difference between observed and expected intersection dimensions, \mathcal{I}-\mathcal{I}_{null} and calculates the average distance between the observed and expected intersection dimensions, as well as the standard deviation of \mathcal{I}-\mathcal{I}_{null} and the fraction of bootstrapped samples where \mathcal{I}-\mathcal{I}_{null}<0 (i.e., hybrids preferentially retain microbial taxa only found on one progenitor). Preferential retention of microbial taxa found on both progenitors can then be assessed as >95% of bootstrapped samples having \mathcal{I}-\mathcal{I}_{null}>0.

Value

This function outputs a list including a dataframe with the following lists:

sigma

The inputted values of \sigma for each bootstrapped sample.

theta

The calculated values of \theta = \mathcal{G}+\mathcal{L} for each bootstrapped sample.

union

The observed values of the union dimension, \mathcal{U}, for each bootstrapped sample.

union_expectation

The expected values of the union dimension, \mathcal{U}_{null}, for each bootstrapped sample.

intersection

The observed values of the intersection dimension, \mathcal{I}, for each bootstrapped sample.

intersection_expectation

The expected values of the intersection dimension, \mathcal{I}_{null}, for each bootstrapped sample.

diffI

The difference between the observed and expected values of the intersection dimension for each bootstrapped sample.

diffU

The difference between the observed and expected values of the union dimension for each bootstrapped sample.

as well as the average distance and standard deviation between the observed and expected intersection dimensions, and the fraction of bootstrapped samples where hybrids preferentially retain microbial taxa only found on one progenitor.

Examples

#Test with enterotype dataset
library(phyloseq)
data(enterotype)
#Covert the OTU table to reads, rather than fractional abundances
otu_table(enterotype)<-round(10000*otu_table(enterotype))


#Randomly assign host classes (these should be known in a real hybrid microbiome dataset)
#The two parent species are assigned '1' and '3' respectively, the hybrid is assigned '2'
hybrid_status<-sample(1:3,280, replace=TRUE)

#Bootstrap the dataset
boot_samples<-FourHbootstrap(enterotype,hybrid_status,0.5,5,10)

#Calculate the expected and observed distributions of bootstrapped samples around the null plane
FourHnullplaneD(boot_samples)


HybridMicrobiomes documentation built on May 29, 2024, 2:15 a.m.