Learn R Programming

netmeta (version 3.2-0)

invmat: Moore-Penrose Pseudoinverse of a Matrix

Description

Calculates the Moore-Penrose pseudoinverse of a square matrix X.

Usage

invmat(X)

Value

The Moore-Penrose pseudoinverse for matrix X.

Arguments

X

A square matrix.

Details

This function is used by default in R package netmeta to calculate the Moore-Penrose pseudoinverse L\(^+\) of the Laplacian matrix L (Rücker, 2012):

L\(^+\) = (X - J / n)\(^{-1}\) + J / n with identity matrix J of dimension nxn.

References

Rücker G (2012): Network meta-analysis, electrical networks and graph theory. Research Synthesis Methods, 3, 312--24

See Also

netmeta, solve

Examples

Run this code
# \donttest{
data(smokingcessation)

pw1 <- pairwise(list(treat1, treat2, treat3),
  event = list(event1, event2, event3), n = list(n1, n2, n3),
  data = smokingcessation, sm = "OR")
net1 <- netmeta(pw1)

L1 <- net1$L.matrix.common
L2 <- invmat(net1$Lplus.matrix.common)
all.equal(round(L1, 10), round(L2, 10))
# }

Run the code above in your browser using DataLab