xTAx {statnet.common} | R Documentation |
Common quadratic forms
Description
Common quadratic forms
Usage
xTAx(x, A)
xAxT(x, A)
xTAx_solve(x, A, ...)
xTAx_qrsolve(x, A, tol = 1e-07, ...)
sandwich_solve(A, B, ...)
xTAx_eigen(x, A, tol = sqrt(.Machine$double.eps), ...)
sandwich_sginv(A, B, ...)
sandwich_ginv(A, B, ...)
Arguments
x |
a vector |
A |
a square matrix |
... |
additional arguments to subroutines |
tol |
tolerance argument passed to the relevant subroutine |
B |
a square matrix |
Details
These are somewhat inspired by emulator::quad.form.inv() and others.
Functions
-
xTAx()
: Evaluatex'Ax
for vectorx
and square matrixA
. -
xAxT()
: EvaluatexAx'
for vectorx
and square matrixA
. -
xTAx_solve()
: Evaluatex'A^{-1}x
for vectorx
and invertible matrixA
usingsolve()
. -
xTAx_qrsolve()
: Evaluatex'A^{-1}x
for vectorx
and matrixA
using QR decomposition and confirming thatx
is in the span ofA
ifA
is singular; returnsrank
andnullity
as attributes just in case subsequent calculations (e.g., hypothesis test degrees of freedom) are affected. -
sandwich_solve()
: EvaluateA^{-1}B(A')^{-1}
forB
a square matrix andA
invertible. -
xTAx_eigen()
: Evaluatex' A^{-1} x
for vectorx
and matrixA
(symmetric, nonnegative-definite) via eigendecomposition and confirming thatx
is in the span ofA
ifA
is singular; returnsrank
andnullity
as attributes just in case subsequent calculations (e.g., hypothesis test degrees of freedom) are affected.Decompose
A = P L P'
forL
diagonal matrix of eigenvalues andP
orthogonal. ThenA^{-1} = P L^{-1} P'
.Substituting,
x' A^{-1} x = x' P L^{-1} P' x = h' L^{-1} h
for
h = P' x
.