'--------------------------------------WOLD'S DECOMPOSITION --------------------------------' '-----FIRST: generate the data for the example using the nonlinear process ' y(t)= u(t) + 0.2 u(t-1) + 0.8u(t-1)*u(t-2) create u 1000 series u=nrnd series y=u+0.2*u(-1)+0.8*u(-1)*u(-2) '------ we now do the best possible regression for the data, namely the one ' of y on u(-1) and u(-1)*u(-2) (which corresponds to knowing the dgp) ' equation best.ls y u(-1) u(-1)*u(-2) '------SECOND: we compute the wold's decomposition for the process y (as if we ' didn't know the dgp) in two steps: ' STEP 1: Estimate an AR(10) for Y ' equation ary.ls y c y(-1 to -40) ' ' STEP 2: Regress Y on 10 lags of the residuals V of this last regression ' series v=resid equation wold.ls y c v(-1 to -30) ' ' Finally, we create a table showing the VARIANCES OF THE RESIDUALS for each method ' table(2,3) variances variances(1,1)="Knowing the DGP" variances(1,2)="Estimating with an AR" variances(1,3)="Wold's Decomposition" variances(2,1)=best.@ssr/best.@regobs variances(2,2)=ary.@ssr/ary.@regobs variances(2,3)=wold.@ssr/wold.@regobs variances.title Variances of the Residuals variances.setformat(2) f.3 variances.setlines(a1:c2) +a variances.setwidth(@all) 20 variances.table