Description Usage Arguments Details Value
We compute the quadratic form of a vector and the inverse of a matrix in an
efficient manner. Let x
be a real vector of length p
, and let
A
be a p x p nonsingular matrix. Then, we compute the quadratic form
q = x' A^{-1} x.
1 | quadform_inv(A, x)
|
A |
matrix that is p x p and nonsingular |
x |
vector of length p |
A naive way to compute the quadratic form is to explicitly write
t(x) \%*\% solve(A) \%*\% x
, but for large p
, this operation is
inefficient. We provide a more efficient method below.
Note that we have adapted the code from: https://stat.ethz.ch/pipermail/r-help/2005-November/081940.html
scalar value
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.