/* Square Root Process */ new; cls; gam=0.5; sig=0.1; xbar=52; X0=50; T=1; n=252; X=X0|sroot(gam,sig,xbar,X0,T,n); library pgraph; graphset; xy(seqa(0,T/n,n+1),X); proc sroot(gam,sig,xbar,X0,T,n); local delt,Z,X,i; delt=T/n; Z=rndn(n,1); X=zeros(n,1); X[1]=X0-gam*(X0-xbar)*delt+sig*sqrt(X0)*sqrt(delt)*Z[1]; i=1; do while i<=n-1; X[i+1]=X[i]-gam*(X[i]-xbar)*delt+sig*sqrt(X[i])*sqrt(delt)*Z[i+1]; i=i+1; endo; retp(X); endp;