Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

autoplot.acf

ggplot (Partial) Autocorrelation and Cross-Correlation Function Estimation and Plotting


Description

Produces a ggplot object of their equivalent Acf, Pacf, Ccf, taperedacf and taperedpacf functions.

Usage

## S3 method for class 'acf'
autoplot(object, ci = 0.95, ...)

ggAcf(
  x,
  lag.max = NULL,
  type = c("correlation", "covariance", "partial"),
  plot = TRUE,
  na.action = na.contiguous,
  demean = TRUE,
  ...
)

ggPacf(
  x,
  lag.max = NULL,
  plot = TRUE,
  na.action = na.contiguous,
  demean = TRUE,
  ...
)

ggCcf(
  x,
  y,
  lag.max = NULL,
  type = c("correlation", "covariance"),
  plot = TRUE,
  na.action = na.contiguous,
  ...
)

## S3 method for class 'mpacf'
autoplot(object, ...)

ggtaperedacf(
  x,
  lag.max = NULL,
  type = c("correlation", "partial"),
  plot = TRUE,
  calc.ci = TRUE,
  level = 95,
  nsim = 100,
  ...
)

ggtaperedpacf(x, ...)

Arguments

object

Object of class “acf”.

ci

coverage probability for confidence interval. Plotting of the confidence interval is suppressed if ci is zero or negative.

...

Other plotting parameters to affect the plot.

x

a univariate or multivariate (not Ccf) numeric time series object or a numeric vector or matrix.

lag.max

maximum lag at which to calculate the acf.

type

character string giving the type of acf to be computed. Allowed values are "correlation" (the default), “covariance” or “partial”.

plot

logical. If TRUE (the default) the resulting ACF, PACF or CCF is plotted.

na.action

function to handle missing values. Default is na.contiguous. Useful alternatives are na.pass and na.interp.

demean

Should covariances be about the sample means?

y

a univariate numeric time series object or a numeric vector.

calc.ci

If TRUE, confidence intervals for the ACF/PACF estimates are calculated.

level

Percentage level used for the confidence intervals.

nsim

The number of bootstrap samples used in estimating the confidence intervals.

Details

If autoplot is given an acf or mpacf object, then an appropriate ggplot object will be created.

ggtaperedpacf

Value

A ggplot object.

Author(s)

Mitchell O'Hara-Wild

See Also

Examples

library(ggplot2)
ggAcf(wineind)
wineind %>% Acf(plot=FALSE) %>% autoplot
## Not run: 
wineind %>% taperedacf(plot=FALSE) %>% autoplot
ggtaperedacf(wineind)
ggtaperedpacf(wineind)
## End(Not run)
ggCcf(mdeaths, fdeaths)

forecast

Forecasting Functions for Time Series and Linear Models

v8.14
GPL-3
Authors
Rob Hyndman [aut, cre, cph] (<https://orcid.org/0000-0002-2140-5352>), George Athanasopoulos [aut], Christoph Bergmeir [aut] (<https://orcid.org/0000-0002-3665-9021>), Gabriel Caceres [aut], Leanne Chhay [aut], Mitchell O'Hara-Wild [aut] (<https://orcid.org/0000-0001-6729-7695>), Fotios Petropoulos [aut] (<https://orcid.org/0000-0003-3039-4955>), Slava Razbash [aut], Earo Wang [aut], Farah Yasmeen [aut] (<https://orcid.org/0000-0002-1479-5401>), R Core Team [ctb, cph], Ross Ihaka [ctb, cph], Daniel Reid [ctb], David Shaub [ctb], Yuan Tang [ctb] (<https://orcid.org/0000-0001-5243-233X>), Zhenyu Zhou [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.