seasplot: Seasonal plots with simplistic trend/season tests

View source: R/seasplot.R

seasplotR Documentation

Seasonal plots with simplistic trend/season tests

Description

Construct seasonal plots of various styles for a given time series. The series can automatically detrended as needed.

Usage

seasplot(
  y,
  m = NULL,
  s = NULL,
  trend = NULL,
  colour = NULL,
  alpha = 0.05,
  outplot = c(1, 0, 2, 3, 4, 5),
  decomposition = c("multiplicative", "additive", "auto"),
  cma = NULL,
  labels = NULL,
  ...
)

Arguments

y

input time series. Can be ts object.

m

seasonal period. If y is a ts object then the default is its frequency.

s

starting period in the season. If y is a ts object then this is picked up from y.

trend

if TRUE, then presence of trend is assumed and removed. If FALSE no trend is assumed. Use NULL to identify automatically.

colour

single colour override for plots.

alpha

significance level for statistical tests.

outplot

type of seasonal plot

  • 0: none.

  • 1: seasonal diagram.

  • 2: seasonal boxplots.

  • 3: seasonal subseries.

  • 4: seasonal distribution.

  • 5: seasonal density.

decomposition

type of seasonal decomposition. This can be "multiplicative", "additive" or "auto". If y contains non-positive values then this is forced to "additive".

cma

input precalculated level/trend for the analysis. This overrides trend=NULL.

labels

external labels for the seasonal periods. Use NULL for none. If length(labels) < m, then this input is ignored.

...

additional arguments passed to plotting functions. For example, use main="" to replace the title.

Value

An object of class seasexpl containing:

  • season: matrix of (detrended) seasonal elements.

  • season.exist: TRUE/FALSE results of seasonality test.

  • season.pval: p-value of seasonality test (Friedman test).

  • trend: CMA estimate (using cmav) or NULL if trend=FALSE.

  • trend.exist: TRUE/FALSE results of trend test.

  • trend.pval: p-value of trend test (Cox-Stuart).

  • decomposition: type of decomposition used.

Author(s)

Nikolaos Kourentzes, nikolaos@kourentzes.com.

Examples

seasplot(referrals,outplot=1)


tsutils documentation built on Nov. 15, 2023, 1:08 a.m.