Description Usage Arguments Details Value Author(s) See Also Examples

`QR`

computes the QR decomposition of a matrix, *X*, that is an orthonormal matrix, *Q* and an upper triangular
matrix, *R*, such that *X = Q R*.

1 |

`X` |
a numeric matrix |

`tol` |
tolerance for detecting linear dependencies in the columns of |

The QR decomposition plays an important role in many statistical techniques.
In particular it can be used to solve the equation *Ax = b* for given matrix *A* and vector *b*.
The function is included here simply to show the algorithm of Gram-Schmidt orthogonalization. The standard
`qr`

function is faster and more accurate.

a list of three elements, consisting of an orthonormal matrix `Q`

, an upper triangular matrix `R`

, and the `rank`

of the matrix `X`

John Fox and Georges Monette

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
A <- matrix(c(1,2,3,4,5,6,7,8,10), 3, 3) # a square nonsingular matrix
res <- QR(A)
res
q <- res$Q
zapsmall( t(q) %*% q) # check that q' q = I
r <- res$R
q %*% r # check that q r = A
# relation to determinant: det(A) = prod(diag(R))
det(A)
prod(diag(r))
B <- matrix(1:9, 3, 3) # a singular matrix
QR(B)
``` |

matlib documentation built on April 4, 2018, 5:03 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.