bbdml: Maximum Likelihood for the Beta-binomial Distribution

View source: R/bbdml.R

bbdmlR Documentation

Maximum Likelihood for the Beta-binomial Distribution

Description

Maximum Likelihood for the Beta-binomial Distribution

Usage

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,
  ...
)

Arguments

formula

an object of class formula: a symbolic description of the model to be fitted to the abundance

phi.formula

an object of class formula without the response: a symbolic description of the model to be fitted to the dispersion

data

a data frame or phyloseq object containing the variables in the models

link

link function for abundance covariates, defaults to "logit"

phi.link

link function for dispersion covariates, defaults to "logit"

method

optimization method, defaults to "trust", or see optimr for other options

control

optimization control parameters (see optimr)

numerical

Boolean. Defaults to FALSE. Indicator of whether to use the numeric Hessian (not recommended).

nstart

Integer. Defaults to 1. Number of starts for optimization.

inits

Optional initializations as rows of a matrix. Defaults to NULL.

allow_noninteger

Boolean. Defaults to FALSE. Should noninteger W's and M's be allowed? This behavior was not permitted prior to v4.1, needs to be explicitly allowed.

robust

Should robust standard errors be returned? If not, model-based standard arras are used. Logical, defaults to FALSE.

...

Optional additional arguments for optimr or trust

Value

An object of class bbdml.

Examples

# 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)


corncob documentation built on May 29, 2024, 7:15 a.m.