Skip to contents

For a given dataset, encoded as a phyloseq object, and a set of r values, this function computes approximate means, standard deviations, medians, and selected quantiles of the MPQr distance under a null model in which sample values are independent Gaussian random variables with the same variance as in the observed data.

Usage

get_null_mean_and_variance(physeq, rvec = r_transform(0:100/100))

Arguments

physeq

A phyloseq object containing:

  • a phylogenetic tree (accessible via phy_tree)

  • an OTU/ASV abundance table (accessible via otu_table) The abundance table is used to compute per-taxon standard deviations.

rvec

A numeric vector of r values in 0,1 for which to compute null distribution summaries. Defaults to r_transform(0:100/100).

Value

A named list of numeric vectors (each of length length(rvec)). Elements of the list give some values related to the distribution of the MPQr distance between two samples under a null distribution. Under the null distribution, each sample has independent, normally-distributed elements with standard deviation equal to the empirical standard deviation of the observed variables. The statistics are as follows:

  • means: Approximate means of the MPQr distance between two samples in the independent-normal null model.

  • sds: Approximate standard deviations of the MPQr distance between two samples in the independent normal null model.

  • medians: Median of the null distribution.

  • lower: Lower 95% confidence bound (2.5% quantile of the null distribution)

  • upper: Upper 95% confidence bound (97.5% quantile of the null distribution)

Examples

data(gentry)
get_null_mean_and_variance(gentry, rvec = c(0, 0.5, 1))
#> $means
#> [1] 1.668650 1.849811 1.603383
#> 
#> $sds
#> [1] 0.1973371 0.2478399 0.5082042
#> 
#> $medians
#> [1] 1.651210 1.829096 1.530848
#> 
#> $lower
#> [1] 1.3459968 1.4421128 0.9731657
#> 
#> $upper
#> [1] 2.095702 2.381600 2.713150
#>