View source: R/utils-log-trans-stationary.R
util_log_ts | R Documentation |
This function attempts to make a non-stationary time series stationary by applying a logarithmic transformation. If successful, it returns the stationary time series. If the transformation fails, it informs the user.
util_log_ts(.time_series)
.time_series |
A time series object to be made stationary. |
This function checks if the minimum value of the input time series is greater than or equal to zero. If yes, it performs the Augmented Dickey-Fuller test on the logarithm of the time series. If the p-value of the test is less than 0.05, it concludes that the logarithmic transformation made the time series stationary and returns the result as a list with the following elements:
stationary_ts: The stationary time series after the logarithmic transformation.
ndiffs: Not applicable in this case, marked as NA.
adf_stats: Augmented Dickey-Fuller test statistics on the stationary time series.
trans_type: Transformation type, which is "log" in this case.
ret: TRUE to indicate a successful transformation.
If the minimum value of the time series is less than or equal to 0 or if the logarithmic transformation doesn't make the time series stationary, it informs the user and returns a list with ret set to FALSE.
If the time series is already stationary or the logarithmic transformation is successful, it returns a list as described in the details section. If the transformation fails, it returns a list with ret set to FALSE.
Steven P. Sanderson II, MPH
Other Utility:
auto_stationarize()
,
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_singlediff_ts()
# Example 1: Using a time series dataset
util_log_ts(AirPassengers)
# Example 2: Using a different time series dataset
util_log_ts(BJsales.lead)$ret
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.