Skip to content

Instantly share code, notes, and snippets.

@finbarrtimbers
Forked from anonymous/plot-acf-ma.r
Last active August 29, 2015 13:56
Show Gist options
  • Save finbarrtimbers/9318155 to your computer and use it in GitHub Desktop.
Save finbarrtimbers/9318155 to your computer and use it in GitHub Desktop.
Ever wanted to plot the autocorrelation function of an ARIMA time series in R? Here's an easy way to do it.
# Creates a MA(3) model
ma.parameters <- c(0.5, 0.5, 0.2)
ma.model <- arima.sim(model=list(ma.parameters,n=100)
# Plots the autocorrelation function of the MA(3) model
acf(ma.model)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment