Multiple linear regression with constraint
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!