How to restrict parameters of smooth transition models
Posted: 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.
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