Install acf for mac

broken image
broken image

Xlag1=lag(x,-1) # Creates a lag 1 of x variable. ot(x,1) # Plots x versus lag 1 of x.Īcf(x, xlim=c(1,19)) # Plots the ACF of x for lags 1 to 19 Plot(x, type='b') #time series plot of x with points marked as 'o' X=ts(x) #this makes sure R knows that x is a time series Those comments do not have to be entered for the command to work. The commands below include explanatory comments, following the #. Then in R, change the working directory to be this folder.

broken image

If you were to download the file, you should download it into a folder that you create for storing course data. The data are listed in time order from left to right in the lines of the file. The first line reads the data from a file named quakes.dat. Below is R code that will accomplish these tasks. We identified an AR(1) model (autoregressive model of order 1), estimated the model, and assessed the residuals. One example in Lesson 1.1 and Lesson 1.2 concerned the annual number of earthquakes worldwide with a magnitude greater than 7.0 on the seismic scale.