I am trying to find the coefficients of a system of linear regression equations defined as y = b*X + ε, where ε ~ N(0,s^2). The coefficients are to be constrained so that each b_i is between 0 and 1 and sum(b_i) = 1. To do this we are trying to define w = exp(b) / sum(exp(b)) and then solve for w. Inside my linregeval() function I make this transformation, obtain the X (data) matrix from userinfo, then set the likelihood equal to lnnormalden(y, X*w’, sqrt(p2)), where p2 is the variance parameter.
When I run moptimize() it fails in “Iteration 1” for “flat or discontinuous region encountered” and the likelihood value does not change upon each sub-iteration (each time linregeval() is called within “Iteration 1”). The value of b also doesn’t change, but if I print p1 (obtained from util_xb) it appears to update on each call to linregeval(). However, I can’t obtain b from p1 since this would involve “dividing out” the X matrix.
Is there any way to solve this problem?
Related Posts with Imposing nonlinear constraint in moptimize()
Forval simulation, 100 timesDear Stalist, I want to run and repeat this command line 100 times and then after the repetition, ta…
marginal effects after STINTREGHi, I am using STINTREG to analyze interval data and as expected, the output is hazard ratios. I wa…
Question about generating a small table, having issues with getting the categories set up as I wantGood day, I would like to create a simple table (I use multiple imputations) with 2 variables I wan…
Problem with two step difference/system GMM estimator using "xtabond2"Dear all, It is my first post on Statalist, I hope I am doing everything fine, I read all the FAQs …
rangestat faster than reghdfeI am trying to run the following and it is very slow. I believe it is possible to speed it up using …
Subscribe to:
Post Comments (Atom)
0 Response to Imposing nonlinear constraint in moptimize()
Post a Comment