/* Percent Difference Smoothing */ /* (Forecast Smoothing) Criteria: MSE */ new; cls; let data[12,1]= 23 25 36 31 26 28 48 36 31 42 53 43 ; t=seqa(1,1,rows(data)); library pgraph; graphset; _pltype=6; _plegctl=1; _plegstr="actual\000predicted"; title("Percent Difference Smoothing"); nperiod=4; xy(t,data~pdiffMSE(data)); proc pdiffMSE(x); local n,m,e,i,j,nperiod,nperiodstar,star,MSE,MSE_1; n=rows(x); MSE_1=1e+8; j=1; do while j<=n-2; nperiod=j; m=zeros(n,1); i=nperiod+2; do while i<=n; m[i]=x[i-1]*(x[i-1]/x[i-1-nperiod]); i=i+1; endo; e=x[nperiod+2:n]-m[nperiod+2:n]; MSE=sumc(e^2)/rows(e); if MSE