How to find optimal weight for explanatory variables in a regression?
2 views (last 30 days)
Show older comments
Hello all, I have the following regression model: Y = b0 + b1*w1*X1 + b2*w2*X2 where w1+w2=1. These are weights on the X variables. I need to find w1 and w2 that would create the best fit for this regression model. I need help on how to create a Matlab code that would estimate the optimal weights on these X variables. Thanks a lot. Mai
1 Comment
Sargondjani
on 11 Jun 2012
it seems your system is not properly identified.
if you would run the regression":
Y=c0+c1*X1+c2*X2
with c1=b1*w1 and c2=b2*w2, and w1+w2=1
it seems to me that there are infinitely many solutions for w1 and w2. for examply: set w1 to 0.5 then w2 is 0.5 and the values for b1 and b2 would adjust. and if you set w1=0.25 then you just get different results for b1 and b2... so there is no unique solution.
i suspect that you want the weights to hold for every observation, but you would have to adjust the formulation for that.
anyway, i suspect you will have to use "lsqlin" or fmincon (which requires you to specify your own objective function)
Answers (0)
See Also
Categories
Find more on Sensitivity Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!