Dear all,

I am having v.4.36 of Quantreg package and I noticed strange behaviour when
weights were added. Could anyone please explain me what if the results are
really strange or the behavioiur is normal. As an example I am using dataset
Engel from the package and my own weights.

x<-engel[1:50,1]
y<-engel[1:50,2]
w<-c(0.00123, 0.00050, 0.00126, 0.00183, 0.00036, 0.00100,
0.00122, 0.00133, 0.01208, 0.00126, 0.00102, 0.00183,
0.00063, 0.00134, 0.00084, 0.00087, 0.00118, 0.00894,
0.00105, 0.00154, 0.02829, 0.00095, 0.05943, 0.07003,
0.00692, 0.03610, 0.00316, 0.06862, 0.00439, 0.08974,
0.01960, 0.00185, 0.00348, 0.03597, 0.00210, 0.03929,
0.03535, 0.01463, 0.02254, 0.00089, 0.01495, 0.00178,
0.00351, 0.10338, 0.13662, 0.00157, 0.07689, 0.07304,
0.00194, 0.00142)

windows(width = 8, height = 7)
u1<-rq(y~x,tau=c(1:10/10-0.05),weights=w)
#note that by taking weights = 500*w the points
#are all moving down (i thought it should have been invariant to the
magnitude of weights) when all the weights remaint the same
plot(x,y,ylim=c(-1000,max(y)))
points(x,u1$fitted.values[,3],col="blue",cex=0.5)
#weighted - fitted values nearly match original values


windows(width = 8, height = 7)
u1<-rq(y~x,tau=c(1:10/10-0.05))
plot(x,y,ylim=c(-1000,max(y)))
points(x,u1$fitted.values[,3],col="blue",cex=0.5)
#unweighted - fitted values form a line

Why the weighted quantile regression does not produce a line?

Thank you for answers.

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to