fitlm - only positive coefficients
6 ビュー (過去 30 日間)
古いコメントを表示
Hi
I made a linear regression Model with fitlm. Some of the calculated coefficients are negative. In my Project this doesnt make sense. Is there an opportunity to set Boundaries for the coefficients or only allow positive ones?
Thank you!
0 件のコメント
回答 (1 件)
Torsten
2022 年 10 月 24 日
Use "lsqlin" instead. Here, you can set upper and lower bounds for the parameters.
2 件のコメント
Torsten
2022 年 10 月 24 日
The r-squared is only optimized in the model with no bounds on the regression coefficients.
You can compute the r-squared after fitting with lsqlin and with the bound constraints on the parameters, but it will of course be smaller than the optimal one.
参考
カテゴリ
Help Center および File Exchange で Linear Least Squares についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!