OPEN DATA "\\myfiles\2018 nonlinear paper revision\RATS_real time data for paper(new wealth data)_USUK.xls" CALENDAR 1980 1 4 ALL 2008:04 DATA(FORMAT=XLS,ORG=COLUMNS) 1980:01 2008:04 uk_ex uk_int us_int $ uk_qdy us_qdy uk_inf us_inf uk_realex us_qds uk_qds uk_qdh us_qdh volatility $ dum81q3 dum92q3 dum88q1 print 2007:1 2008:1 volatility **************************************************** *data transform set y = uk_ex set diffinf =us_inf - uk_inf set diffqdy = us_qdy-uk_qdy set diffint = us_int-uk_int set diffws = us_qds-uk_qds set diffwh = us_qdh-uk_qdh set realex = uk_realex **************************************************** ***ADF unit root test @DFUNIT y 1980:1 2008:4 @DFUNIT diffinf 1980:1 2008:4 @DFUNIT diffqdy 1980:1 2008:4 @DFUNIT diffint 1980:1 2008:4 @DFUNIT diffws 1980:1 2008:4 @DFUNIT diffwh 1980:1 2008:4 @DFUNIT realex 1980:1 2008:4 @lsunit(breaks=1,pi=.10,lags=3,method=gtos,model=crash) diffws **************************************************** *Linearity test on STR models set y = uk_ex set a1 = diffinf{1} set a2 = diffint{2} set a4 = diffqdy{1} set a5 = diffws{1} set a6 = diffwh{1} set a7 = realex{1} linreg y 1980:1 2008:4 # constant diffinf{1} diffint{2} diffqdy{1} diffwh{1} diffws{1} realex{1} dum81q3 dum92q3 dum88q1 @regSTRTest(threshold=a1, d=0) y @regSTRTest(threshold=a2, d=0) y @regSTRTest(threshold=a4, d=0) y @regSTRTest(threshold=a5, d=0) y @regSTRTest(threshold=a6, d=0) y @regSTRTest(threshold=a7, d=0) y @regSTRTest(threshold=volatility, d=0) y **************************************************************************** ***Estimation of the nonlinear model ******The ESTR model*** ** **************************************************************************** * equation standard y # constant diffinf{1} diffqdy{1} diffint{2} diffws{1} realex{1} equation transit y # constant diffinf{1} diffqdy{1} diffint{2} diffws{1} realex{1} * dec vector phi1 phi2 frml(equation=standard,vector=phi1) phi1f frml(equation=transit,vector=phi2) phi2f nonlin(parmset=regparms) phi1 phi2 * nonlin(parmset=starparms) gamma c * frml festar = 1.0-exp(-gamma*(diffqdy{1}-c)^2) frml estar y = g=festar,phi1f+g*phi2f stats diffqdy compute gamma=1.0/%variance compute c = %mean ******************************************************************** * Estimate the model with the ESTAR parameters fixed. * nlls(parmset=regparms,frml=estar) y * * Then with the STAR parameters freed * nlls(parmset=regparms+starparms,frml=estar) y / resids ******************************************************************** *Grid search on c and gamma compute agrid=%seqa(1, 1, 10) dec real ggrid stats(fractiles) diffint compute grid=%seqa(%fract25,(%fract75-%fract25)/49.0,50) dec real cgrid compute minrss=1.e+100 nonlin(parmset=starparms) gamma=ggrid c=cgrid dofor ggrid =agrid dofor cgrid = grid nlls(frml=estar,parmset=regparms+starparms,noprint) y if %rss