How can I add a constrain to a OLS estimation?
3 views (last 30 days)
Show older comments
I need to estimate the parameters of a linear regression with OLS and the sum of those parameters has to be equal to 1. How can I add this condition?
The regression is P=H*Z where H is a matrix; P and Z are two vectors
I have to estimate Z with OLS subject to the sum of the elements of Z is 1
0 Comments
Answers (1)
Matt J
on 29 Sep 2012
Rewrite Z as
Z=A*x+b
where x=Z(1:n-1) are the n-1 unknowns and
A=[eye(n-1);-ones(1,n-1)];
b=[zeros(n-1,1);+1];
Now, the regression equation in terms of x
P=(H*A)*x+(H*b)
is unconstrained.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!