This help topic is for R version 0.90. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/weighted.residuals.html
weighted.residuals {base}R Documentation

Computed Weighted Residuals

Description

Weighted residuals are the usual residuals R_i, multiplied by \sqrt{w_i}, where w_i are the weights as specified in lm's call.

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

Usage

weighted.residuals(obj, drop0 = TRUE)

Arguments

obj

R object, typically of class lm or glm.

drop0

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

Value

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

See Also

residuals,lm.influence, etc.

Examples

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)

[Package base version 0.90 ]