slide_091021_code

# slide_091021_code - #1. zero mean iid series (normal)...

This preview shows pages 1–3. Sign up to view the full content.

Sheet1 Page 1 ##1. zero mean iid series (normal) plot(rnorm(50)) ts.plot(rnorm(50)) ts.plot(rnorm(100)) ts.plot(rnorm(100,mean=0,sd=0.1)) ts.plot(rnorm(100,mean=0,sd=5)) ##2. random walk (binary) rw <- cumsum(c(0,sample(c(-1,1), 1000, rep = T))) plot(rw) ts.plot(rw) ##3. simulation ## AR 1 sim.AR1<-arima.sim(list(ar=c(0.2)), n=200) plot(sim.AR1) ## stationary par(mfrow=c(2,1)) acf(sim.AR1, type="covariance") acf(sim.AR1, type="correlation") sim.AR1<-arima.sim(list(ar=c(-0.6)), n=200) plot(sim.AR1) ## stationary par(mfrow=c(2,1)) acf(sim.AR1, type="covariance") acf(sim.AR1, type="correlation") sim.AR1<-arima.sim(list(ar=c(1.2)), n=200) ## not stationary a1<-1.2 T<-20 series<-array(0,T) series[1]<-rnorm(1) for (i in 2:T) series[i]<-a1*series[i-1]+rnorm(1) ts.plot(series) ## AR 2 sim.AR2<-arima.sim(list(ar=c(0.4, 0.2)), n=1000) plot(sim.AR2) par(mfrow=c(2,1)) acf(sim.AR2, type="covariance") acf(sim.AR2, type="correlation") sim.AR2<-arima.sim(list(ar=c(1/6, 1/6)), n=1000)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Sheet1 Page 2 plot(sim.AR2)
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 12/06/2011 for the course AMS 316 taught by Professor Xing during the Fall '09 term at SUNY Stony Brook.

### Page1 / 3

slide_091021_code - #1. zero mean iid series (normal)...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online