# 2.1 Linear Models (Solution to Homework) # Ex 2.13 Plot the path of (\eps_t) and (\tilde \eps_t) for t = 1,...,100 and compare! t <- 1:100 eps <- rnorm(100) t.eps <- eps t.eps[seq(3,100,by=2)] <- (eps[seq(2,98,by=2)]^2-1)/sqrt(2) plot(eps,type="l") lines(t.eps,col="red") # Ex 2.14: Plot the path of a random walk with normal N(mu,sig^2) distributed for each of the cases # mu < 0, mu = 0 and mu > 0. t <- 1:100 eps <- rnorm(100,-0.5) plot(cumsum(eps),type="l") eps <- rnorm(100,0) plot(cumsum(eps),type="l") eps <- rnorm(100,0.2) plot(cumsum(eps),type="l")