Quantile regression and linprog

3 次查看(过去 30 天)
Patrick
Patrick 2014-2-9
评论: Patrick 2014-9-24
I'm trying to implement the linear program at page 2 of this link http://faculty.arts.ubc.ca/pschrimpf/628/hw5-quantile.pdf . I can't seem to get it to work though. As far as I have understood the estimate should be retrievable as the last element of the solution, but this is very small (<10e-10) and it should be 1.0675 according to another quantile regression algorithm (basically the true parameter is set to 1). Any thoughts?
% set seed
rng(1);
% set parameters
n=30;
tau=0.5;
% create regressor and regressand
x=rand(n,1);
y=x+rand(n,1)/10;
% number of regressors (1)
m=size(x,2);
% vektors and matrices for linprog
f=[tau*ones(n,1);(1-tau)*ones(n,1);zeros(m,1)];
A=[eye(n),-eye(n),x;
-eye(n),eye(n),-x;
-eye(n),zeros(n),zeros(n,m);
zeros(n),-eye(n),zeros(n,m)];
b=[y;
y
zeros(n,1);
zeros(n,1)];
% get solution bhat=[u,v,beta] and exitflag (1=succes)
[bhat,~,exflag]=linprog(f',A,b);

回答(1 个)

Gittetier
Gittetier 2014-9-24
Hello Patrick, probably this no longer of any interest to you. But I think there is a mistake in the proposition you cite. When you split up the equality condition into two inequalities one of the Y should turn negative. So there is a mistake in your matrix b. In front of the second Y there should be a minus sign. Best Gittetier
  1 个评论
Patrick
Patrick 2014-9-24
Hello Gittetier, well you are quite right. I had actually forgotten this question. I solved it not long after, but had already forgotten about this.
I have the corrected code on my computer at home, and should probably post the corrections. Thanks for reminding me. Patrick

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by