Skip to contents

Holland and Welsch's scheme alternates a weighted least-squares solve with a recomputation of the weights from scaled residuals. This function performs exactly one solve for a supplied weight vector and also returns the Huber weights the next iteration would use, so a caller can iterate.

Usage

Irlsfn(y, X, weights)

Arguments

y

Response vector.

X

Covariate block; an intercept column is prepended. May be NULL for an intercept-only fit.

weights

Non-negative case weights; ones give plain OLS.

Value

List with estimate, coef, se, se_coef, sigma2, wrss, next_weights, scale, p, n, method.

Details

Formula: beta = (X' W X)^-1 X' W y.

References

Holland and Welsch (1977), Robust regression using iteratively reweighted least-squares, Communications in Statistics – Theory and Methods 6(9):813-827. doi:10.1080/03610927708827533

Examples

Irlsfn(y = c(1, 2, 3, 4, 5, 6, 7, 8), X = c(1, 2, 3, 4, 5, 6, 7, 8),
  weights = c(1, 2, 3, 4, 5, 6, 7, 8))
#> $estimate
#> [1] 1
#> 
#> $coef
#> [1] 0 1
#> 
#> $se
#> [1] 0
#> 
#> $se_coef
#> [1] 0 0
#> 
#> $sigma2
#> [1] 0
#> 
#> $wrss
#> [1] 0
#> 
#> $next_weights
#> [1] 1 1 1 1 1 1 1 1
#> 
#> $scale
#> [1] 1
#> 
#> $p
#> [1] 2
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "beta = (X' W X)^-1 X' W y, Holland & Welsch (1977)"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"