Multiple linear regression with constraint

I need to run a multiple linear regression such that all of the coefficients are positive, and their sum = 1 . I have 7 variables, so i need 7 seven coefficients.
Thanks !

 採用された回答

Amit
Amit 2014 年 2 月 8 日

0 投票

6 件のコメント

abdoulaye thiam
abdoulaye thiam 2014 年 2 月 8 日
Thanks Amit, with lsqlin i am able to set the sum of the coefficients being equal to zero, but i do not know how to make sure that they are all positive numbers.. sorry, if the question sounds dumb, i am new matlab user thank
Amit
Amit 2014 年 2 月 8 日
make sure that all the coefficients are positive, you set the lower bound as 0 and upper bound as inf. something like:
lsqlin(.......,zeros(7,1),Inf*ones(7,1))
abdoulaye thiam
abdoulaye thiam 2014 年 2 月 8 日
Hello Amit, even after setting the lower bound to zero it gives negative coefficients.
Amit
Amit 2014 年 2 月 8 日
How did you set it? How did you use lsqlin?
John D'Errico
John D'Errico 2014 年 2 月 8 日
編集済み: John D'Errico 2014 年 2 月 8 日
Note that most likely, some of the coefficients MIGHT go negative by an amount on the order of eps. Look at the numbers. If they are -1.e-13, why do you care? Just set them to ZERO afterwards.
abdoulaye thiam
abdoulaye thiam 2014 年 2 月 8 日
編集済み: abdoulaye thiam 2014 年 2 月 8 日
Yes you are right John, the only the only negative number that i have is -2.641592169276901e-17...Sure, why would I care!! Thank you both!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

質問済み:

2014 年 2 月 7 日

編集済み:

2014 年 2 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by