OPEN DATA "\\myfiles\2018 nonlinear paper revision\RATS_real time data for paper(new wealth data)_USSD.xls" CALENDAR 1980 1 4 ALL 2008:04 DATA(FORMAT=XLS,ORG=COLUMNS) 1980:01 2008:04 sw_ex sw_int us_int $ sw_qdy us_qdy us_inf sw_inf sw_realex us_qds sw_qds us_qdh sw_qdh volatility $ dum08q4 dum92q3 dum93q3 dum82q4 print 1980:1 1990:1 us_inf **************************************************** *data transform set y = sw_ex set diffinf =us_inf - sw_inf set diffqdy = us_qdy-sw_qdy set diffint = us_int-sw_int set diffws = us_qds-sw_qds set diffwh = us_qdh-sw_qdh set realex = sw_realex **************************************************** *Linearity test on STR models set y = sw_ex set a1 = diffinf{1} set a2 = diffint{2} set a4 = diffqdy{1} set a5 = diffws{1} set a6 = diffwh{1} set a7 = sw_realex{1} linreg y 1980:1 2008:4 # constant diffinf{1} diffint{2} diffqdy{1} diffwh{1} diffws{1} sw_realex{1} dum08q4 dum92q3 dum93q3 dum82q4 @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} diffwh{1} realex{1} equation transit y # constant diffinf{1} diffqdy{1} diffint{2} diffws{1} 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*(diffint{2}-c)^2) frml estar y = g=festar,phi1f+g*phi2f stats diffint 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