Using regression with constraints on equality of some of coefficients
10 views (last 30 days)
Show older comments
Hi Guys, I would like to use Linear regression with constraints on equality of some of features' coefficients. Anyone know how to define this? For example I have 6 features and features No 1 and 5 need to have equal coefficients also features 2 and 4 should have the same coefficients in the linear regression model. I really appreciate if anyone can help me. Thanks,
0 Comments
Accepted Answer
Jeff Miller
on 2 Nov 2018
It sounds like you want the linear regression to estimate 4 coefficients: one each for features 1+5, 2+4, 3, and 6. In that case, fit the model with only 4 features, where two of the features correspond to "summation features" that you form by adding 1+5 and 2+4, respectively. (In essence, you are creating two new features by adding the scores on the features you want to pair up.) Then, fit the linear regression model with the original features 3 and 6 and the two new summation features, and you should get the four coefficients that you want.
I hope that makes sense--not easy to explain.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!