# Problem 1.23 R library(ts) # a. # read data from a file. # x <- scan("e:\\Stat207\\Homework\\Ch1\\MASS.dat") # read data from the class website. x <- scan("http://www.sci.csueastbay.edu/~esuess/Statistics_6871/Handouts/Handout2/MASS.dat") win.graph() par(mfrow=c(2,1)) ts.plot(x) var(x[100:200]) var(x[400:500]) y <- log(x) ts.plot(y) var(y[100:200]) var(y[400:500]) win.graph() par(mfrow=c(2,1)) hist(x) hist(y) # b. win.graph() acf(y) u <- diff(y) win.graph() ts.plot(u) win.graph() acf(u) win.graph() ts.plot(x[200:300]) # c. win.graph() par(mfrow=c(3,2)) ts.plot(x) acf(x) ts.plot(y) acf(y) ts.plot(u) acf(u) # d. win.graph() acf(u)