fitlm - only positive coefficients
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Torsten
am 24 Okt. 2022
Use "lsqlin" instead. Here, you can set upper and lower bounds for the parameters.
2 Kommentare
Torsten
am 24 Okt. 2022
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.
Siehe auch
Kategorien
Mehr zu Linear Least Squares finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!