home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Educational / R-0.49-MI / R-0.49-I / help / base / qr < prev    next >
Encoding:
Text File  |  1997-04-23  |  3.0 KB  |  95 lines

  1.     
  2.     _T_h_e _Q_R _D_e_c_o_m_p_o_s_i_t_i_o_n _o_f _a _M_a_t_r_i_x
  3.     
  4.          qr(x, tol=1e-07)
  5.          qr.coef(qr, y)
  6.          qr.qy(qr, y)
  7.          qr.qty(qr, y)
  8.          qr.resid(qr, y)
  9.          qr.fitted(qr, y, k=qr$rank)
  10.          qr.solve(a, b, tol=1e-7)
  11.          is.qr(x)
  12.          as.qr(x)
  13.     
  14.     _A_r_g_u_m_e_n_t_s:
  15.     
  16.                x : a matrix whose QR decomposition is to be com-
  17.                    puted.
  18.     
  19.              tol : the tolerance for detecting linear dependen-
  20.                    cies in the columns of x.
  21.     
  22.               qr : a QR decomposition of the type computed by
  23.                    qr.
  24.     
  25.                y : a vector or matrix of right-hand sides of
  26.                    equations.
  27.     
  28.     _D_e_s_c_r_i_p_t_i_o_n:
  29.     
  30.          qr provides an interface to the techniques used in the
  31.          LINPACK routine DQRDC.  The QR decomposition plays an
  32.          important role in many statistical techniques.  In par-
  33.          ticular it can be used to solve the equation Ax EQUALS
  34.          b for given matrix A, and vector b.  It is useful for
  35.          computing regression coefficients and in applying the
  36.          Newton-Raphson algorithm.
  37.     
  38.          The functions qr.coef, qr.qy, qr.qty, qr.resid, and
  39.          qr.fitted use a computed QR decomposition to compute
  40.          various quantities of interest.
  41.     
  42.          qr.solve solves systems of equations via the QR decom-
  43.          position.
  44.     
  45.          is.qr returns TRUE if x is a list with a component
  46.          named qr and FALSE otherwise.
  47.     
  48.          It is not possible to coerce objects to mode qr.
  49.          Objects either are qr decompositions or they are not.
  50.          Coercion is not possible.
  51.     
  52.     _V_a_l_u_e_s:
  53.     
  54.          The QR decomposition of the matrix as computed by LIN-
  55.          PACK.  The components in the returned value correspond
  56.          directly to the values returned by DQRDC.
  57.     
  58.          qr : a matrix with the same dimensions as x.  The upper
  59.               triangle contains the R of the decomposition and
  60.               the lower triangle contains information on the Q
  61.               of the decomposition (stored in compact form).
  62.     
  63.       qraux : a vector of length ncol(x) which contains addi-
  64.               tional information on Q.
  65.     
  66.        rank : the rank of x as computed by the decomposition.
  67.     
  68.       pivot : information on the pivoting strategy used during
  69.               the decomposition.
  70.     
  71.     _R_e_f_e_r_e_n_c_e_s:
  72.     
  73.          Dongarra, J. J., J. R. Bunch, C. B. Moler and G. W.
  74.          Stewart (1978).  LINPACK Users Guide, SIAM Publica-
  75.          tions, Philadelphia.
  76.     
  77.     _S_e_e _A_l_s_o:
  78.     
  79.          solve.qr, lsfit.
  80.     
  81.     _E_x_a_m_p_l_e_s:
  82.     
  83.          hilbert <- function(n) { i <- 1:n; 1/outer(i-1,i,"+") }
  84.          h9 <- hilbert(9); h9
  85.          qr(h9)$rank           ##--> only 7
  86.          qrh9 <- qr(h9, tol=1e-10)
  87.          qrh9$rank             ##--> 9
  88.          ##-- Solve linear equation system  H %*% x = y :
  89.          y <- 1:9/10
  90.          x <- qr.solve(h9, y, tol = 1e-10) ## or equivalently :
  91.          x <- qr.coef(qrh9, y) ##-- is == but much better than
  92.                                ##-- solve(h9) %*% y
  93.          h9 %*% x              ## = y
  94.     
  95.