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, ...)
     ## S3 method for class 'lm':
     kappa(z, ...)
     ## Default S3 method:
     kappa(z, exact = FALSE, ...)
     ## S3 method for class 'qr':
     kappa(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: logical. Should the result be exact?

     ...: further arguments passed to or from other methods.

_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.

     'kappa.tri' is an internal function called by 'kappa.qr'.

_V_a_l_u_e:

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

_A_u_t_h_o_r(_s):

     The design was inspired by (but differs considerably from) the S
     function of the same name described in Chambers (1992).

_R_e_f_e_r_e_n_c_e_s:

     Chambers, J. M. (1992) _Linear models._ Chapter 4 of _Statistical
     Models in S_ eds J. M. Chambers and T. J. Hastie, Wadsworth &
     Brooks/Cole.

_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 = TRUE)        # 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%)

