mroot package:mgcv R Documentation _S_m_a_l_l_e_s_t _s_q_u_a_r_e _r_o_o_t _o_f _m_a_t_r_i_x _D_e_s_c_r_i_p_t_i_o_n: Find a square root of a positive semi-definite matrix, having as few columns as possible. Uses either pivoted choleski decomposition or singular value decomposition to do this. _U_s_a_g_e: mroot(A,rank=NULL,method="chol") _A_r_g_u_m_e_n_t_s: A: The positive semi-definite matrix, a square root of which is to be found. rank: if the rank of the matrix 'A' is known then it should be supplied. method: '"chol"' to use pivoted choloeski decompositon, which is fast but tends to over-estimate rank. '"svd"' to use singular value decomposition, which is slow, but is the most accurate way to estimate rank. _D_e_t_a_i_l_s: The routine uses an LAPACK SVD routine, or the LINPACK pivoted Choleski routine. It is primarily of use for turning penalized regression problems into ordinary regression problems. _V_a_l_u_e: A matrix, B with as many columns as the rank of A, and such that A=BB'. _A_u_t_h_o_r(_s): Simon N. Wood simon.wood@r-project.org _E_x_a_m_p_l_e_s: set.seed(0) a <- matrix(runif(24),6,4) A <- a%*%t(a) ## A is +ve semi-definite, rank 4 B <- mroot(A) ## default pivoted choleski method tol <- 100*.Machine$double.eps chol.err <- max(abs(A-B%*%t(B)));chol.err if (chol.err>tol) warning("mroot (chol) suspect") B <- mroot(A,method="svd") ## svd method svd.err <- max(abs(A-B%*%t(B)));svd.err if (svd.err>tol) warning("mroot (svd) suspect")