ggts_decomp: Generate Time Series Decompression ggplot facet

Description Usage Arguments Value See Also Examples

View source: R/ggts_climate.R

Description

Generates from stlplus() output list components $Data and $time a ggplot facet_wrap output over time for "raw" (=original data), "seasonal", "trend" and "remainder" components.

Usage

1

Arguments

data

stlplus() output list.

...

Other arguments.

Value

plot object of mode 'plot

See Also

uts_stlplus_as_tibble and stlplus::stlplus

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
require(stlplus)
require(fpp3)
economics_tsbl <- ggplot2::economics %>%
 mutate(Year_Month = yearmonth(date)) %>%
 as_tsibble(index = Year_Month)
economics_tsbl %>% has_gaps() # check for time series gaps, fill with fill_gaps()
start_ts <- c(year(min(as.Date(economics_tsbl$Year_Month))),
  month(min(as.Date(economics_tsbl$Year_Month))))

# convert to time-series object
economics_ts <- ts(economics_tsbl$uempmed, start = start_ts, frequency = 12)
# convert to tibble object
economics_stlplus <- stlplus(economics_ts, s.window = 27, t.window = 1201)
#
ggts_decomp(uts_stlplus_as_tibble(economics_stlplus))

economics_stlplus <- stlplus(economics_ts, s.window = "per", t.window = 1201)
ggts_decomp(uts_stlplus_as_tibble(economics_stlplus))

WoVollmer/pkgTS documentation built on June 2, 2021, 4:02 a.m.