Formula: \(Q = n \sum_{k=1}^{m} r_k^2\), chi-square on
lags - fitdf degrees of freedom. This is the uncorrected
portmanteau statistic; Ljungbox applies the small-sample
variance correction to the same sum.
References
Box and Pierce (1970), JASA 65:1509-1526. Paywalled; the statistic was taken from R's stats::Box.test, which codes the Box-Pierce branch as n*sum(obs^2).
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Boxpierce(V)
#> $statistic
#> [1] 3.125
#>
#> $p_value
#> [1] 0.07709987
#>
#> $df
#> [1] 1
#>
#> $acf
#> [1] 0.625
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "Box-Pierce Q test"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
