r - how to extract upper/lower bounds on coefficients from quantile regression rq() -


i'd extract coefficients , upper , lower bounds quantile regression using quantreg package. here's example file.

data(engel) attach(engel) taus <- c(.05,.1,.25,.75,.9,.95) f <- rq((foodexp)~(income),tau=taus) sf <- summary(f) sf[1] #[[1]]  #call: rq(formula = (foodexp) ~ (income), tau = taus)  #tau: [1] 0.05  #coefficients: #            coefficients lower bd  upper bd  #(intercept) 124.88004     98.30212 130.51695 #income        0.34336      0.34333   0.38975 

i know can use coefficients() coefficients.

cf <- t(data.frame(coefficients(f)))    # transpose better arrangement cf #              (intercept)    income #tau..0.05   124.88004 0.3433611 #tau..0.10   110.14157 0.4017658 #tau..0.25    95.48354 0.4741032 #tau..0.75    62.39659 0.6440141 #tau..0.90    67.35087 0.6862995 #tau..0.95    64.10396 0.7090685 

but can't figure out how upper/lower bounds appear in summary(). looked @ str(sf), did not see how extract.

ultimately, i'd put taus, coefficients, , upper/lower bounds in dataframe further processing.

i'm assuming want coefficients on non-intercept term. how this

sapply(sf, function(x) c(tau=x$tau, x$coefficients[-1, ])) 

that iterate on different levels of tau , extract intervals coefficients

                  [,1]      [,2]      [,3]      [,4]      [,5]      [,6] tau          0.0500000 0.1000000 0.2500000 0.7500000 0.9000000 0.9500000 coefficients 0.3433611 0.4017658 0.4741032 0.6440141 0.6862995 0.7090685 lower bd     0.3433270 0.3420992 0.4203298 0.5801552 0.6493680 0.6739000 upper bd     0.3897500 0.4507941 0.4943288 0.6904127 0.7422294 0.7344405 

Comments

Popular posts from this blog

android - Automated my builds -

how to proxy from https to http with lighttpd -

python - Flask migration error -