huber.reg: Huber estimation for linear regression

Description Usage Arguments Value Examples

View source: R/Huber.R

Description

This function produces Huber estimates for linear regression. Initial estimates is required. Currently, the function does not support automatic selection of huber tuning parameter.

Usage

1
huber.reg(y, X, beta.ini, alpha, intercept = FALSE)

Arguments

y

the response vector

X

design matrix

beta.ini

initial value of estimates, could be from OLS.

alpha

1/alpha is the huber tuning parameter delta. Larger alpha results in smaller portion of squared loss.

intercept

logical input that indicates if intercept needs to be estimated. Default is FALSE.

Value

beta

the regression coefficient estimates

fitted.value

predicted response

iter.steps

iteration steps.

Examples

1
2
3
4
5
6
7
8
set.seed(2017)
n=200; d=4
X=matrix(rnorm(n*d), nrow=n, ncol=d)
beta=c(1, -1, 2, -2)
y=-2+X%*%beta+c(rnorm(150), rnorm(30,10,10), rnorm(20,0,100))
beta0=beta.ls=lm(y~X)$coeff
beta.huber=huber.reg(y, X, beta0, 2, intercept=TRUE)$beta
cbind(c(-2,beta), beta.ls, beta.huber)

Example output

                  beta.ls beta.huber
(Intercept) -2 -0.8741926 -1.9042539
X1           1  1.8677738  0.9971322
X2          -1 -2.2162448 -1.0369297
X3           2 -0.7561486  1.9713509
X4          -2  1.2874911 -1.9702923

MTE documentation built on May 2, 2019, 5:57 a.m.

Related to huber.reg in MTE...