ridge_fit: Solve OTU equation systems by ridge regularization

View source: R/ridge_fit.R

ridge_fitR Documentation

Solve OTU equation systems by ridge regularization

Description

When determining the Lotka-Volterra coefficients of an OTU system, this function solves the linear equations using ridge regularization (l^2).

Usage

ridge_fit(equations, weights)

Arguments

equations

Equations returned from integralSystem

weights

Named numeric, a vector with two entries. The first one is named 'self' and represents the magnitude of penalizing the maximal growth rate of an OTU. The second is named 'interaction' and represents the magnitude of penalizing the interactions between the OTUs. Ideally, the weights should be found by cross-validation

Details

The equations are fitted individually, this is: For each OTU, all coefficients determining it abundance is fitted independently from the other coeffcients. The entity

\| Aβ-b \|^2+λ_{\mathrm{self}}β_{\mathrm{self}}^2+ λ_{\mathrm{interaction}}\|β_{\mathrm{interaction}}\|^2

will be minimized where β is the estimated solution, β_{\mathrm{self}} is the estimated maximal growth rate of the OTU and β_{\mathrm{inteaction}} are the estimated effect of the interactions with the other OTUs (and itself).

Value

An n_OTU times (n_OTU+1) numeric matrix where each row contains the coefficients determining the growth of the selected OTU. The first column contains the estimated growth rates, while the other rows contain the estimates for the interaction coefficients. This object has the S3 class attribute LV.

References

Richard R. Stein et al. “Ecological Modeling from Time-Series Inference: Insight into Dy- namics and Stability of Intestinal Microbiota.” In: PLoS Comput. Biol. 9.12 (desember 2013). issn: 1553-7358. DOI: https://doi.org/10.1371/journal.pcbi.1003388.

See Also

integralSystem

Examples

library(micInt)
library(phyloseq)
data("seawater")
subsetted_seawater <- subset_samples(seawater, Reactor == 2)
systems <- integralSystem(OTU_time_series(subsetted_seawater,"Week"), kind = "log_integral")
fit <- ridge_fit(systems,weights = c(self = 10,interaction = 1))

AlmaasLab/micInt documentation built on April 1, 2022, 10:37 a.m.