OPEN DATA "\\myfiles\2018 nonlinear paper revision\RATS_real time data for paper(new wealth data)_USAUS80.xls" CALENDAR 1980 1 4 ALL 2008:04 DATA(FORMAT=XLS,ORG=COLUMNS) 1980:01 2008:04 aus_ex aus_int us_int $ aus_qdy us_qdy us_inf aus_inf aus_realex aus_qds us_qds us_qdh aus_qdh volatility $ dum85q2 dum86q3 dum08q4 **************************************************** *data transform set y = aus_ex set diffinf =us_inf - aus_inf set diffqdy = us_qdy-aus_qdy set diffint = us_int-aus_int set diffws = us_qds-aus_qds set diffwh = us_qdh-aus_qdh set realex = aus_realex **************************************************** *Linearity test on STR models set y = aus_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} diffws{1} realex{1} dum85q2 dum86q3 @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