mbecVarianceStats: Wrapper for Model Variable Variance Extraction

Description Usage Arguments Details Value Examples

View source: R/mbecs_analyses.R

Description

For a Linear (Mixed) Model, this function extracts the proportion of variance that can be explained by terms and interactions and returns a named row-vector.

Usage

1
mbecVarianceStats(model.fit)

Arguments

model.fit

A linear (mixed) model object of class 'lm' or 'lmerMod'.

Details

Linear Model: Perform an analysis of variance (ANOVA) on the model.fit and return the Sum of squares for each term, scaled by the total sum of squares.

Linear Mixed Model: employ helper function 'mbecMixedVariance' to extract residuals, random effects and fixed effects components from the model. The components are then transformed to reflect explained proportions of variance for the model coefficients. The function implements transformation for varying coefficients as well, but NO ADJUSTMENT for single or multiple coefficients at this point.

Value

A named row-vector, containing proportional variance for model terms.

Examples

1
2
3
# This will return the data.frame for plotting.
limo <- stats::lm(dummy.list$cnts[,1] ~ group + batch, data=dummy.list$meta)
vec.variance <- mbecVarianceStats(model.fit=limo)

buschlab/MBECS documentation built on Jan. 21, 2022, 1:27 a.m.