This function performs diagnostics on a numeric time series (e.g., rate difference) to evaluate whether ARIMA modeling is appropriate. It runs tests for autocorrelation (Ljung-Box), trend presence, and stationarity (ADF & KPSS), and gives modeling recommendations. Optional visualizations include line plot, ACF/PACF, and STL decomposition.
check_rate_diff_arima_ready(
rate_diff_vec,
date_vec = NULL,
frequency = 52,
plot_acf = TRUE,
do_stl = TRUE,
verbose = TRUE,
max_lag_acf = min(3 * frequency, floor(length(rate_diff_vec)/4))
)A list containing:
The cleaned numeric time series
Overall diagnostic and modeling recommendation
ADF test result (stationarity)
KPSS test result (stationarity)
Optional ggplot objects (e.g., time series plot)
Summary of stationarity status and differencing recommendation
Numeric vector of rate differences. / Numerischer Vektor (z.B. Rate)
Optional. Corresponding date vector (used for plotting). / Optionaler Datumsvektor
Time series frequency (e.g., 52 for weekly). Default is 52. / Frequenz der Zeitreihe
Logical. Whether to compute and plot ACF/PACF. Default is TRUE. / ACF/PACF anzeigen?
Logical. Whether to perform and plot STL decomposition. Default is TRUE. / STL-Dekomposition durchfuehren?
Whether to print standardization info /Ob Statusinformationen ausgegeben werden sollen
Max lag to use for ACF plots. Default is min(3 * frequency, floor(length(rate_diff_vec) / 4)). / Max. Verzoegerung fuer ACF
Diese Funktion prueft, ob eine Zeitreihe (z.B. Differenz von Raten) fuer ARIMA-Modelle geeignet ist. Sie fuehrt Autokorrelationspruefung (Ljung-Box), Trendtest, sowie Stationaritaetstests (ADF & KPSS) durch und gibt Modellierungsempfehlungen. Optional werden Zeitreihengrafiken wie Linienplot, ACF/PACF und STL-Dekomposition erstellt.
vec <- c(NA, rnorm(60, 0.1, 1))
check_rate_diff_arima_ready(vec, frequency = 12)
Run the code above in your browser using DataLab