'========================================================= 'the performance of wold decomposition in nonlinear series '========================================================= create u 1 1000 '======================================================================================== ' the ture DGP is: y(t) =epsilon(t) + a1*epsilon(t-1) + a2*epsilon(t-1)*epsilon(t-2) ' which is nonlinear if a2 is not 0, and weakly stationary '======================================================================================== scalar sumvar1=0 scalar sumvar2=0 scalar sumvar3=0 '=======parameter values======= scalar a1=0.2 scalar a2=0.8 '============================== for !t=1 to 1000 '======generate epsilon_t, which is N(0,1)======= series eps=nrnd '================================================ '======generate y_t======= smpl @first @first series y=eps smpl @first+1 @first+1 series y=eps+a1*eps(-1) smpl @first+2 @last series y=eps+a1*eps(-1)+a2*eps(-1)*eps(-2) smpl @first @last '====================== equation appro1.ls y eps(-1) eps(-1)*eps(-2) ' (1 approximate the model assuming we know the DGP equation appro2.ls y y(-1 to -10) ' (2 approximate y_t with a AR(10) series u=resid ' (3 get the residuals u(t) from the AR(10) regression equation appro3.ls y u(-1 to -10) ' (4 approximate y(t) with the lags of u(t) sumvar1=sumvar1+(appro1.@ssr)/990 sumvar2=sumvar2+(appro2.@ssr)/990 sumvar3=sumvar3+(appro2.@ssr)/990 next scalar estimatevar1=sumvar1/1000 '"estimatevar1" is the estimation of the variance in the first regression, which should be 1 scalar estimatevar2=sumvar2/1000 '"estimatevar2" is the estimation of the variance in the second regression, which should be larger than 1 scalar estimatevar3=sumvar3/1000 '"estimatevar1" is the estimation of the variance in the third regression, which should be lager than 1. '======================================================================= 'if the DGP is linear, (a2=0), then all the three estimates should be 1 '=======================================================================