
Last chance! 50% off unlimited learning
Sale ends in
This function performs a weighted M-estimation described by Carroll and Ruppert (1982) with the Huber loss function. First, a M-estimation is performed on the data assuming that the variance is constant. The residuals of this model are used to robustly estimate the variance parameter. Then, a weighted M-estimation with variance as weight is used to update the regression parameters. These steps are iterated until desired convergence.
whm(yy, xx, var.function = "power", tuning.para = 1.345, ite = 5)
Vector representing the response variable
Design matrix of the covariates including the intercept in the first column
Assumed function for the variance. "power
" function corresponds to exponential
" to
Value of the tuning parameter associated with the loss function.
Number of iterations for the estimation procedure.
The function returns a list including
Value of the robust estimate
Standard error of the robust estimate
Optimum tunning parameter
R-squared value
Carroll, R. J., & Ruppert, D. (1982). Robust estimation in heteroscedastic linear models. The annals of statistics, 429-441.
rlm
function from package MASS
# NOT RUN {
library(MASS)
data(stackloss)
LS <- lm(stack.loss ~ stack.x)
RB <- rlm(stack.loss ~ stack.x, psi = psi.huber, k = 1.345)
yy <- stack.loss
xx <- model.matrix(stack.loss ~ stack.x)
#With power function as variance function
WHM_p <- whm(yy, xx, var.function = "power", tuning.para = 1.345)
#With exponential function as variance function
WHM_e <- whm(yy, xx, var.function = "exponential", tuning.para = 1.345)
# }
Run the code above in your browser using DataLab