ginv2 {hypr}R Documentation

Enhanced generalized inverse function

Description

This function is a wrapper for MASS::ginv and calculates the generalized inverse of x.

Usage

ginv2(x, as_fractions = TRUE)

Arguments

x

The original matrix

as_fractions

Whether to format the matrix as fractions (MASS package)

Details

In addition to MASS::ginv, this function rounds values, formats the matrix as fractions and copies dimension names from the original matrix.

Value

Generalized inverse of x

See Also

ginv

Examples


h <- hypr(mu1~0, mu2~mu1)
hmat(h)

ginv2(hmat(h))
cmat(h)

# cmat is effectively the generalized inverse of hmat
stopifnot(all.equal(
`class<-`(ginv2(hmat(h)), "matrix"),
`class<-`(cmat(h), "matrix"), check.attributes = FALSE))


[Package hypr version 0.2.8 Index]