Title: | Count Regression for Correlated Observations with the Beta-Binomial |
---|---|
Description: | Statistical modeling for correlated count data using the beta-binomial distribution, described in Martin et al. (2020) <doi:10.1214/19-AOAS1283>. It allows for both mean and overdispersion covariates. |
Authors: | Bryan D Martin [aut], Daniela Witten [aut], Sarah Teichman [ctb], Amy D Willis [aut, cre], Thomas W Yee [ctb] (VGAM library), Xiangjie Xue [ctb] (VGAM library) |
Maintainer: | Amy D Willis <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.4.1 |
Built: | 2024-11-03 05:23:18 UTC |
Source: | https://github.com/statdivlab/corncob |
Corncob provides methods for estimating and plotting count data. Specifically, corncob is designed to account for the challenges of modeling sequencing data from microbial abundance studies.
For details on the model implemented in this package, see Martin et al. (2020) <doi:10.1214/19-AOAS1283>.
The development version of the package will be maintained on https://github.com/statdivlab/corncob.
No return value. Created for documentation.
Maximum Likelihood for the Beta-binomial Distribution
bbdml( formula, phi.formula, data, link = "logit", phi.link = "logit", method = "trust", control = list(maxit = 1000, reltol = 1e-14), numerical = FALSE, nstart = 1, inits = NULL, allow_noninteger = FALSE, robust = FALSE, ... )
bbdml( formula, phi.formula, data, link = "logit", phi.link = "logit", method = "trust", control = list(maxit = 1000, reltol = 1e-14), numerical = FALSE, nstart = 1, inits = NULL, allow_noninteger = FALSE, robust = FALSE, ... )
formula |
an object of class |
phi.formula |
an object of class |
data |
a data frame or |
link |
link function for abundance covariates, defaults to |
phi.link |
link function for dispersion covariates, defaults to |
method |
optimization method, defaults to |
control |
optimization control parameters (see |
numerical |
Boolean. Defaults to |
nstart |
Integer. Defaults to |
inits |
Optional initializations as rows of a matrix. Defaults to |
allow_noninteger |
Boolean. Defaults to |
robust |
Should robust standard errors be returned? If not, model-based standard arras are used. Logical, defaults to |
... |
An object of class bbdml
.
# data frame example data(soil_phylum_small_otu1) bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) # phyloseq example (only run this if you have phyloseq installed) ## Not run: data(soil_phylum_small_sample) data(soil_phylum_small_otu) data_phylo <- phyloseq::phyloseq(phyloseq::sample_data(soil_phylum_small_sample), phyloseq::otu_table(soil_phylum_small_otu, taxa_are_rows = TRUE)) bbdml(formula = Proteobacteria ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = data_phylo) ## End(Not run)
# data frame example data(soil_phylum_small_otu1) bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) # phyloseq example (only run this if you have phyloseq installed) ## Not run: data(soil_phylum_small_sample) data(soil_phylum_small_otu) data_phylo <- phyloseq::phyloseq(phyloseq::sample_data(soil_phylum_small_sample), phyloseq::otu_table(soil_phylum_small_otu, taxa_are_rows = TRUE)) bbdml(formula = Proteobacteria ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = data_phylo) ## End(Not run)
Check for nested models
checkNested(mod, mod_null)
checkNested(mod, mod_null)
mod |
an object of class |
mod_null |
an object of class |
TRUE
if mod_null
is nested within mod
, otherwise it throws an error.
data(soil_phylum_small_otu1) mod1 <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) mod2 <- bbdml(formula = cbind(W, M - W) ~ 1, phi.formula = ~ 1, data = soil_phylum_small_otu1) checkNested(mod1, mod2)
data(soil_phylum_small_otu1) mod1 <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) mod2 <- bbdml(formula = cbind(W, M - W) ~ 1, phi.formula = ~ 1, data = soil_phylum_small_otu1) checkNested(mod1, mod2)
Renames taxa to have short human-readable names
clean_taxa_names(x, name = "OTU")
clean_taxa_names(x, name = "OTU")
x |
Object of class |
name |
Character, defaults to |
The original taxa names are saved as the original_names
attribute. See the example for an example of how to access the original names.
Object of class phyloseq
, with taxa renamed (defaults to OTU1, OTU2, ...), with the original taxa names saved as an attribute.
Identify differentially-abundant and differentially-variable taxa using contrasts
contrastsTest( formula, phi.formula, contrasts_DA = NULL, contrasts_DV = NULL, data, link = "logit", phi.link = "logit", sample_data = NULL, taxa_are_rows = TRUE, filter_discriminant = TRUE, fdr_cutoff = 0.05, fdr = "fdr", inits = NULL, try_only = NULL, ... )
contrastsTest( formula, phi.formula, contrasts_DA = NULL, contrasts_DV = NULL, data, link = "logit", phi.link = "logit", sample_data = NULL, taxa_are_rows = TRUE, filter_discriminant = TRUE, fdr_cutoff = 0.05, fdr = "fdr", inits = NULL, try_only = NULL, ... )
formula |
an object of class |
phi.formula |
an object of class |
contrasts_DA |
List. Optional. Constructs a contrast matrix. List elements should be characters specifying contrasts in the parameters within |
contrasts_DV |
List. Optional. Constructs a contrast matrix. List elements should be characters specifying contrasts in the parameters within |
data |
a data frame containing the OTU table, or |
link |
link function for abundance covariates, defaults to |
phi.link |
link function for dispersion covariates, defaults to |
sample_data |
Data frame or matrix. Defaults to |
taxa_are_rows |
Boolean. Optional. If |
filter_discriminant |
Boolean. Defaults to |
fdr_cutoff |
Integer. Defaults to |
fdr |
Character. Defaults to |
inits |
Optional initializations for model fit using |
try_only |
Optional numeric. Will try only the |
... |
Optional additional arguments for |
This function uses contrast matrices to test for differential abundance and differential variability using a Wald-type chi-squared test. To use a formula implementation, see differentialTest
.
An object of class contrastsTest
. List with elements p
containing the p-values for each contrast, p_fdr
containing the p-values after false discovery rate control, significant_taxa
containing the taxa names of the statistically significant taxa, contrasts_DA
containing the contrast matrix for parameters associated with the abundance, contrasts_DV
containing the contrast matrix for parameters associated with the dispersion, discriminant_taxa_DA
containing the taxa for which at least one covariate associated with the abundance was perfectly discriminant, discriminant_taxa_DV
containing the taxa for which at least one covariate associated with the dispersion was perfectly discriminant, and data
containing the data used to fit the models.
# data frame example data(soil_phylum_contrasts_sample) data(soil_phylum_contrasts_otu) da_analysis <- contrastsTest(formula = ~ DayAmdmt, phi.formula = ~ DayAmdmt, contrasts_DA = list("DayAmdmt21 - DayAmdmt11", "DayAmdmt22 - DayAmdmt21"), data = soil_phylum_contrasts_otu, sample_data = soil_phylum_contrasts_sample, fdr_cutoff = 0.05, try_only = 1:5) # phyloseq example (only run if you have phyloseq installed) ## Not run: contrasts_phylo <- phyloseq::phyloseq(phyloseq::sample_data(soil_phylum_contrasts_sample), phyloseq::otu_table(soil_phylum_contrasts_otu, taxa_are_rows = TRUE)) da_analysis <- contrastsTest(formula = ~ DayAmdmt, phi.formula = ~ DayAmdmt, contrasts_DA = list("DayAmdmt21 - DayAmdmt11", "DayAmdmt22 - DayAmdmt21"), data = contrasts_phylo, fdr_cutoff = 0.05, try_only = 1:5) ## End(Not run)
# data frame example data(soil_phylum_contrasts_sample) data(soil_phylum_contrasts_otu) da_analysis <- contrastsTest(formula = ~ DayAmdmt, phi.formula = ~ DayAmdmt, contrasts_DA = list("DayAmdmt21 - DayAmdmt11", "DayAmdmt22 - DayAmdmt21"), data = soil_phylum_contrasts_otu, sample_data = soil_phylum_contrasts_sample, fdr_cutoff = 0.05, try_only = 1:5) # phyloseq example (only run if you have phyloseq installed) ## Not run: contrasts_phylo <- phyloseq::phyloseq(phyloseq::sample_data(soil_phylum_contrasts_sample), phyloseq::otu_table(soil_phylum_contrasts_otu, taxa_are_rows = TRUE)) da_analysis <- contrastsTest(formula = ~ DayAmdmt, phi.formula = ~ DayAmdmt, contrasts_DA = list("DayAmdmt21 - DayAmdmt11", "DayAmdmt22 - DayAmdmt21"), data = contrasts_phylo, fdr_cutoff = 0.05, try_only = 1:5) ## End(Not run)
Function to subset and convert phyloseq data
convert_phylo(data, select)
convert_phylo(data, select)
data |
a |
select |
Name of OTU or taxa to select, must match taxa name in |
A data.frame
object, with elements W
as the observed counts, M
as the sequencing depth, and the sample data with their original names.
Hyperbolic cotangent transformation
coth(x)
coth(x)
x |
data |
Hyperbolic cotangent transformation of x
x <- .5 coth(x)
x <- .5 coth(x)
Betabinomial density
dbetabin(theta, W, M, X, X_star, np, npstar, link, phi.link, logpar = TRUE)
dbetabin(theta, W, M, X, X_star, np, npstar, link, phi.link, logpar = TRUE)
theta |
Numeric vector. Parameters associated with |
W |
Numeric vector of counts |
M |
Numeric vector of sequencing depth |
X |
Matrix of covariates associated with abundance (including intercept) |
X_star |
Matrix of covariates associated with dispersion (including intercept) |
np |
Number of covariates associated with abundance (including intercept) |
npstar |
Number of covariates associated with dispersion (including intercept) |
link |
ink function for abundance covariates |
phi.link |
ink function for dispersion covariates |
logpar |
Boolean. Defaults to |
Negative beta-binomial (log-)likelihood
Created as a convenient helper function for optimization. Not intended for users.
dbetabin_neg(theta, W, M, X, X_star, np, npstar, link, phi.link, logpar = TRUE)
dbetabin_neg(theta, W, M, X, X_star, np, npstar, link, phi.link, logpar = TRUE)
theta |
Numeric vector. Parameters associated with |
W |
Numeric vector of counts |
M |
Numeric vector of sequencing depth |
X |
Matrix of covariates associated with abundance (including intercept) |
X_star |
Matrix of covariates associated with dispersion (including intercept) |
np |
Number of covariates associated with abundance (including intercept) |
npstar |
Number of covariates associated with dispersion (including intercept) |
link |
ink function for abundance covariates |
phi.link |
ink function for dispersion covariates |
logpar |
Boolean. Defaults to |
Negative beta-binomial (log-)likelihood
In some cases we may not have integer W and M's. In these cases, we can still use corncob to estimate parameters, but we need to think of them as no longer coming from the specific beta binomial parametric model, and instead from an estimating equations framework.
dbetabinom_cts(x, size, prob, rho = 0, log = FALSE)
dbetabinom_cts(x, size, prob, rho = 0, log = FALSE)
x |
the value at which defined the density |
size |
number of trials |
prob |
the probability of success |
rho |
the correlation parameter |
log |
if TRUE, log-densities p are given |
Thomas W Yee
Xiangjie Xue
Amy D Willis
Identify differentially-abundant and differentially-variable taxa
differentialTest( formula, phi.formula, formula_null, phi.formula_null, data, link = "logit", phi.link = "logit", test, boot = FALSE, B = 1000, sample_data = NULL, taxa_are_rows = TRUE, filter_discriminant = TRUE, fdr_cutoff = 0.05, fdr = "fdr", full_output = FALSE, inits = NULL, inits_null = NULL, try_only = NULL, verbose = FALSE, robust = FALSE, ... )
differentialTest( formula, phi.formula, formula_null, phi.formula_null, data, link = "logit", phi.link = "logit", test, boot = FALSE, B = 1000, sample_data = NULL, taxa_are_rows = TRUE, filter_discriminant = TRUE, fdr_cutoff = 0.05, fdr = "fdr", full_output = FALSE, inits = NULL, inits_null = NULL, try_only = NULL, verbose = FALSE, robust = FALSE, ... )
formula |
an object of class |
phi.formula |
an object of class |
formula_null |
Formula for mean under null, without response |
phi.formula_null |
Formula for overdispersion under null, without response |
data |
a data frame containing the OTU table, or |
link |
link function for abundance covariates, defaults to |
phi.link |
link function for dispersion covariates, defaults to |
test |
Character. Hypothesis testing procedure to use. One of |
boot |
Boolean. Defaults to |
B |
Optional integer. Number of bootstrap iterations. Ignored if |
sample_data |
Data frame or matrix. Defaults to |
taxa_are_rows |
Boolean. Optional. If |
filter_discriminant |
Boolean. Defaults to |
fdr_cutoff |
Integer. Defaults to |
fdr |
Character. Defaults to |
full_output |
Boolean. Opetional. Defaults to |
inits |
Optional initializations for model fit using |
inits_null |
Optional initializations for model fit using |
try_only |
Optional numeric. Will try only the |
verbose |
Boolean. Defaults to |
robust |
Should robust standard errors be used? If not, model-based standard errors are used. Logical, defaults to |
... |
Optional additional arguments for |
See package vignette for details and example usage. Make sure the number of columns in all of the initializations are correct! inits
probably shouldn't match inits_null
. To use a contrast matrix, see contrastsTest
.
An object of class differentialTest
. List with elements p
containing the p-values, p_fdr
containing the p-values after false discovery rate control, significant_taxa
containing the taxa names of the statistically significant taxa, significant_models
containing a list of the model fits for the significant taxa, all_models
containing a list of the model fits for all taxa, restrictions_DA
containing a list of covariates that were tested for differential abundance, restrictions_DV
containing a list of covariates that were tested for differential variability, discriminant_taxa_DA
containing the taxa for which at least one covariate associated with the abundance was perfectly discriminant, discriminant_taxa_DV
containing the taxa for which at least one covariate associated with the dispersion was perfectly discriminant, data
containing the data used to fit the models. If full_output = TRUE
, it will also include full_output
, a list of all model output from bbdml
.
# data frame example data(soil_phylum_small_sample) data(soil_phylum_small_otu) da_analysis <- differentialTest(formula = ~ DayAmdmt, phi.formula = ~ DayAmdmt, formula_null = ~ 1, phi.formula_null = ~ DayAmdmt, test = "Wald", boot = FALSE, data = soil_phylum_small_otu, sample_data = soil_phylum_small_sample, fdr_cutoff = 0.05, try_only = 1:5) # phyloseq example (only run if you have phyloseq installed) ## Not run: data_phylo <- phyloseq::phyloseq(phyloseq::sample_data(soil_phylum_small_sample), phyloseq::otu_table(soil_phylum_small_otu, taxa_are_rows = TRUE)) da_analysis <- differentialTest(formula = ~ DayAmdmt, phi.formula = ~ DayAmdmt, formula_null = ~ 1, phi.formula_null = ~ DayAmdmt, test = "Wald", boot = FALSE, data = data_phylo, fdr_cutoff = 0.05, try_only = 1:5) ## End(Not run)
# data frame example data(soil_phylum_small_sample) data(soil_phylum_small_otu) da_analysis <- differentialTest(formula = ~ DayAmdmt, phi.formula = ~ DayAmdmt, formula_null = ~ 1, phi.formula_null = ~ DayAmdmt, test = "Wald", boot = FALSE, data = soil_phylum_small_otu, sample_data = soil_phylum_small_sample, fdr_cutoff = 0.05, try_only = 1:5) # phyloseq example (only run if you have phyloseq installed) ## Not run: data_phylo <- phyloseq::phyloseq(phyloseq::sample_data(soil_phylum_small_sample), phyloseq::otu_table(soil_phylum_small_otu, taxa_are_rows = TRUE)) da_analysis <- differentialTest(formula = ~ DayAmdmt, phi.formula = ~ DayAmdmt, formula_null = ~ 1, phi.formula_null = ~ DayAmdmt, test = "Wald", boot = FALSE, data = data_phylo, fdr_cutoff = 0.05, try_only = 1:5) ## End(Not run)
Internal function. Not intended for users.
doBoot(mod, mod_null, test, robust = FALSE)
doBoot(mod, mod_null, test, robust = FALSE)
mod |
an object of class |
mod_null |
an object of class |
test |
Character. Hypothesis testing procedure to use. One of |
robust |
Should robust standard errors be used? If not, model-based standard arras are used. Logical, defaults to |
test statistic from one bootstrap iteration
Fisher's z transformation
fishZ(x)
fishZ(x)
x |
data |
Fisher's z transformation of x
x <- .5 fishZ(x)
x <- .5 fishZ(x)
Generate initialization for optimization
genInits(W, M, X, X_star, np, npstar, link, phi.link, nstart = 1, use = TRUE)
genInits(W, M, X, X_star, np, npstar, link, phi.link, nstart = 1, use = TRUE)
W |
Numeric vector of counts |
M |
Numeric vector of sequencing depth |
X |
Matrix of covariates associated with abundance (including intercept) |
X_star |
Matrix of covariates associated with dispersion (including intercept) |
np |
Number of covariates associated with abundance (including intercept) |
npstar |
Number of covariates associated with dispersion (including intercept) |
link |
ink function for abundance covariates |
phi.link |
ink function for dispersion covariates |
nstart |
Integer. Defaults to |
use |
Boolean. Defaults to |
Matrix of initializations
set.seed(1) seq_depth <- rpois(20, lambda = 10000) my_counts <- rbinom(20, size = seq_depth, prob = 0.001) * 10 my_covariate <- cbind(rep(c(0,1), each = 10)) colnames(my_covariate) <- c("X1") genInits(W = my_counts, M = seq_depth, X = cbind(1, my_covariate), X_star = cbind(1, my_covariate), np = 2, npstar = 2, link = "logit", phi.link = "logit", nstart = 2, use = TRUE)
set.seed(1) seq_depth <- rpois(20, lambda = 10000) my_counts <- rbinom(20, size = seq_depth, prob = 0.001) * 10 my_covariate <- cbind(rep(c(0,1), each = 10)) colnames(my_covariate) <- c("X1") genInits(W = my_counts, M = seq_depth, X = cbind(1, my_covariate), X_star = cbind(1, my_covariate), np = 2, npstar = 2, link = "logit", phi.link = "logit", nstart = 2, use = TRUE)
Created as a convenient helper function. Not intended for users.
getRestrictionTerms( mod, mod_null = NULL, restrictions = NULL, restrictions.phi = NULL )
getRestrictionTerms( mod, mod_null = NULL, restrictions = NULL, restrictions.phi = NULL )
mod |
an object of class |
mod_null |
Optional. An object of class |
restrictions |
Optional. Defaults to |
restrictions.phi |
Optional. Defaults to |
A list with mu
representing the index of the restricted covariates associated with abundance and phi
representing the index of the restricted covarates associated with the dispersion
Used for internal optimization. Not intended for users.
gr_full(theta, W, M, X, X_star, np, npstar, link, phi.link, logpar = TRUE)
gr_full(theta, W, M, X, X_star, np, npstar, link, phi.link, logpar = TRUE)
theta |
Numeric vector. Parameters associated with |
W |
Numeric vector of counts |
M |
Numeric vector of sequencing depth |
X |
Matrix of covariates associated with abundance (including intercept) |
X_star |
Matrix of covariates associated with dispersion (including intercept) |
np |
Number of covariates associated with abundance (including intercept) |
npstar |
Number of covariates associated with dispersion (including intercept) |
link |
ink function for abundance covariates |
phi.link |
ink function for dispersion covariates |
logpar |
Boolean. Defaults to |
Gradient of likelihood with respect to parameters
Get highest density interval of beta-binomial
HDIbetabinom(percent, M, mu, phi)
HDIbetabinom(percent, M, mu, phi)
percent |
Numeric. Percent interval desired. |
M |
Numeric vector of sequencing depth |
mu |
Numeric vector of abundance parameter |
phi |
Numeric vector of dispersion parameter |
List where lower
represents the lower bound and upper
represents the upper bound
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) HDIbetabinom(.95, M = mod$M[1], mu = mod$mu.resp[1], phi = mod$phi.resp[1])
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) HDIbetabinom(.95, M = mod$M[1], mu = mod$mu.resp[1], phi = mod$phi.resp[1])
Compute Hessian matrix at the MLE
hessian(mod, numerical = FALSE)
hessian(mod, numerical = FALSE)
mod |
an object of class |
numerical |
Boolean. Defaults to |
Hessian matrix at the MLE. In this setting, it's hard to compute expectations to calculate the information matrix,
so we return the consistent estimate using sample moments:
evaluated at
.
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) hessian(mod)
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) hessian(mod)
OTU data frame from a phyloseq object from an IBD microbiome study.
ibd_phylo_otu
ibd_phylo_otu
A data frame of OTU counts.
Papa, E., Docktor, M., Smillie, C., Weber, S., Preheim, S. P., Gevers, D., Giannoukos, G., Ciulla, D., Tabbaa, D., Ingram, J., Schauer, D. B., Ward, D. V., Korzenik, J. R., Xavier, R. J., Bousvaros, A., Alm, E. J. & Schauer, D. B. (2012). Non-invasive mapping of the gastrointestinal microbiota identifies children with inflammatory bowel disease. PloS One, 7(6), e39242. <doi.org/10.1371/journal.pone.0039242>.
Duvallet, C., Gibbons, S., Gurry, T., Irizarry, R., & Alm, E. (2017). MicrobiomeHD: the human gut microbiome in health and disease [Data set]. Zenodo. <doi.org/10.5281/zenodo.1146764>.
Sample data from a phyloseq object from an IBD microbiome study.
ibd_phylo_sample
ibd_phylo_sample
A data frame of sample data.
Papa, E., Docktor, M., Smillie, C., Weber, S., Preheim, S. P., Gevers, D., Giannoukos, G., Ciulla, D., Tabbaa, D., Ingram, J., Schauer, D. B., Ward, D. V., Korzenik, J. R., Xavier, R. J., Bousvaros, A., Alm, E. J. & Schauer, D. B. (2012). Non-invasive mapping of the gastrointestinal microbiota identifies children with inflammatory bowel disease. PloS One, 7(6), e39242. <doi.org/10.1371/journal.pone.0039242>.
Duvallet, C., Gibbons, S., Gurry, T., Irizarry, R., & Alm, E. (2017). MicrobiomeHD: the human gut microbiome in health and disease [Data set]. Zenodo. <doi.org/10.5281/zenodo.1146764>.
Taxonomy data from a phyloseq object from an IBD microbiome study.
ibd_phylo_taxa
ibd_phylo_taxa
A data frame of taxonomy data.
Papa, E., Docktor, M., Smillie, C., Weber, S., Preheim, S. P., Gevers, D., Giannoukos, G., Ciulla, D., Tabbaa, D., Ingram, J., Schauer, D. B., Ward, D. V., Korzenik, J. R., Xavier, R. J., Bousvaros, A., Alm, E. J. & Schauer, D. B. (2012). Non-invasive mapping of the gastrointestinal microbiota identifies children with inflammatory bowel disease. PloS One, 7(6), e39242. <doi.org/10.1371/journal.pone.0039242>.
Duvallet, C., Gibbons, S., Gurry, T., Irizarry, R., & Alm, E. (2017). MicrobiomeHD: the human gut microbiome in health and disease [Data set]. Zenodo. <doi.org/10.5281/zenodo.1146764>.
Inverse Fisher's z transformation
invfishZ(x)
invfishZ(x)
x |
data |
Inverse Fisher's z transformation of x
x <- .5 invfishZ(x)
x <- .5 invfishZ(x)
Inverse logit transformation
invlogit(x)
invlogit(x)
x |
data |
Inverse logit transformation of x
x <- .5 invlogit(x)
x <- .5 invlogit(x)
Logit transformation
logit(x)
logit(x)
x |
data |
logit of x
x <- .5 logit(x)
x <- .5 logit(x)
Likelihood ratio test
lrtest(mod, mod_null)
lrtest(mod, mod_null)
mod |
an object of class |
mod_null |
an object of class |
P-value from likelihood ratio test.
data(soil_phylum_small_otu1) mod1 <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) mod2 <- bbdml(formula = cbind(W, M - W) ~ 1, phi.formula = ~ 1, data = soil_phylum_small_otu1) lrtest(mod1, mod2)
data(soil_phylum_small_otu1) mod1 <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) mod2 <- bbdml(formula = cbind(W, M - W) ~ 1, phi.formula = ~ 1, data = soil_phylum_small_otu1) lrtest(mod1, mod2)
Used for internal optimization. Not intended for users.
objfun(theta, W, M, X, X_star, np, npstar, link, phi.link)
objfun(theta, W, M, X, X_star, np, npstar, link, phi.link)
theta |
Numeric vector. Parameters associated with |
W |
Numeric vector of counts |
M |
Numeric vector of sequencing depth |
X |
Matrix of covariates associated with abundance (including intercept) |
X_star |
Matrix of covariates associated with dispersion (including intercept) |
np |
Number of covariates associated with abundance (including intercept) |
npstar |
Number of covariates associated with dispersion (including intercept) |
link |
ink function for abundance covariates |
phi.link |
ink function for dispersion covariates |
List of negative log-likelihood, gradient, and hessian
Transform OTUs to their taxonomic label
otu_to_taxonomy(OTU, data, level = NULL)
otu_to_taxonomy(OTU, data, level = NULL)
OTU |
String vector. Names of OTU labels in |
data |
|
level |
(Optional). Character vector. Desired taxonomic levels for output. |
String vector. Names of taxonomic labels matching labels of OTU
.
Parametric bootstrap likelihood ratio test
pbLRT(mod, mod_null, B = 1000)
pbLRT(mod, mod_null, B = 1000)
mod |
an object of class |
mod_null |
an object of class |
B |
Integer. Defaults to |
P-value from parametric bootstrap likelihood ratio test.
data(soil_phylum_small_otu1) mod1 <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) mod2 <- bbdml(formula = cbind(W, M - W) ~ 1, phi.formula = ~ 1, data = soil_phylum_small_otu1) pbLRT(mod1, mod2, B = 50)
data(soil_phylum_small_otu1) mod1 <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) mod2 <- bbdml(formula = cbind(W, M - W) ~ 1, phi.formula = ~ 1, data = soil_phylum_small_otu1) pbLRT(mod1, mod2, B = 50)
Parametric bootstrap Rao test
pbRao(mod, mod_null, B = 1000)
pbRao(mod, mod_null, B = 1000)
mod |
an object of class |
mod_null |
an object of class |
B |
Integer. Defaults to |
P-value from parametric bootstrap Rao test.
data(soil_phylum_small_otu1) mod1 <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) mod2 <- bbdml(formula = cbind(W, M - W) ~ 1, phi.formula = ~ 1, data = soil_phylum_small_otu1) pbRao(mod1, mod2, B = 10)
data(soil_phylum_small_otu1) mod1 <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) mod2 <- bbdml(formula = cbind(W, M - W) ~ 1, phi.formula = ~ 1, data = soil_phylum_small_otu1) pbRao(mod1, mod2, B = 10)
Parametric bootstrap Wald test
pbWald(mod, mod_null, B = 1000, robust = FALSE)
pbWald(mod, mod_null, B = 1000, robust = FALSE)
mod |
an object of class |
mod_null |
an object of class |
B |
Integer. Defaults to |
robust |
Should robust standard errors be used? If not, model-based standard arras are used. Logical, defaults to |
P-value from parametric bootstrap Wald test.
data(soil_phylum_small_otu1) mod1 <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) mod2 <- bbdml(formula = cbind(W, M - W) ~ 1, phi.formula = ~ 1, data = soil_phylum_small_otu1) pbWald(mod1, mod2, B = 50)
data(soil_phylum_small_otu1) mod1 <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) mod2 <- bbdml(formula = cbind(W, M - W) ~ 1, phi.formula = ~ 1, data = soil_phylum_small_otu1) pbWald(mod1, mod2, B = 50)
Plotting function
## S3 method for class 'bbdml' plot( x, total = FALSE, color = NULL, shape = NULL, facet = NULL, title = NULL, B = 1000, sample_names = TRUE, data_only = FALSE, ... )
## S3 method for class 'bbdml' plot( x, total = FALSE, color = NULL, shape = NULL, facet = NULL, title = NULL, B = 1000, sample_names = TRUE, data_only = FALSE, ... )
x |
Object of class |
total |
(Optional). Default |
color |
(Optional). Default |
shape |
(Optional). Default |
facet |
(Optional). Default |
title |
(Optional). Default |
B |
(Optional). Default |
sample_names |
(Optional). Default |
data_only |
(Optional). Default |
... |
There are no optional parameters at this time. |
Object of class ggplot
. Plot of bbdml
model fit with 95
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) # Here we use B = 50 for quick demonstration purposes. # In practice, we recommend a higher value for B for more accurate intervals plot(mod, color = "DayAmdmt", B = 50)
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) # Here we use B = 50 for quick demonstration purposes. # In practice, we recommend a higher value for B for more accurate intervals plot(mod, color = "DayAmdmt", B = 50)
differentialTest plot function
## S3 method for class 'differentialTest' plot(x, level = NULL, data_only = FALSE, ...)
## S3 method for class 'differentialTest' plot(x, level = NULL, data_only = FALSE, ...)
x |
Object of class |
level |
(Optional). Character vector. Desired taxonomic levels for taxa labels. |
data_only |
(Optional). Default |
... |
No optional arguments are accepted at this time. |
Object of class ggplot
. Plot of coefficients from models for significant taxa from differentialTest
# phyloseq example data(soil_phylum_small_sample) data(soil_phylum_small_otu) da_analysis <- differentialTest(formula = ~ DayAmdmt, phi.formula = ~ DayAmdmt, formula_null = ~ 1, phi.formula_null = ~ DayAmdmt, test = "Wald", boot = FALSE, data = soil_phylum_small_otu, sample_data = soil_phylum_small_sample, fdr_cutoff = 0.05, try_only = 1:5) plot(da_analysis, level = "Phylum")
# phyloseq example data(soil_phylum_small_sample) data(soil_phylum_small_otu) da_analysis <- differentialTest(formula = ~ DayAmdmt, phi.formula = ~ DayAmdmt, formula_null = ~ 1, phi.formula_null = ~ DayAmdmt, test = "Wald", boot = FALSE, data = soil_phylum_small_otu, sample_data = soil_phylum_small_sample, fdr_cutoff = 0.05, try_only = 1:5) plot(da_analysis, level = "Phylum")
Print function
## S3 method for class 'bbdml' print( x, digits = max(3L, getOption("digits") - 3L), signif.stars = getOption("show.signif.stars"), ... )
## S3 method for class 'bbdml' print( x, digits = max(3L, getOption("digits") - 3L), signif.stars = getOption("show.signif.stars"), ... )
x |
Object of class |
digits |
the number of significant digits to use when printing. |
signif.stars |
logical. If |
... |
No optional arguments are accepted at this time. |
NULL
. Displays printed model summary.
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) print(mod)
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) print(mod)
differentialTest print function
## S3 method for class 'differentialTest' print(x, ...)
## S3 method for class 'differentialTest' print(x, ...)
x |
Object of class |
... |
No optional arguments are accepted at this time. |
NULL
. Displays printed differentialTest
summary.
# phyloseq example data(soil_phylum_small_sample) data(soil_phylum_small_otu) da_analysis <- differentialTest(formula = ~ DayAmdmt, phi.formula = ~ DayAmdmt, formula_null = ~ 1, phi.formula_null = ~ DayAmdmt, test = "Wald", boot = FALSE, data = soil_phylum_small_otu, sample_data = soil_phylum_small_sample, fdr_cutoff = 0.05, try_only = 1:5) print(da_analysis)
# phyloseq example data(soil_phylum_small_sample) data(soil_phylum_small_otu) da_analysis <- differentialTest(formula = ~ DayAmdmt, phi.formula = ~ DayAmdmt, formula_null = ~ 1, phi.formula_null = ~ DayAmdmt, test = "Wald", boot = FALSE, data = soil_phylum_small_otu, sample_data = soil_phylum_small_sample, fdr_cutoff = 0.05, try_only = 1:5) print(da_analysis)
Print summary function
## S3 method for class 'summary.bbdml' print( x, digits = max(3L, getOption("digits") - 3L), signif.stars = getOption("show.signif.stars"), ... )
## S3 method for class 'summary.bbdml' print( x, digits = max(3L, getOption("digits") - 3L), signif.stars = getOption("show.signif.stars"), ... )
x |
Object of class |
digits |
the number of significant digits to use when printing. |
signif.stars |
logical. If |
... |
No optional arguments are accepted at this time. |
NULL
. Displays printed model summary.
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) print(summary(mod))
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) print(summary(mod))
Get quantiles of beta binom
qbetabinom(p, M, mu, phi)
qbetabinom(p, M, mu, phi)
p |
Numeric. Probability for quantile |
M |
Numeric vector of sequencing depth |
mu |
Numeric vector of abundance parameter |
phi |
Numeric vector of dispersion parameter |
quantile
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) qbetabinom(.5, M = mod$M[1], mu = mod$mu.resp[1], phi = mod$phi.resp[1])
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) qbetabinom(.5, M = mod$M[1], mu = mod$mu.resp[1], phi = mod$phi.resp[1])
Rao-type chi-squared test (model-based or robust)
raotest(mod, mod_null)
raotest(mod, mod_null)
mod |
an object of class |
mod_null |
an object of class |
P-value from likelihood ratio test.
data(soil_phylum_small_otu1) mod1 <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) mod2 <- bbdml(formula = cbind(W, M - W) ~ 1, phi.formula = ~ 1, data = soil_phylum_small_otu1) raotest(mod1, mod2)
data(soil_phylum_small_otu1) mod1 <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) mod2 <- bbdml(formula = cbind(W, M - W) ~ 1, phi.formula = ~ 1, data = soil_phylum_small_otu1) raotest(mod1, mod2)
Compute sandwich estimate of variance-covariance matrix
sand_vcov(mod, numerical = FALSE)
sand_vcov(mod, numerical = FALSE)
mod |
an object of class |
numerical |
Boolean. Defaults to |
Sandwich variance-covariance matrix. .
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) sand_vcov(mod)
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) sand_vcov(mod)
Compute sandwich standard errors. Legacy function. Use sand_vcov instead.
sandSE(mod, numerical = FALSE)
sandSE(mod, numerical = FALSE)
mod |
an object of class |
numerical |
Boolean. Defaults to |
Sandwich variance-covariance matrix
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) sandSE(mod)
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) sandSE(mod)
Compute score at the MLE
score(mod, numerical = FALSE, get_score_covariance = FALSE)
score(mod, numerical = FALSE, get_score_covariance = FALSE)
mod |
an object of class |
numerical |
Boolean. Defaults to |
get_score_covariance |
Boolean. Defaults to |
Score at the MLE. For score function, returns
if get_score_covariance = FALSE.
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) score(mod)
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) score(mod)
Simulate from beta-binomial model
## S3 method for class 'bbdml' simulate(object, nsim, seed = NULL, ...)
## S3 method for class 'bbdml' simulate(object, nsim, seed = NULL, ...)
object |
an object of class |
nsim |
Integer. Number of simulations |
seed |
Optional integer to set a random seed |
... |
There are no additional parameters at this time. |
nsim
simulations from object
A data frame made from a soil 'phyloseq' object with only otu count data.
soil_phylo_otu
soil_phylo_otu
A phyloseq-class experiment-level object with an OTU table.
OTU table with 7,770 taxa and 119 samples
Whitman, T., Pepe-Ranney, C., Enders, A., Koechli, C., Campbell, A., Buckley, D. H., Lehmann, J. (2016). Dynamics of microbial community composi-tion and soil organic carbon mineralization in soil following addition of pyrogenic andfresh organic matter. The ISME journal, 10(12):2918. <doi: 10.1038/ismej.2016.68>.
A data frame made from a soil 'phyloseq' object with only sample data.
soil_phylo_sample
soil_phylo_sample
A phyloseq-class experiment-level object with sample data.
sample data with the following covariates:
Plants
, values 0
and 1
. Index for different plants
Day
, values 0
(initial sampling point), 1
(12 days after treatment additions), and 2
(82 days after treatment additions). Index for different days of measurement
Amdmt
, values 0
(no additions), 1
(biochar additions), and 2
(fresh biomass additions). Index for different soil additives.
DayAmdmt
, values 00
, 01
, 02
, 10
, 11
, 12
, 20
, 21
, and 22
. A single index for the combination of Day
and Amdmt
with Day
as the first digit and Amdmt
as the second digit.
ID
, values A
, B
, C
, D
, and F
. Index for different soil plots.
Whitman, T., Pepe-Ranney, C., Enders, A., Koechli, C., Campbell, A., Buckley, D. H., Lehmann, J. (2016). Dynamics of microbial community composi-tion and soil organic carbon mineralization in soil following addition of pyrogenic andfresh organic matter. The ISME journal, 10(12):2918. <doi: 10.1038/ismej.2016.68>.
A data frame made from a soil 'phyloseq' object with only taxonomy data.
soil_phylo_taxa
soil_phylo_taxa
A phyloseq-class experiment-level object with an OTU table.
taxonomy table
Whitman, T., Pepe-Ranney, C., Enders, A., Koechli, C., Campbell, A., Buckley, D. H., Lehmann, J. (2016). Dynamics of microbial community composi-tion and soil organic carbon mineralization in soil following addition of pyrogenic andfresh organic matter. The ISME journal, 10(12):2918. <doi: 10.1038/ismej.2016.68>.
A small subset of soil_phylo_otu
used for examples of testing contrasts. A data frame made from the 'phyloseq' object with only otu counts.
soil_phylum_contrasts_otu
soil_phylum_contrasts_otu
A phyloseq-class experiment-level object with an OTU table.
OTU table with 39 taxa and 56 samples
Whitman, T., Pepe-Ranney, C., Enders, A., Koechli, C., Campbell, A., Buckley, D. H., Lehmann, J. (2016). Dynamics of microbial community composi-tion and soil organic carbon mineralization in soil following addition of pyrogenic andfresh organic matter. The ISME journal, 10(12):2918. <doi: 10.1038/ismej.2016.68>.
A small subset of soil_phylo_sample
used for examples of testing contrasts. A data frame made from the 'phyloseq' object with only sample data.
soil_phylum_contrasts_sample
soil_phylum_contrasts_sample
A phyloseq-class experiment-level object with sample data.
sample data with the following covariates:
Plants
, values 0
and 1
. Index for different plants
Day
, values 0
(initial sampling point), 1
(12 days after treatment additions), and 2
(82 days after treatment additions). Index for different days of measurement
Amdmt
, values 0
(no additions), 1
(biochar additions), and 2
(fresh biomass additions). Index for different soil additives.
DayAmdmt
, values 00
, 01
, 02
, 10
, 11
, 12
, 20
, 21
, and 22
. A single index for the combination of Day
and Amdmt
with Day
as the first digit and Amdmt
as the second digit.
ID
, values A
, B
, C
, D
, and F
. Index for different soil plots.
Whitman, T., Pepe-Ranney, C., Enders, A., Koechli, C., Campbell, A., Buckley, D. H., Lehmann, J. (2016). Dynamics of microbial community composi-tion and soil organic carbon mineralization in soil following addition of pyrogenic andfresh organic matter. The ISME journal, 10(12):2918. <doi: 10.1038/ismej.2016.68>.
A small subset of soil_phylo_otu
used for examples. A data frame made from the 'phyloseq' object with only otu counts.
soil_phylum_small_otu
soil_phylum_small_otu
A phyloseq-class experiment-level object with an OTU table.
OTU table with 39 taxa and 32 samples
Whitman, T., Pepe-Ranney, C., Enders, A., Koechli, C., Campbell, A., Buckley, D. H., Lehmann, J. (2016). Dynamics of microbial community composi-tion and soil organic carbon mineralization in soil following addition of pyrogenic andfresh organic matter. The ISME journal, 10(12):2918. <doi: 10.1038/ismej.2016.68>.
A small subset of soil_phylo_sample
used for examples. A data frame made from the 'phyloseq' object with only sample data and counts for OTU 1.
soil_phylum_small_otu1
soil_phylum_small_otu1
A phyloseq-class experiment-level object with sample data and OTU 1 counts.
sample data with the following covariates:
Plants
, values 0
and 1
. Index for different plants
Day
, values 0
(initial sampling point), 1
(12 days after treatment additions), and 2
(82 days after treatment additions). Index for different days of measurement
Amdmt
, values 0
(no additions), 1
(biochar additions), and 2
(fresh biomass additions). Index for different soil additives.
DayAmdmt
, values 00
, 01
, 02
, 10
, 11
, 12
, 20
, 21
, and 22
. A single index for the combination of Day
and Amdmt
with Day
as the first digit and Amdmt
as the second digit.
ID
, values A
, B
, C
, D
, and F
. Index for different soil plots.
W
, counts for OTU1 in each sample. This OTU corresponds with the phylum Proteobacteria.
M
, the sequencing depth for each sample.
Whitman, T., Pepe-Ranney, C., Enders, A., Koechli, C., Campbell, A., Buckley, D. H., Lehmann, J. (2016). Dynamics of microbial community composi-tion and soil organic carbon mineralization in soil following addition of pyrogenic andfresh organic matter. The ISME journal, 10(12):2918. <doi: 10.1038/ismej.2016.68>.
A small subset of soil_phylo_sample
used for examples. A data frame made from the 'phyloseq' object with only sample data.
soil_phylum_small_sample
soil_phylum_small_sample
A phyloseq-class experiment-level object with sample data.
sample data with the following covariates:
Plants
, values 0
and 1
. Index for different plants
Day
, values 0
(initial sampling point), 1
(12 days after treatment additions), and 2
(82 days after treatment additions). Index for different days of measurement
Amdmt
, values 0
(no additions), 1
(biochar additions), and 2
(fresh biomass additions). Index for different soil additives.
DayAmdmt
, values 00
, 01
, 02
, 10
, 11
, 12
, 20
, 21
, and 22
. A single index for the combination of Day
and Amdmt
with Day
as the first digit and Amdmt
as the second digit.
ID
, values A
, B
, C
, D
, and F
. Index for different soil plots.
Whitman, T., Pepe-Ranney, C., Enders, A., Koechli, C., Campbell, A., Buckley, D. H., Lehmann, J. (2016). Dynamics of microbial community composi-tion and soil organic carbon mineralization in soil following addition of pyrogenic andfresh organic matter. The ISME journal, 10(12):2918. <doi: 10.1038/ismej.2016.68>.
Summary function
## S3 method for class 'bbdml' summary(object, ...)
## S3 method for class 'bbdml' summary(object, ...)
object |
Object of class |
... |
No optional arguments are accepted at this time. |
Object of class summary.bbdml
. Displays printed model summary.
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) summary(mod)
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) summary(mod)
Wald-type chi-squared test
waldchisq( mod, mod_null = NULL, restrictions = NULL, restrictions.phi = NULL, contrasts_DA = NULL, contrasts_DV = NULL, robust = FALSE )
waldchisq( mod, mod_null = NULL, restrictions = NULL, restrictions.phi = NULL, contrasts_DA = NULL, contrasts_DV = NULL, robust = FALSE )
mod |
an object of class |
mod_null |
Optional. An object of class |
restrictions |
Optional. Defaults to |
restrictions.phi |
Optional. Defaults to |
contrasts_DA |
List. Optional. Constructs a contrast matrix. List elements should be characters specifying contrasts in the parameters within |
contrasts_DV |
List. Optional. Constructs a contrast matrix. List elements should be characters specifying contrasts in the parameters within |
robust |
Should robust standard errors be used? If not, model-based standard arras are used. Logical, defaults to |
Matrix with wald test statistics and p-values. Only performs univariate tests.
P-value from Wald test.
data(soil_phylum_small_otu1) mod1 <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) mod2 <- bbdml(formula = cbind(W, M - W) ~ 1, phi.formula = ~ 1, data = soil_phylum_small_otu1) # Example using mod_null waldchisq(mod = mod1, mod_null = mod2) waldchisq(mod = mod1, mod_null = mod2, robust = TRUE) # Example using restrictions and restrictions.phi waldchisq(mod = mod1, restrictions = 2, restrictions.phi = 2) waldchisq(mod = mod1, restrictions = "DayAmdmt", restrictions.phi = "DayAmdmt") waldchisq(mod = mod1, restrictions = 2, restrictions.phi = "DayAmdmt") waldchisq(mod = mod1, restrictions = 2, restrictions.phi = 2, robust = TRUE)
data(soil_phylum_small_otu1) mod1 <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) mod2 <- bbdml(formula = cbind(W, M - W) ~ 1, phi.formula = ~ 1, data = soil_phylum_small_otu1) # Example using mod_null waldchisq(mod = mod1, mod_null = mod2) waldchisq(mod = mod1, mod_null = mod2, robust = TRUE) # Example using restrictions and restrictions.phi waldchisq(mod = mod1, restrictions = 2, restrictions.phi = 2) waldchisq(mod = mod1, restrictions = "DayAmdmt", restrictions.phi = "DayAmdmt") waldchisq(mod = mod1, restrictions = 2, restrictions.phi = "DayAmdmt") waldchisq(mod = mod1, restrictions = 2, restrictions.phi = 2, robust = TRUE)
This is a helper function and not intended for users
waldchisq_test( mod, restrictions = NULL, restrictions.phi = NULL, contrasts_DA = NULL, contrasts_DV = NULL, robust = FALSE )
waldchisq_test( mod, restrictions = NULL, restrictions.phi = NULL, contrasts_DA = NULL, contrasts_DV = NULL, robust = FALSE )
mod |
an object of class |
restrictions |
Optional. Defaults to |
restrictions.phi |
Optional. Defaults to |
contrasts_DA |
List. Optional. Constructs a contrast matrix. List elements should be characters specifying contrasts in the parameters within |
contrasts_DV |
List. Optional. Constructs a contrast matrix. List elements should be characters specifying contrasts in the parameters within |
robust |
Should robust standard errors be used? If not, model-based standard arras are used. Logical, defaults to |
Test statistic for Wald test.
Wald-type t test (model-based or robust)
waldt(mod)
waldt(mod)
mod |
an object of class |
Matrix with wald test statistics and p-values. Only performs univariate tests.
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) waldt(mod)
data(soil_phylum_small_otu1) mod <- bbdml(formula = cbind(W, M - W) ~ DayAmdmt, phi.formula = ~ DayAmdmt, data = soil_phylum_small_otu1) waldt(mod)
Function to throw error if the 'phyloseq' package is called but it is not installed
warn_phyloseq()
warn_phyloseq()