kappa                  package:base                  R Documentation

_E_s_t_i_m_a_t_e _t_h_e _C_o_n_d_i_t_i_o_n _N_u_m_b_e_r

_D_e_s_c_r_i_p_t_i_o_n:

     An estimate of the condition number of a matrix or of the R matrix
     of a QR decomposition, perhaps of a linear fit.  The condition
     number is defined as the ratio of the largest to the smallest
     non-zero singular value of the matrix.

_U_s_a_g_e:

     kappa(z, ...)
     kappa.lm     (z, ...)
     kappa.default(z, exact = FALSE)
     kappa.qr     (z, ...) 
     kappa.tri    (z, exact = FALSE, ...)

_A_r_g_u_m_e_n_t_s:

       z: A matrix or a the result of `qr' or a fit from a class
          inheriting from `"lm"'.

   exact: Should the result be exact?

_D_e_t_a_i_l_s:

     If `exact = FALSE' (the default) the condition number is estimated
     by a cheap approximation. Following S, this uses the LINPACK
     routine `dtrco.f'.  However, in R (or S) the exact calculation is
     also likely to be quick enough.

_V_a_l_u_e:

     The condition number, kappa, or an approximation if `exact=FALSE'.

_A_u_t_h_o_r(_s):

     B.D. Ripley

_S_e_e _A_l_s_o:

     `svd' for the singular value decomposition and `qr' for the QR
     one.

_E_x_a_m_p_l_e_s:

     kappa(x1 <- cbind(1,1:10))# 15.71
     kappa(x1, exact=T)        # 13.68
     kappa(x2 <- cbind(x1,2:11))# high! [x2 is singular!]

     hilbert <- function(n) { i <- 1:n; 1 / outer(i - 1, i, "+") }
     sv9 <- svd(h9 <- hilbert(9))$ d
     kappa(h9)# pretty high!
     kappa(h9, exact=TRUE) == max(sv9) / min(sv9)
     kappa(h9, exact=TRUE) / kappa(h9) # .677 (i.e. rel.error = 32%)

