How to restrict parameters of smooth transition models

Discussion of models with structural breaks or endogenous switching.

How to restrict parameters of smooth transition models

Unread postby wenbei » Thu Apr 01, 2021 12:51 am

Dear all,
I am trying to estimate a logistic smooth transition model. Is there any way allowing me to restrict the nlls estimate of the threshold value c within a specific range (e.g. [1.6, 1.7] )?
My transition variable has a range of [1.0, 2.2]. Right now I just restrict the initial value of c within [1.6, 1.7] and use a grid search over c to determine the initial values giving maximum log likelihood, but I find the final nlls estimate would likely give a value falling outside the range (e.g. 1.3), which does not make sense from the data visualization.
Is the big gap as a result of a convergence issue? Do you have some ideas about restricting a range for NLLS estimates? Thanks for your time and consideration.

Below is my code.

Code: Select all
* set the list of free parameters
nonlin(parmset=gparm) eta c

* create transition functions
stats(noprint) s
com sigma=sqrt(%variance)
frml gf = %logistic(exp(eta)*(s-c)/sigma,1.0)

linreg(noprint) y
# constant x
com reglist=%reglist()
equation eq1 y
# reglist
equation eq2 y
# reglist

* define frml for nonlinear estimation
frml(equation=eq1,vector=parm1,parmset=set1) parm1f
frml(equation=eq2,vector=parm2,parmset=set2) parm2f
frml stc y = g=gf,parm1f+g*parm2f

com regparm=set1+set2

com ll_best=-100.0

@gridseries(from=1.6,to=3.5,size=0.1) grid_eta
com ngrid=20
@gridseries(from=1.6,to=1.7,n=ngrid) grid_c

* search initial values giving max logl
do i_eta=1,20
      do i_c=1,ngrid
         com eta=grid_eta(i_eta), c=grid_c(i_c)

         sweep(group=(s>c),var=hetero,ibeta=ibeta)
         # y
         # reglist

         com parm1=ibeta(1),parm2=ibeta(2)-ibeta(1)

         nlls(noprint,parmset=regparm,frml=stc) y
         if %logl>ll_best {
            com ll_best=%logl,$
            eta_best=eta,c_best=c,$
            parm1_best=parm1,parm2_best=parm2
            }

      end do i_c
end do i_eta

* set initial values
com eta=eta_best,c=c_best,parm1=parm1_best,parm2=parm2_best

* NLLS estimation
nlls(parmset=regparm+gparm,frml=stc) y
wenbei
 
Posts: 8
Joined: Fri May 29, 2020 1:54 pm

Re: How to restrict parameters of smooth transition models

Unread postby TomDoan » Thu Apr 01, 2021 11:11 am

You can use the constrained optimization on NLLS---though that's probably overkill in this case since the global (constrained) optimum will be at 1.6. (It has to be at one of the end points if the unconstrained optimum isn't inside the interval.) I'm not sure what you mean by "data visualization" though? This is a break in the linear relationship between y and x using values of s.
TomDoan
 
Posts: 7147
Joined: Wed Nov 01, 2006 5:36 pm

Re: How to restrict parameters of smooth transition models

Unread postby wenbei » Thu Apr 01, 2021 10:59 pm

Thanks for your timely reply. This sounds like exactly what I need. The transition variable s I am using is actually the variable x. I scatter y versus x (vertical versus horizontal axis) and find there could be a natural break at 1.6 in their relationships. But the nlls gives me 1.3, in which case the result visualization (fitted y versus x) look a bit weird. Anyway, thanks a lot. I’ll give a try on the constrained optimization and see what happens.
wenbei
 
Posts: 8
Joined: Fri May 29, 2020 1:54 pm

Re: How to restrict parameters of smooth transition models

Unread postby wenbei » Sun Apr 04, 2021 8:39 pm

TomDoan wrote:though that's probably overkill in this case since the global (constrained) optimum will be at 1.6. (It has to be at one of the end points if the unconstrained optimum isn't inside the interval.)


Hi Tom,
Why does it have to be at one of the end points? This sounds like the optimization of a monotonous function has corner solutions. I thought it would be often the case that the function of fitting criteria is nonlinear and it achieves local optimum at a point within the constrained range. Do I miss anything? Thanks for your consideration.
wenbei
 
Posts: 8
Joined: Fri May 29, 2020 1:54 pm

Re: How to restrict parameters of smooth transition models

Unread postby TomDoan » Mon Apr 05, 2021 8:16 am

Isn't this (from the original reply) pretty much what you're saying: "It has to be at one of the end points if the unconstrained optimum isn't inside the interval."
TomDoan
 
Posts: 7147
Joined: Wed Nov 01, 2006 5:36 pm

Re: How to restrict parameters of smooth transition models

Unread postby wenbei » Mon Apr 05, 2021 1:52 pm

Thanks. Take my dataset as an example. I find the unconstrained (global) optimum gives an estimate of 1.4, and then I would like to constrain it within [1.6, 1.7]. You told me the constrained optimum has to be at one of the end points if ... and I do find that it is at 1.6. But I was also wondering if this result would be certain or coincident. Could it has constrained (local) optimum within [1.6, 1.7] and the estimate would be at some value like 1.63, 1.66 or 1.68?
wenbei
 
Posts: 8
Joined: Fri May 29, 2020 1:54 pm

Re: How to restrict parameters of smooth transition models

Unread postby TomDoan » Tue Apr 06, 2021 9:36 am

If you have multiple local modes, nothing is really certain. That's where the annealing algorithms can be useful as they search more broadly. However, if you do a grid search restricted to your constrained interval, and it doesn't find any sign of a local mode on the interior, then you can probably be pretty safe in assuming that there isn't one.
TomDoan
 
Posts: 7147
Joined: Wed Nov 01, 2006 5:36 pm

Re: How to restrict parameters of smooth transition models

Unread postby wenbei » Tue Apr 06, 2021 10:50 am

I see. Much appreciated for your patient explanations.
wenbei
 
Posts: 8
Joined: Fri May 29, 2020 1:54 pm


Return to Structural Breaks and Switching Models

Who is online

Users browsing this forum: No registered users and 2 guests