Description Usage Arguments Details Value Author(s) Examples
Find a square root of a positive semidefinite matrix, having as few columns as possible. Uses either pivoted choleski decomposition or singular value decomposition to do this.
1 
A 
The positive semidefinite matrix, a square root of which is to be found. 
rank 
if the rank of the matrix 
method 

The function uses SVD, or a pivoted Choleski routine. It is primarily of use for turning penalized regression problems into ordinary regression problems.
A matrix, B with as many columns as the rank of A, and such that A=BB'.
Simon N. Wood simon.wood@rproject.org
1 2 3 4 5 6 7 8 9 10 11  require(mgcv)
set.seed(0)
a < matrix(runif(24),6,4)
A < a%*%t(a) ## A is +ve semidefinite, rank 4
B < mroot(A) ## default pivoted choleski method
tol < 100*.Machine$double.eps
chol.err < max(abs(AB%*%t(B)));chol.err
if (chol.err>tol) warning("mroot (chol) suspect")
B < mroot(A,method="svd") ## svd method
svd.err < max(abs(AB%*%t(B)));svd.err
if (svd.err>tol) warning("mroot (svd) suspect")

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.