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")  

