lsfit                 package:stats                 R Documentation

_F_i_n_d _t_h_e _L_e_a_s_t _S_q_u_a_r_e_s _F_i_t

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

     The least squares estimate of *b* in the model

                             y = X b + e

     is found.

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

     lsfit(x, y, wt = NULL, intercept = TRUE, tolerance = 1e-07, yname = NULL)

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

       x: a matrix whose rows correspond to cases and whose columns
          correspond to variables.

       y: the responses, possibly a matrix if you want to fit multiple
          left hand sides.

      wt: an optional vector of weights for performing weighted least
          squares.

intercept: whether or not an intercept term should be used.

tolerance: the tolerance to be used in the matrix decomposition.

   yname: names to be used for the response variables.

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

     If weights are specified then a weighted least squares is
     performed with the weight given to the _j_th case specified by the
     _j_th entry in 'wt'.

     If any observation has a missing value in any field, that
     observation is removed before the analysis is carried out. This
     can be quite inefficient if there is a lot of missing data.

     The implementation is via a modification of the LINPACK
     subroutines which allow for multiple left-hand sides.

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

     A list with the following named components: 

    coef: the least squares estimates of the coefficients in the model
          (*b* as stated above).

residuals: residuals from the fit.

intercept: indicates whether an intercept was fitted.

      qr: the QR decomposition of the design matrix.

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

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

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

     'lm' which usually is preferable; 'ls.print', 'ls.diag'.

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

     ##-- Using the same data as the lm(.) example:
     lsD9 <- lsfit(x = unclass(gl(2,10)), y = weight)
     ls.print(lsD9)

