next up previous
Next: Up: No Title Previous: Simulation of Some Time

Appendix of S-Plus Code.

> #simulation of gaussian white noise, mean 0 variance 1
> gaussian.white.noise_rnorm(1000)
> X11()
> ts.plot(gaussian.white.noise,main="TS Plot of gaussian.white.noise")
> acf(gaussian.white.noise)
> #pretty much as expected.
> #simulation of MA(1) using the already generated noise sequence
> ma1_gaussian.white.noise[2:1000]+.7*gaussian.white.noise[1:999]
> ts.plot(ma1,main="TS Plot of MA(1) with theta = .7")
> acf(ma1)
> #simulation of AR(1) using the already generated noise sequence
> ar1_rep(0,1000)    
> ar1[1]_gaussian.white.noise[1]/(1-.7^2)
> for(i in 2:1000) ar1[i]_.7*ar1[i-1]+gaussian.white.noise[i]
> ts.plot(ar1,main="TS Plot of AR(1) with phi = .7")
> acf(ar1)
> #simulation of Random Walk using the already generated noise sequence
> random.walk_cumsum(gaussian.white.noise)
> ts.plot(random.walk,main="TS Plot of random.walk")
> acf(random.walk)



Dennis Cox
Mon Jan 20 16:03:18 CST 1997