Quantile regression and linprog

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일

0 개 추천

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

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Linear Programming and Mixed-Integer Linear Programming에 대해 자세히 알아보기

질문:

2014년 2월 9일

댓글:

2014년 9월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by