I want to run a constrained regression where there is factor variable (with a lot of levels). I want to add the constraint that the sum of the parameters of all levels of this factor variable is 1. How should I do this? Ideally, I want to do something like
constraint 1 sum(i.group)=1
cnsreg y x1 x2 x3 x4 i.group, constraints(1)
But this syntax obviously does not work. I searched for a while but did not find the right code to use. I am wondering if you are so kind to share with me some sample code that does this task. Thanks!
constraint 1 sum(i.group)=1
cnsreg y x1 x2 x3 x4 i.group, constraints(1)
But this syntax obviously does not work. I searched for a while but did not find the right code to use. I am wondering if you are so kind to share with me some sample code that does this task. Thanks!
Comment