Skip to contents

Calculates the number of samples to discard at the head and tail of a time series when applying ARIMA(p, d, q) filtering, in order to avoid boundary artifacts.

Usage

tr_overlap(d, p, q, split = F)

Arguments

d

An integer or vector. Differencing order(s). Typically 0, 1, or 2.

p

An integer or vector. Autoregressive order(s).

q

An integer or vector. Moving average order(s).

split

Logical (default: FALSE). If TRUE, returns a named vector of head and tail overlap lengths.

Value

If split = FALSE, a single numeric value indicating the total overlap length (Mh + Mt). If split = TRUE, a named numeric vector with components: Mh (head overlap) and Mt (tail overlap).

Details

The head overlap is given by Mh = max(d) + max(p) + floor(q / 2), and the tail overlap is Mt = floor(q / 2).

Examples

if (FALSE) { # \dontrun{
tr_overlap(d = 1, p = 500, q = 1000)
tr_overlap(d = 1, p = 500, q = 1000, split = TRUE)
} # }