The function `tsexplore` generates statistics, various tests, and graphs regarding the location, deviation, distribution of a time series.
tsexplore(
x,
show.plot = TRUE,
x.name = NULL,
mu = 0,
adf.lag = 0,
lag.max = 8,
...
)# S3 method for tsexplore
plot(
x,
trend = c("linear", "smooth", "none"),
histbin = 15,
lwidth = 0.7,
pwidth = 0.7,
x.col = "darkgrey",
extra.col = "red",
plot.incl = c("all", "line", "hist", "box", "qq", "acf", "pacf"),
...
)
# S3 method for tsexplore
print(
x,
digits = max(3L, getOption("digits") - 3L),
stats.incl = c("all", "stats", "var", "qtls", "acf", "tests"),
...
)
An object of class "tsexplore" with following components:
original series data
list of time in which the series values were observed.
time gap between the series and forecasted values.
name of the time series for which forecasts was requested.
a list of statistics and test results conducted on the time series
a time series to be explored or a `tsexplore` object.
logical. If TRUE, all exploration charts will be displayed directly. Default is TRUE.
name of the series. If omitted here, the series name found by tsname() will be taken over here. If tsname() is NULL, the variable name will be used instead. Default is NULL.
test value specified under the null hypothesis of the t-test for the mean location. Default is 0.
number of AR lags included in the ADF test. Default is 0.
maximum lag at which to calculate the acf. Default is 8. Will be automatically limited to one less than the number of observations in the series. If the series has less than 8 observations.
parameter values that can affect the plots created for time series exploration.
a character string indicating whether and how the trend line should be fitted in the time series line plot. Available options are `linear`, `smooth`, `none`. Default is `linear`.
a numeric value to specify the number of bins in the histogram. Can be omitted. Default is 15.
line width of the series line plot. Default is 0.7.
size of the markers in the QQ plot. Default is 0.7.
line colour of the time series line plot. Default is `darkgrey`.
colour of extra information in the plots. Default is `red`.
time series components that should be plotted. Available options are `all` (default), `line` (line plot), `hist` (histogram), `box` (boxplot), `qq` (QQ plot), `acf` (ACF plot), and `pacf` (PACF plot). Ignored if show.plot = FALSE.
the number of significant digits.
time series statistics that should be printed. Available options are `all` (default), `stats` (statistics), `var` (variability), `qtls` (quantiles), `acf` (autocorrelation), and `tests` (tests).
The following statistics and test results are stored in the component `stats` of the `tsexplore` object:
statistics | n (number of observations), nvalid (number of valid observations), sum, mean, median, skewness, kurtosis, cv (coefficient of variation) | |
variability | variance, sd (standard deviation), range, iqr (interquartile range) | |
quantiles | minimum, q1 (1st quartile), median, q3 (3rd quartile), maximum | |
autocorrelation | acf (autocorrelation function), pacf (partial autocorrelation function) - from lag 0 (ACF) or lag 1 (PACF) until lag.max | |
tests | location (t-test), normality (Shapiro-Wilk-test), stationarity (ADF-test), independence (Ljung-Box-test) - each test contains the test statistics (statistics and the p-value (p.value)) |
Ka Yui Karl Wu
Hyndman, R. J., & Athanasopoulos, G. (2021). Forecasting: Principles and practice (3rd ed.). OTexts.
https://otexts.com/fpp3/
tsexplore(airport$Travellers, lag.max = 24, histbin = 10)
Run the code above in your browser using DataLab