i am not sure @Metrics answer will give the correct standard errors for a survey-weighted quantreg call. here's an example of what you're trying to do. you are certainly hitting a bug because the qr
function nested within the withReplicates
function at this point cannot handle multiple tau
parameters at once (even though the qr
function on its own might). just call one at a time, perhaps like this :)
library(survey)
library(quantreg)
# load some fake data
data(scd)
repweights <-
cbind(c(4,0,3,0,4,0), c(3,0,0,4,0,3),c(0,3,4,0,0,2),c(0,1,0,4,3,0))
# tack on the fake replicate weights
x <- cbind( scd , repweights )
# tack on some fake main weights
x[,9] <- c( 3 , 2 , 3 , 4 , 1 , 4 )
# name your weight columns
names( x )[ 5:9 ] <- c( paste0( 'rep' , 1:4 ) , "wgt" )
# create a replicate-weighted survey design object
scdrep <-
svrepdesign(
data = x ,
type = "BRR" ,
repweights = "rep" ,
weights = ~wgt ,
combined.weights = TRUE
)
# loop through each desired value of `tau`
for ( i in seq( 0.1 , 0.9 , by = 0.1 ) ){
print( i )
# follow the call described here:
# http://www.isr.umich.edu/src/smp/asda/Additional%20R%20Examples%20bootstrapping%20with%20quantile%20regression.pdf
print(
withReplicates(
scdrep ,
quote(
coef(
rq( arrests ~ alive , tau = i , weights = .weights )
)
)
)
)
}
rq
with i.i.d. data, the standard errors involve a kernel density estimate of the errors density at a chosen quantile point. This may or may not be a meaningful quantity with complex survey data. As such,rq
is based on non-smooth estimation equations that involve jump functions, and BRR theory is generally established only for smooth statistics. $\endgroup$