weighted.residuals

0th

Percentile

Compute Weighted Residuals

Computed weighted residuals from a linear model fit.

Keywords
regression
Usage
weighted.residuals(obj, drop0 = TRUE)
Arguments
obj
Robject, typically of class lm or glm.
drop0
logical. If TRUE, drop all cases with weights == 0.
Details

Weighted residuals are based on the deviance residuals, which for a lm fit are the raw 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 influence and related functions.

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.

Aliases
  • weighted.residuals
Examples
library(stats) ## following on from example(lm) utils::example("lm", echo = FALSE) 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)
Documentation reproduced from package stats, version 3.3, License: Part of R 3.3

Community examples

Looks like there are no examples yet.