This function calculates deepest regression estimator for simple regression.
Usage
deepReg2d(x, y)
Arguments
x
Independent variable.
y
Dependent variable.
Details
Function originates from an original algorithm proposed by Rousseeuw and Hubert. Let {Z}^{n}={ (x_1,y_1),...,(x_n,y_n)} {subset {R}^{d} } denotes a sample considered from a following semiparametric model: {{y}_{l}}={{a}_{0}}+{{a}_{1}}{{x}_{1l}}+...+{{a}_{(d-1)l}}{{x}_{(d-1)l}}+{{varepsilon }_{l}}, l=1,...,n, we calculate a depth of a fit α=(a_{0},...,a_{d-1}) as RD(α ,{{Z}^{n}})={u\ne 0}{{min }},sharp{l: frac{{{r}_{l}}(α )}{{{u}^{T}}{{x}_{l}}}<0,l=1,...,n}, where r(cdot ) denotes the regression residual, α=(a_{0},...,a_{d-1}) , {u}^{T}{x}_{l}\ne 0 . The deepest regression estimator DR(α,{{Z}^{n}}) is defined as
DR(α ,{{Z}^{n}})={α \ne 0}{{arg max }},RD(α ,{{Z}^{n}})
Author(s)
Daniel Kosiorowski, Mateusz Bocian, Anna Wegrzynkiewicz and Zygmunt Zawadzki from Cracow University of Economics.
References
Rousseeuw J.P., Hubert M. (1998), Regression Depth, Journal of The American Statistical Association, vol.94.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(DepthProc)
Loading required package: ggplot2
Loading required package: Rcpp
Loading required package: rrcov
Loading required package: robustbase
Scalable Robust Estimators with High Breakdown Point (version 1.3-11)
Loading required package: MASS
Loading required package: np
Nonparametric Kernel Methods for Mixed Datatypes (version 0.60-2)
[vignette("np_faq",package="np") provides answers to frequently asked questions]
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DepthProc/deepReg2d.Rd_%03d_medium.png", width=480, height=480)
> ### Name: deepReg2d
> ### Title: Simple deepest regression method.
> ### Aliases: deepReg2d
>
> ### ** Examples
>
> 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,data = pension), 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")
>
>
>
>
>
> dev.off()
null device
1
>