weighted.residuals           package:stats           R Documentation

_C_o_m_p_u_t_e _W_e_i_g_h_t_e_d _R_e_s_i_d_u_a_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     Computed weighted residuals from a linear model fit.

_U_s_a_g_e:

     weighted.residuals(obj, drop0 = TRUE)

_A_r_g_u_m_e_n_t_s:

     obj: R object, typically of class 'lm' or 'glm'.

   drop0: logical.  If 'TRUE', drop all cases with 'weights == 0'.

_D_e_t_a_i_l_s:

     Weighted residuals are the usual residuals Ri, multiplied by
     wi^0.5, where wi are the 'weights' as specified in 'lm''s call.

     Dropping cases with weights zero is compatible with 'influence'
     and related functions.

_V_a_l_u_e:

     Numeric vector of length n', where n' is the number of of non-0
     weights ('drop0 = TRUE') or the number of observations, otherwise.

_S_e_e _A_l_s_o:

     'residuals', 'lm.influence', etc.

_E_x_a_m_p_l_e_s:

     example("lm")
     all.equal(weighted.residuals(lm.D9),
               residuals(lm.D9))
     x <- 1:10
     w <- 0:9
     y <- rnorm(x)
     weighted.residuals(lmxy <- lm(y ~ x, weights = w))
     weighted.residuals(lmxy, drop0 = FALSE)

