Evaluate if the dats is consistent with white noise

evaluate_residuals(
  x,
  p = 0,
  q = 0,
  k_val = c(24, 48),
  alpha = 0.05,
  lag.max = 50,
  model_name = "My Model"
)

Arguments

x

the time series

p

the ar order (Default = 0)

q

the ma order (Default = 0)

k_val

a vector of k values for ljung_box test

alpha

Significance level to be used for ljung_box tests

lag.max

Value of lags to plot for the ACF (Default: 50)

model_name

Model name or identifier (Default: "My Model")

Value

the results of the tests, in tidy data format

Examples

library(tswge)
#> Warning: package 'tswge' was built under R version 3.5.3
# Generated White Noise wn = gen.arma.wge(n = 200, sn = 101)
evaluate_residuals(wn)
#> Loading required namespace: ggfortify
#> Loading required namespace: patchwork
#> None of the 'ljung_box' tests rejected the null hypothesis that the data is consistent with white noise at an significance level of 0.05
#> # A tibble: 2 x 7 #> test K chi.square df pval Model Decision #> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <chr> #> 1 Ljung-Box test 24 19.6 24 0.719 My Model FTR NULL #> 2 Ljung-Box test 48 41.2 48 0.747 My Model FTR NULL
# Not White Noise data(hadley) evaluate_residuals(hadley)
#> At least one of the 'ljung_box' tests rejected the null hypothesis that the data is consistent with white noise at an significance level of 0.05
#> # A tibble: 2 x 7 #> test K chi.square df pval Model Decision #> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <chr> #> 1 Ljung-Box test 24 1315. 24 0 My Model REJECT NULL #> 2 Ljung-Box test 48 1469. 48 0 My Model REJECT NULL