How to change the objective function of quantile regression?
I need to run a quantile regression but considering a different objective function to be minimized: instead of finding the parameters that minimize rho(t) = u*(t - I(u<0)), I need to find the parameters beta that minimize a sum of two rho functions rho(t1) = u1*(t1 - I(u1<0)) and rho(t2) = u2*(t2 - I(u2<0)) where t1 and t2 are different quantile levels and u1 = y1 - b'x1 and u2 = y2 - b'x2.
y1 and x1 are response variable and regressors, respectively, that will be weighted by t1 and similar for t2.
The problem is that I do not know how to change the function rq() in R because it only accepts two arguments, y and x. In my case, I think I also have two arguments, that is x <- rbind(x1,x2) and y <- rbind(y1,y2) , but I need to split the residuals to be minimized, weighting u1 by t1 and u2 by t2. I am trying my best, but I cannot do it.