invmat: Moore-Penrose Pseudoinverse of a Matrix

View source: R/invmat.R

invmatR Documentation

Moore-Penrose Pseudoinverse of a Matrix

Description

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

Usage

invmat(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.

Value

The Moore-Penrose pseudoinverse for matrix X.

Author(s)

Gerta Rücker gerta.ruecker@uniklinik-freiburg.de, Guido Schwarzer guido.schwarzer@uniklinik-freiburg.de

References

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

See Also

netmeta, solve

Examples

data(smokingcessation)

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

invmat(net1$L.matrix.common)

## Not run: 
data(Senn2013)

net2 <- netmeta(TE, seTE, treat1.long, treat2.long, studlab,
  data = Senn2013)
L1 <- net2$L.matrix.common
L2 <- invmat(net2$Lplus.matrix.common)
all.equal(round(L1, 10), round(L2, 10))

## End(Not run)


guido-s/netmeta documentation built on April 8, 2024, 5:31 a.m.