lm.fit                 package:base                 R Documentation

_F_i_t_t_e_r _F_u_n_c_t_i_o_n_s _f_o_r _L_i_n_e_a_r _M_o_d_e_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     These are the basic computing engines called by `lm' used to fit
     linear models.  These should usually not be used directly unless
     by experienced users.

_U_s_a_g_e:

     lm.fit (x, y,    offset = NULL, method = "qr", tol = 1e-7, ...)
     lm.wfit(x, y, w, offset = NULL, method = "qr", tol = 1e-7, ...)
     lm.fit.null (x, y,    method = "qr", tol = 1e-7, ...)
     lm.wfit.null(x, y, w, method = "qr", tol = 1e-7, ...)

_A_r_g_u_m_e_n_t_s:

       x: design matrix of dimension `n * p'.

       y: vector of observations of length `n'.

       w: vector of weights (length `n') to be used in the fitting
          process for the `wfit' functions.  Weighted least squares is
          used with weights `w', i.e., `sum(w * e^2)' is minimized.

  offset: numeric of length `n').  This can be used to specify an a
          priori known component to be included in the linear predictor
          during fitting.

  method: currently, only `method="qr"' is supported.

     tol: tolerance for the `qr' decomposition.  Default is 1e-7.

     ...: currently disregarded.

_D_e_t_a_i_l_s:

     The functions `lm.{w}fit.null' are called by `lm.fit' or `lm.wfit'
     respectively, when `x' has zero columns.

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

     a list with components 

coefficients: `p' vector

residuals: `n' vector

fitted.values: `n' vector

 effects: `n' vector; ......

 weights: `n' vector - only for the `*wfit*' functions.

    rank: integer, giving the rank

df.residual: degrees of freedom of residuals

      qr: the QR decomposition, see `qr'.

_S_e_e _A_l_s_o:

     `lm' which you should use for linear least squares regression,
     unless you know better.

_E_x_a_m_p_l_e_s:

     set.seed(129)
     n <- 7 ; p <- 2
     X <- matrix(rnorm(n * p), n,p) # no intercept!
     y <- rnorm(n)
     w <- rnorm(n)^2

     str(lmw <- lm.wfit(x=X, y=y, w=w))

     str(lm. <- lm.fit (x=X, y=y))

     str(lm0 <-  lm.fit.null (x=X, y=y))
     str(lmw0 <- lm.wfit.null(x=X, y=y,w=w))

