Learn R Programming

rchemo (version 0.1-3)

pinv: Moore-Penrose pseudo-inverse of a matrix

Description

Calculation of the Moore-Penrose (MP) pseudo-inverse of a matrix \(X\).

Usage

pinv(X, tol = sqrt(.Machine$double.eps))

Value

Xplus

The MP pseudo-inverse.

sv

singular values.

Arguments

X

X-data (\(n, p\)).

tol

A relative tolerance to detect zero singular values.

Examples

Run this code

n <- 7 ; p <- 4
X <- matrix(rnorm(n * p), ncol = p)
y <- rnorm(n)

pinv(X)

tcrossprod(pinv(X)$Xplus, t(y))
lm(y ~ X - 1)

Run the code above in your browser using DataLab