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

Frank Harrell f.harrell at Vanderbilt.Edu
Sat Jun 29 05:55:29 CEST 2013


Do something like:

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 

For more help type ?summary.rms and ?Predict



When performing quantile regression (r package I used quantreg), the 
value of the quantile refers to the quantile value of the dependent 
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 
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 

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

More information about the R-help mailing list