Quantile regression and linprog

2 visualizzazioni (ultimi 30 giorni)
Patrick
Patrick il 9 Feb 2014
Commentato: Patrick il 24 Set 2014
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);

Risposte (1)

Gittetier
Gittetier il 24 Set 2014
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 Commento
Patrick
Patrick il 24 Set 2014
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

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by