auto_stationarize: Automatically Stationarize Time Series Data

View source: R/utils-auto-stationarize.R

auto_stationarizeR Documentation

Automatically Stationarize Time Series Data

Description

This function attempts to make a non-stationary time series stationary. This function attempts to make a given time series stationary by applying transformations such as differencing or logarithmic transformation. If the time series is already stationary, it returns the original time series.

Usage

auto_stationarize(.time_series)

Arguments

.time_series

A time series object to be made stationary.

Details

If the input time series is non-stationary (determined by the Augmented Dickey-Fuller test), this function will try to make it stationary by applying a series of transformations:

  1. It checks if the time series is already stationary using the Augmented Dickey-Fuller test.

  2. If not stationary, it attempts a logarithmic transformation.

  3. If the logarithmic transformation doesn't work, it applies differencing.

Value

If the time series is already stationary, it returns the original time series. If a transformation is applied to make it stationary, it returns a list with two elements:

  • stationary_ts: The stationary time series.

  • ndiffs: The order of differencing applied to make it stationary.

Author(s)

Steven P. Sanderson II, MPH

See Also

Other Utility: calibrate_and_plot(), internal_ts_backward_event_tbl(), internal_ts_both_event_tbl(), internal_ts_forward_event_tbl(), model_extraction_helper(), ts_get_date_columns(), ts_info_tbl(), ts_is_date_class(), ts_lag_correlation(), ts_model_auto_tune(), ts_model_compare(), ts_model_rank_tbl(), ts_model_spec_tune_template(), ts_qq_plot(), ts_scedacity_scatter_plot(), ts_to_tbl(), util_difflog_ts(), util_doublediff_ts(), util_doubledifflog_ts(), util_log_ts(), util_singlediff_ts()

Examples

# Example 1: Using the AirPassengers dataset
auto_stationarize(AirPassengers)

# Example 2: Using the BJsales dataset
auto_stationarize(BJsales)


healthyR.ts documentation built on Nov. 15, 2023, 9:07 a.m.