This function computes the bootstrap confidence interval of coverage probability \(1 - \alpha\) for the Spearman correlation coefficient between two univariate functional samples.

BCIntervalSpearman(
  fD1,
  fD2,
  ordering = "MEI",
  bootstrap_iterations = 1000,
  alpha = 0.05,
  verbose = FALSE
)

Arguments

fD1

is the first univariate functional sample in form of an fData object.

fD2

is the first univariate functional sample in form of an fData object.

ordering

is either MEI (default) or MHI, and indicates the ordering relation to be used during in the Spearman's coefficient computation.

bootstrap_iterations

is the number of bootstrap iterations to use in order to estimate the confidence interval (default is 1000).

alpha

controls the coverage probability (1-alpha).

verbose

whether to log information on the progression of bootstrap iterations.

Value

The function returns a list of two elements, lower and upper, representing the lower and upper end of the bootstrap confidence interval.

Details

The function takes two samples of compatible functional data (i.e., they must be defined over the same grid and have same number of observations) and computes a bootstrap confidence interval for their Spearman correlation coefficient.

Examples

set.seed(1)

N <- 200
P <- 100

grid <- seq(0, 1, length.out = P)

# Creating an exponential covariance function to simulate Gaussian data
Cov <- exp_cov_function(grid, alpha = 0.3, beta = 0.4)

# Simulating (independent) Gaussian functional data with given center and covariance function
Data_1 <- generate_gauss_fdata( N, centerline = sin( 2 * pi * grid ), Cov = Cov )
Data_2 <- generate_gauss_fdata(
  N = N,
  centerline = sin(2 * pi * grid),
  Cov = Cov
)

# Using the simulated data as (independent) components of a bivariate functional dataset
mfD <- mfData(grid, list(Data_1, Data_2))

# \donttest{
BCIntervalSpearman(mfD$fDList[[1]], mfD$fDList[[2]], ordering = "MEI")
#> $lower
#> [1] -0.0931294
#> 
#> $upper
#> [1] 0.1572917
#> 
BCIntervalSpearman(mfD$fDList[[1]], mfD$fDList[[2]], ordering = "MHI")
#> $lower
#> [1] -0.08746248
#> 
#> $upper
#> [1] 0.1626766
#> 
# }

# BC intervals contain zero since the functional samples are uncorrelated.