ljung box test for white noise

ljung_box(
  x,
  p = 0,
  q = 0,
  k_val = c(24, 48),
  model_name = "My Model",
  alpha = 0.05
)

Arguments

x

the time series

p

the ar order (Default = 0)

q

the ma order (Default = 0)

k_val

a vector of k values

model_name

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

alpha

Significance level to be used for ljung_box tests

Value

the results of the tests, in tidy data format

Examples

library(tswge) # Generated White Noise wn = gen.arma.wge(n = 200, sn = 101)
ljung_box(wn)
#> 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) ljung_box(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