R/TS_cibbb_tuples.R

Defines functions TS_cibbb_tuples

Documented in TS_cibbb_tuples

#' Circular index-based block bootstrap for tuples
#'
#' @description This internal function creates the bivariate pairs of
#'     indices needed in order for the circular index-based block
#'     bootstrap for tuples to be used in the computations
#'
#' @param .indices The initial vector of (resampled) indices.
#'
#' @param .lag The lag-value that should be used.
#'
#' @return This helper function returns a list with two vectors, one
#'     named \code{first} and one named \code{second}.  These are the
#'     indices needed for the circular index-based block bootstrap for
#'     tuples.
#'
#' @keywords internal

TS_cibbb_tuples <- function(.indices, .lag) {
    .n <- length(.indices)
    ##  Note: The subsetting used in the local Gaussian spectra-papers
    ##  implies that the first subsetting shoud be with regard to 't'
    ##  and the the second subsetting with regard to 't+h'.
    .second <- head(x = .indices, n = .n - .lag)
    .tmp <- .second + .lag
    .first <- .tmp  - .n * floor((.tmp - 1)/.n)
    return(list(first = .first,
                second = .second))
}
LAJordanger/localgaussSpec documentation built on May 6, 2023, 4:31 a.m.