NLLS with Sign Restriction

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
ivory4
Posts: 144
Joined: Mon Aug 24, 2009 12:16 pm

NLLS with Sign Restriction

Unread post by ivory4 »

I need to estimate a nonlinear model with GMM. I tried to impose sign restriction on three of my variables a d e

Code: Select all

nonlin(parmset=fullset) a>=0.0 b c d>=0.0 e>=0.0
frml gdp=....
compute a=1.0, b=2.0,.......
instruments constant gdp{1 to 2} .....
nlls(inst, frml=gdp,parmset=fullset,noprint) *

set abc / =gdp
mcov(lags=2, damp=1) / abc
# constant gdp{1 to 2}........
compute W =inv*(%CMOM)
nlls(inst, wmatrix=w,frml=gdp,robusterrors, parmset=fullset,lags=2,damp=1)
 
But it turns out to be the case that only b and c are estimated. What is the problem here? I found a similar example in UG PP271


Without the sign restriction, it seems working well but sometimes when estimated over certain range of data, the coefficients are estimated with wrong sign and 1 of them is extremely high(not interpretable). I tried changing the initial values case by case, but I think maybe a sign restriction would better tackle the problem
Thanks
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: NLLS with Sign Restriction

Unread post by TomDoan »

This is the code from the User's Guide:

Code: Select all

nonlin(parmset=base) g b0 b1 b2
nonlin(parmset=constraint) b0>=0.0 b1>=0.0 b2>=0.0
nlls(parmset=base) ...
nlls(parmset=base+constraint)
You'll note that when you combine the two (base+constraint), you have both b0 and b0>=0.0 in the parameter set. You need both--the first to put b0 into the parameter set, and the second to constrain it. In your case, you would need

Code: Select all

nonlin(parmset=fullset) a b c d e a>=0.0 d>=0.0 e>=0.0
ivory4
Posts: 144
Joined: Mon Aug 24, 2009 12:16 pm

Re: NLLS with Sign Restriction

Unread post by ivory4 »

Thanks. I encounter a problem when rolling regress a model with GMM. Some window returns either non-convergence or converging but non-interpretable results(one coefficent too high or wrong sign). The first thing I tried is to inherit the previous estimated coefficients as the initial values. (Parmset=fullset, %parmspoke(fullset, %beta)).
The results are still not desirable. Then I think of imposing sign restrictions on them if the estimated value goes far beyond reasonable range.But many times the results turns out to be on the boundary. Another way I found in the manual is using pmethod=simplex, piter=5, method=BFGS

Are there any other suggestions to fix the convergence problem here?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: NLLS with Sign Restriction

Unread post by TomDoan »

If you're trying to use OPTIMALWEIGHTS, you might want to think about using a common weight matrix computed across the full sample. That will cut out one potential source of convergence problems. If your coefficients are routinely straying outside of reasonable bounds, you may be using too small a window.
ivory4
Posts: 144
Joined: Mon Aug 24, 2009 12:16 pm

Re: NLLS with Sign Restriction

Unread post by ivory4 »

TomDoan wrote:If you're trying to use OPTIMALWEIGHTS, you might want to think about using a common weight matrix computed across the full sample.

I have around 160 windows here and it seems that suddenly the estimation get convergence problem and after several windows it returns to normal results and then happens again. So I need to do this OPTIMALWEIGHTS for the full sample and use it for each window.
NLLS doesnot need to follow a nonlin ? like in this case as described in user's guide
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: NLLS with Sign Restriction

Unread post by TomDoan »

I'm not sure what you're asking. You just need the single NONLIN up near the top; do NLLS over the full sample and save the weight matrix (with compute wmatrix=%wmatrix). Then do your rolling NLLS with WMATRIX=WMATRIX; also use ROBUSTERRORS on those, since the scale on the weight matrix isn't correct for the short samples.
Post Reply