Learn R Programming

autostsm (version 1.1)

stsm_detect_seasonality: Detect seasonality from the data

Description

Detect seasonality from the data

Usage

stsm_detect_seasonality(
  y,
  freq,
  sig_level = 1e-04,
  prior = NULL,
  full = F,
  spectrum = NULL
)

Arguments

y

Univariate time series of data values.

freq

Frequency of the data (1 (yearly), 4 (quarterly), 12 (monthly), 365.25/7 (weekly), 365.25 (daily))

sig_level

Significance level to determine statistically significant seasonal frequencies

prior

A data table created from stsm_prior

full

Whether to check for full spectrum of seasonality rather than weekly and yearly suggestion

spectrum,

Vector of seasonal periods to check

Value

Numeric vector of seasonal periodicities

Examples

Run this code
# NOT RUN {
#GDP Not seasonally adjusted
library(autostsm)
data("NA000334Q", package = "autostsm") #From FRED
NA000334Q = data.table(NA000334Q, keep.rownames = TRUE)
colnames(NA000334Q) = c("date", "y")
NA000334Q[, "date" := as.Date(date)]
NA000334Q[, "y" := as.numeric(y)]
NA000334Q = NA000334Q[date >= "1990-01-01", ]
seasonality = stsm_detect_seasonality(y = NA000334Q$y, freq = 4)
# }

Run the code above in your browser using DataLab