This function calculates deepest regression estimator for simple regression.

deepReg2d(x, y)

Arguments

x

Independent variable.

y

Dependent variable.

Details

Function originates from an original algorithm proposed by Rousseeuw and Hubert. Let Zn=(x1,y1),...,(xn,yn)Rd denotes a sample considered from a following semiparametric model: yl=a0+a1x1l+...+a(d1)lx(d1)l+εl,l=1,...,n, we calculate a depth of a fit α=(a0,...,ad1) as RD(α,Zn)=u0minl:rl(α)uTxl<0,l=1,...,n, where r() denotes the regression residual, α=(a0,...,ad1), uTxl0. The deepest regression estimator DR(α,Zn) is defined as DR(α,Zn)=α0argmaxRD(α,Zn)

References

Rousseeuw J.P., Hubert M. (1998), Regression Depth, Journal of The American Statistical Association, vol.94.

Examples

# EXAMPLE 1 data(pension) plot(pension)
abline( lm(Reserves ~ Income, data = pension), lty = 3, lwd = 2) # lm
abline( deepReg2d(pension[, 1], pension[, 2]), lwd = 2) # deepreg2d
# EXAMPLE 2 data(under5.mort) data(inf.mort) data(maesles.imm) data2011 <- na.omit( cbind(under5.mort[, 22], inf.mort[, 22], maesles.imm[, 22])) x <- data2011[, 3] y <- data2011[, 2] plot( x, y, cex = 1.2, ylab = "infant mortality rate per 1000 live birth", xlab = "against masles immunized percentage", main = "Projection Depth Trimmed vs. LS regressions" )
abline(lm(x ~ y), lwd = 2, col = "black") # lm
abline( deepReg2d (x, y), lwd = 2, col = "red" ) # trimmed reg
legend( "bottomleft", c("LS", "DeepReg"), fill = c("black", "red"), cex = 1.4, bty = "n" )