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 Center および File ExchangeSolver 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