[R] Quantile Regression/(package (quantreg))

Frank Harrell
Sat, 29 Jun 2013 03:55:29 -0000

Mike,

Do something like:

require(rms)
dd <- datadist(mydatarame); options(datadist='dd')
f <- Rq(y ~ rcs(age,4)*sex, tau=.5)  # use rq function in quantreg
summary(f)  # inter-quartile-range differences in medians of y (b/c tau=.5)
plot(Predict(f, age, sex))   # show age effect on median as a continuous
variable

For more help type ?summary.rms and ?Predict

Frank

------------

When performing quantile regression (r package I used quantreg), the
value of the quantile refers to the quantile value of the dependent
variable.
Typically when trying to predict, since the information we have are the
independent variables, I am interested in trying to estimate the
coefficients based on the quantile values of the independent variables'
distribution. So that I can get an understanding, for certain ranges of
the predictor/independent variable values, the (target/dependent
variable) has (a certain level of exposure to the
predictors)/(coefficients).
Is there any way I can achieve that?

Just in case, if I am incorrect about my understanding on the way
quantiles are interpreted when using the package quantreg, please let me
know.

Thanks
Mike
--
Frank E Harrell Jr Professor and Chairman      School of Medicine
                    Department of Biostatistics Vanderbilt University