[R] Making rq and bootcov play nice

Frank E Harrell Jr f.harrell at vanderbilt.edu
Sat Jul 25 01:23:59 CEST 2009


Quantile regression is now supported in the Design package and bootcov 
has been updated accordingly.  To get the new code run

require(Design)
source('http://biostat.mc.vanderbilt.edu/cgi-bin/viewvc.cgi/*checkout*/Design/trunk/R/bootcov.s')
source('http://biostat.mc.vanderbilt.edu/cgi-bin/viewvc.cgi/*checkout*/Design/trunk/R/Rq.s')
f <- Rq(y ~ rcs(age,4)*sex, x=TRUE, y=TRUE, tau=.25)
b <- bootcov(f, B=1000, pr=TRUE)
nomogram(f)
anova(b)
summary(b, age=c(21,65), sex='male')

This allows one to do quantile regression (but only one tau at a time) 
and get effect plots, nomograms, anova, general contrasts, etc.

Frank


John Gardner wrote:
> I have a quick question, and I apologize in advance if, in asking, I
> expose my woeful ignorance of R and its packages. I am trying to use
> the bootcov function to estimate the standard errors for some
> regression quantiles using a cluster bootstrap. However, it seems that
> bootcov passes arguments that rq.fit doesn't like, preventing the
> command from executing. Here is an example:
> 
>  e<-bootcov(rq(y~x),clust,B=10,fitter=rq.fit)
> 
> (where clust is my clustering variable) results in
> 
> Error in rq.fit.br(x, y, tau = tau, ...) :
>   unused argument(s) (maxit = 15, penalty.matrix = NULL)
> 
> In contrast, the lm.fit function seems to just ignore these arguments,
> resulting in the following warning:
> 
> 10: In fitter(X[obs, , drop = FALSE], Y[obs, , drop = FALSE], maxit = maxit,  :
>   extra arguments maxitpenalty.matrix are just disregarded.
> 
> Is there a way that I can either (a) modify bootcov so that it doesn't
> pass these arguments or (b) modify rq so that it ignores them?
> 
> Thanks in advance,
> John Gardner
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 


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




More information about the R-help mailing list