Skip to contents

This function checks whether a model matrix is full rank, which is essential for certain statistical analyses. It computes the eigenvalues of the crossproduct of the model matrix and determines if the first eigenvalue is positive and if the ratio of the last eigenvalue to the first is within a defined tolerance.

Usage

is_fullrank(metadata, formula)

Arguments

metadata

The metadata used to create the model matrix.

formula

The formula used to specify the model matrix.

Value

TRUE if the model matrix is full rank, FALSE otherwise.

Details

This function is inspired by a similar function found in the Limma package.

Examples

metadata <- data.frame(x = rnorm(10), y = rnorm(10))
formula <- y ~ x
is_fullrank(metadata, formula)
#> [1] TRUE