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

tsdisplay

Time series display


Description

Plots a time series along with its acf and either its pacf, lagged scatterplot or spectrum.

Usage

ggtsdisplay(
  x,
  plot.type = c("partial", "histogram", "scatter", "spectrum"),
  points = TRUE,
  smooth = FALSE,
  lag.max,
  na.action = na.contiguous,
  theme = NULL,
  ...
)

tsdisplay(
  x,
  plot.type = c("partial", "histogram", "scatter", "spectrum"),
  points = TRUE,
  ci.type = c("white", "ma"),
  lag.max,
  na.action = na.contiguous,
  main = NULL,
  xlab = "",
  ylab = "",
  pch = 1,
  cex = 0.5,
  ...
)

Arguments

x

a numeric vector or time series of class ts.

plot.type

type of plot to include in lower right corner.

points

logical flag indicating whether to show the individual points or not in the time plot.

smooth

logical flag indicating whether to show a smooth loess curve superimposed on the time plot.

lag.max

the maximum lag to plot for the acf and pacf. A suitable value is selected by default if the argument is missing.

na.action

function to handle missing values in acf, pacf and spectrum calculations. The default is na.contiguous. Useful alternatives are na.pass and na.interp.

theme

Adds a ggplot element to each plot, typically a theme.

...

additional arguments to acf.

ci.type

type of confidence limits for ACF that is passed to acf. Should the confidence limits assume a white noise input or for lag k an MA(k-1) input?

main

Main title.

xlab

X-axis label.

ylab

Y-axis label.

pch

Plotting character.

cex

Character size.

Details

ggtsdisplay will produce the equivalent plot using ggplot graphics.

Value

None.

Author(s)

Rob J Hyndman

References

Hyndman and Athanasopoulos (2018) Forecasting: principles and practice, 2nd edition, OTexts: Melbourne, Australia. https://otexts.com/fpp2/

See Also

Examples

library(ggplot2)
ggtsdisplay(USAccDeaths, plot.type="scatter", theme=theme_bw())

tsdisplay(diff(WWWusage))
ggtsdisplay(USAccDeaths, plot.type="scatter")

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.