Multiple linear regression with constraint

4 ビュー (過去 30 日間)
Aurélien
Aurélien 2014 年 5 月 26 日
コメント済み: Aurélien 2014 年 5 月 26 日
Hi,
I need some help with a code. I need to run a multiple linear regression for 4 variables (x1, x2, x3, x4) : y = a x1 + b x2 + c x3 + d x4 such that: b = 1 and c = ad
I know i need to use the lsqlin function but i don't really understand how it works.
Thanks for your help !
  1 件のコメント
Matt J
Matt J 2014 年 5 月 26 日
編集済み: Matt J 2014 年 5 月 26 日
b=1 is not really a constraint. It means its value is known. You should just exclude it from the list of unknowns and do the regression in terms of a, b, and d.

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

採用された回答

John D'Errico
John D'Errico 2014 年 5 月 26 日
No. You cannot use LSQLIN. Sorry, but not an option.
Why not? Because one of your constraints is nonlinear, i.e., c=a*d.
You will need to use FMINCON, minimizing a sum of squares of residuals. FMINCON can handle the nonlinear equality constraint.
  1 件のコメント
Aurélien
Aurélien 2014 年 5 月 26 日
Thanks a lot fot this quick reply! I am not familiar with mathematical formulation so I have difficulty to code with FMINCON. Is it possible to give me a hand to implement the code which answers to my question?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Least Squares についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by