For quantile regression you can again just use summary(rq(...)).
url: www.econ.uiuc.edu/~roger Roger Koenker
email rkoenker at uiuc.edu Department of Economics
vox: 217-333-4558 University of Illinois
fax: 217-244-6678 Urbana, IL 61801
On May 8, 2013, at 10:51 AM, Anton Kochepasov wrote:
Hi everyone,
A few years ago there was a discussion about a robust regression
I'm trying to compare a few regression models for my data. For
linear regression everything is quite understandable, but robust
and quantile regressions are not so obvious. I could not find
almost anything about calculating confidence interval for these
regression models unless I looked for something wrong.
My code in R looks as follows:
# Robust linear modeling
library(MASS)
library(robustbase)
library(robust)
set.seed(343);
x <- rnorm(1000)
y <- x + 2*rnorm(1000)
lm1<-lm(y~x); rlm1<-rlm(y~x); rlm2 <- lmRob(y~x); rlm3 <- lmrob(y~x)
cbind(summary(lm1)$coeff, confint(lm1))
cbind(summary(rlm1)$coeff, confint(rlm1))
cbind(summary(rlm2)$coeff, confint(rlm2))
cbind(summary(rlm3)$coeff, confint(rlm3))
And produces the following result:
cbind(summary(lm1)$coeff, confint(lm1))
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.06973191 0.06408983 -1.088034 2.768429e-01 -
x 0.97647196 0.06619635 14.751145 1.071805e-44
cbind(summary(rlm1)$coeff, confint(rlm1))
Value Std. Error t value 2.5 % 97.5 %
(Intercept) -0.06131788 0.06714405 -0.9132288 NA NA
x 0.96016596 0.06935096 13.8450275 NA NA
cbind(summary(rlm2)$coeff, confint(rlm2))
Error in UseMethod("vcov") :
no applicable method for 'vcov' applied to an object of class
"lmRob">> cbind(summary(rlm3)$coeff, confint(rlm3))
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.0568964 0.06608987 -0.8608945 3.895029e-01 -
x 0.9612520 0.06821558 14.0913850 2.921913e-41
It's easy to spot that linear model works OK and only one robust
regression gives a sensible result. Another observation is that
lmrob(), which produces some actual confidence interval, calculates
it in the same manner as lm(), with using 1.96 as the student
coefficient.>
Could you share your opinion if it is a correct way to produce a
confidence interval for the robust regression model (same as for
the linear regression)? May the same method be used for the
quantile regression model? If not, what should I use?
Thank you in advance,
Anton