get_periodogram: Get an object of class "spec"

Description Usage Arguments Details Value Examples

View source: R/HELPER_get_periodogram.R

Description

get_periodogram is a function to get an object of class "spec" for a univariate time series.

Usage

1
get_periodogram(ts_object, type = c("additive", "multiplicative"))

Arguments

ts_object

A univariate time series.

type

A character string indicating whether an additive or multiplicative seasonal component should be used to create the periodogram.

Details

The function will, for a univariate time series, compute the periodogram and returns an object of class "spec". Components of "spec" is shown in names(sp). In this package, components of "freq" and "spec" is utilised.

Value

sp: an object of class "spec". We mainly use freq and spec components of sp. "freq" is Vector of frequencies at which the spectral density is estimated. "spec" is Vector of estimates of the periodogram at frequencies corresponding to freq.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
ts_object <- tstools::initialize_ts_forecast_data(
      data = dummy_gasprice,
      date_col = "year_month",
      col_of_interest = "gasprice",
      group_cols = c("state", "oil_company"),
      xreg_cols = c("spotprice", "gemprice")
   ) %>%
   dplyr::filter(grouping == "state = New York   &   oil_company = CompanyB") %>%
   dplyr::select(period, col_of_interest, grouping) %>%
   tstools::transform_data_to_ts_object(seasonal_periods = 1)
get_periodogram(ts_object)

ing-bank/tsforecast documentation built on Sept. 18, 2020, 9:40 a.m.