next up previous
Next: Solution to Exercise 2.2. Up: No Title Previous: No Title

Solution to Exercise 2.1.

Problem Statement: Give timeseries plot and lagged scatterplots at lags 1 and 2 of the given series. Guess at possible autocorrelation by inspecting the graphs.

Solution: I downloaded the file from the website into the working directory. Here is the Splus code to read in the data and do the plots (Click on highlighted plot statements to download *.ps file):

> reactor=scan("reactor.txt")
> tsplot(reactor)
> #Looks autocorrelated to me.
> length(reactor)
[1] 36
> plot(reactor[1:35],reactor[2:36],main="Lag 1 Scatterplot")
> #Clearly a positive correlation
> plot(reactor[1:34],reactor[3:36],main="Lag 2 Scatterplot")
> #maybe a positive correlation; not so obvous.
Here is a Matlab session. For some reason, there were a bunch of extra '13''s in my input which had to be eliminated. They must have been invisible end of line characters left in the file after downloading to my PC.   Again, click on the highlighted text to see the plots (thistime as *.jpg's).
» z=dlmread('c:\windows\profiles\dennis~1.cox\desktop\hw1\sdir\reactor.txt');
» size(z)

ans =

    74     1

» z(1:6)
 
ans =

   200
    13
   202
    13
   208
    13

» z(70:74)

ans =

    13
   204
    13
    13
    13

» z=z(1:2:71);
» size(z)

ans =

    36     1

» plot(z)
» plot(z(1:35),z(2:36),'.')
» plot(z(1:34),z(3:36),'.')

Dennis Cox

3/10/1999