[R] odd behaviour in quantreg::rq

Dylan Beaudette debeaudette at ucdavis.edu
Tue Jun 30 22:54:14 CEST 2009


Hi,

I am trying to use quantile regression to perform weighted-comparisons of the 
median across groups. This works most of the time, however I am seeing some 
odd output in summary(rq()):

Call: rq(formula = sand ~ method, tau = 0.5, data = x, weights = 
area_fraction)
Coefficients:
                   Value    Std. Error t value  Pr(>|t|)
(Intercept)        45.44262  3.64706   12.46007  0.00000
methodmukey-HRU     0.00000  4.67115    0.00000  1.00000
				  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

When I do not include the weights, I get something a little closer to a 
weighted comparison of means, along with an error message:

Call: rq(formula = sand ~ method, tau = 0.5, data = x)
Coefficients:
                   Value    Std. Error t value  Pr(>|t|)
(Intercept)        44.91579  2.46341   18.23318  0.00000
methodmukey-HRU     9.57601  9.29348    1.03040  0.30380
Warning message:
In rq.fit.br(x, y, tau = tau, ...) : Solution may be nonunique


I have noticed that the error message goes away when specifying method='fn' to 
rq(). An example is below. Could this have something to do with replication 
in the data?


# example:
library(quantreg)

# load data
x <- read.csv(url('http://169.237.35.250/~dylan/temp/test.csv'))

# with weights
summary(rq(sand ~ method, data=x, weights=area_fraction, tau=0.5), se='ker')

# without weights
# note error message
summary(rq(sand ~ method, data=x, tau=0.5), se='ker')

# without weights, no error message
summary(rq(sand ~ method, data=x, tau=0.5, method='fn'), se='ker')

-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341




More information about the R-help mailing list