Reputation: 765
I want to have 2 side-by-side plots of the ACF and PACF functions in R (please see code below). Now, I want to line up the significant levels in each plot. In this case the ACF y-axis needs to shift up, or the PACF y-axis must shift down. Is there an argument in either the PACF or ACF functions to achieve the desired plot? Thank you for your help!
library(quantmod)
library(forecast)
getSymbols("TB3MS",src="FRED")
TB3MS <- TB3MS['1960::2002']
par(mfrow = c(1, 2))
acf(TB3MS)
pacf(TB3MS)
par(mfrow = c(1, 1))
Upvotes: 1
Views: 4711
Reputation: 8377
It's quite simple, you can play with the ylim of your graph
Check this:
par(mfrow = c(1, 2))
acf(TB3MS, ylim=c(-0.2, 1))
pacf(TB3MS, ylim=c(-0.2, 1))
par(mfrow = c(1, 1))
If you want to automate it, you may calculate the lowest value of the two graphs
lower_ylim <- min(min(acf(TB3MS, plot=F)$acf), min(pacf(TB3MS, plot=F)$acf))
Upvotes: 3