hubreg: hubreg

View source: R/regression_hubreg.R

hubregR Documentation

hubreg

Description

regression and scale using Huber's criterion

Usage

hubreg(y, X, c = NULL, sig0 = NULL, b0 = NULL, printitn = 0,
  iter_max = 2000, errortol = 1e-05)

Arguments

y:

Numeric data vector of size N x 1 (output, respones)

X:

Numeric data matrix of size N x p. Each row represents one observation, and each column represents one predictor (feature). If the model has an intercept, then first column needs to be a vector of ones.

c:

numeric threshold constant of Huber's function

sig0:

(numeric) initial estimator of scale
default = SQRT(1/(n-p)*RSS)

b0:

initial estimator of regression (default: LSE)

printitn:

print iteration number (default = 0, no printing)

iter_max:

maximum number of iterations.
default = 2000

errortol:

ERROR TOLERANCE FOR HALTING CRITERION.
default = 1e-5

Details

hubreg computes the joint M-estimates of regression and scale using Huber's criterion. Function works for both real- and complex-valued data.

Value

b1: the regression coefficient vector estimate

sig1: the estimate of scale

iter: the # of iterations

References

uses ginv from the MASS package

Examples


library(MASS)
y <- c(1.0347, 0.7269, -0.3034, 0.2939, -0.7873)
X <- matrix(c(0.884, -1.1471, -1.0689, -0.8095, -2.9443, 1.4384, 0.3252, -0.7549, 1.3703, -1.7115), 5, 2)

hubreg(y, X)
hubreg(y+1i, X)
hubreg(y+1i, X+1i)
hubreg(y, X+1i)


Mufabo/Rrobustsp documentation built on June 11, 2022, 10:41 p.m.