I'm trying to estimate the coefficients and variance of the following model:
y = X*W + ε(0,σ2)
Where W is a vector of transformed coefficients given by:
wi = exp(bi) / sum(exp(bi)).
This constrains the coefficients to be between 0 and 1 and to sum to 1 (i.e. they represent proportions of each variable).
I have tried doing this in MATA using moptimize() with the d0 model and transforming the coefficients manually, as well as using the constraint function for the equality constraint and a penalty function for the inequality constraints. Since this didn't seem to work I have moved on to STATA and using the various ml*/nl* methods. nlsur seemed promising except that it didn't seem possible to specify a vector of parameters. In other words, I would have to create a new bi for every variable in my dataset which is unwieldy since we're usually using about 50 variables.
Can anyone provide some help as to what I'm looking for? I've been hammering away at this for weeks now with no results and it just seems like it should be simpler than this, especially considering it can be very easily achieved in MATLAB just using fminunc.
y = X*W + ε(0,σ2)
Where W is a vector of transformed coefficients given by:
wi = exp(bi) / sum(exp(bi)).
This constrains the coefficients to be between 0 and 1 and to sum to 1 (i.e. they represent proportions of each variable).
I have tried doing this in MATA using moptimize() with the d0 model and transforming the coefficients manually, as well as using the constraint function for the equality constraint and a penalty function for the inequality constraints. Since this didn't seem to work I have moved on to STATA and using the various ml*/nl* methods. nlsur seemed promising except that it didn't seem possible to specify a vector of parameters. In other words, I would have to create a new bi for every variable in my dataset which is unwieldy since we're usually using about 50 variables.
Can anyone provide some help as to what I'm looking for? I've been hammering away at this for weeks now with no results and it just seems like it should be simpler than this, especially considering it can be very easily achieved in MATLAB just using fminunc.
Comment