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

stsm_detect_trend

Detect trend type


Description

Detect trend type

Usage

stsm_detect_trend(
  y,
  freq,
  decomp = "",
  sig_level = 0.01,
  prior = NULL,
  seasons = NULL,
  cycle = NULL
)

Arguments

y

Univariate time series of data values. May also be a 2 column data frame containing a date column.

freq

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

decomp

Decomposition model ("tend-cycle-seasonal", "trend-seasonal", "trend-cycle", "trend-noise")

sig_level

Significance level to determine statistically significant seasonal frequencies

prior

A data table created by stsm_prior

seasons

The seasonal periods

cycle

The cycle period

Value

list with trend type and logical flag for deterministic trend if the trend is determined to have 0 differencing

Examples

## 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", ]
trend = stsm_detect_trend(y = NA000334Q$y, freq = 4)

## End(Not run)

autostsm

Automatic Structural Time Series Models

v1.3
GPL (>= 2)
Authors
Alex Hubbard
Initial release
2021-05-01

We don't support your browser anymore

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