February 17, 2015

Simulating Gaussian White Noise

n <- 1000; time <- 1:n
eps <- rnorm(n)
plot(time, eps, type="l", col=2)

Simulating an MA(1)

beta <- 0.1
x <- filter(eps, c(1, beta), method="convolution", sides=1)
plot(time, x, type="l", col=2)

Simulating an AR(1)

alpha <- 0.5
x <- filter(eps, alpha, method="recursive")
plot(time, x, type="l", col=2)