R/bootstrap_spearman_inference.R
BCIntervalSpearmanMultivariate.Rd
This function computes the bootstrap confidence intervals of coverage probability \(1 - \alpha\) for the Spearman correlation coefficients within a multivariate functional dataset.
BCIntervalSpearmanMultivariate(
mfD,
ordering = "MEI",
bootstrap_iterations = 1000,
alpha = 0.05,
verbose = FALSE
)
is the multivariate functional sample in form of mfData
object.
is either MEI
(default) or MHI
, and indicates the ordering relation
to be used during in the Spearman's coefficient computation.
is the number of bootstrap iterations to use in order to estimate the confidence intervals (default is 1000).
controls the coverage probability (1-alpha
).
whether to log information on the progression of bootstrap iterations.
The function returns a list of two elements, lower
and upper
, representing
the matrices of lower and upper ends of the bootstrap confidence intervals for each pair of
components. The elements on the main diagonal are set to 1.
The function takes a multivariate functional dataset and computes a matrix of bootstrap confidence intervals for its Spearman correlation coefficients.
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 = N,
centerline = sin(2 * pi * grid),
Cov = Cov
)
Data_2 <- generate_gauss_fdata(
N = N,
centerline = sin(4 * pi * grid),
Cov = Cov
)
Data_3 <- generate_gauss_fdata(
N = N,
centerline = sin(6 * pi * grid),
Cov = Cov
)
# Using the simulated data as (independent) components of a multivariate functional dataset
mfD <- mfData(grid, list(Data_1, Data_2, Data_3))
# \donttest{
BCIntervalSpearmanMultivariate(mfD, ordering = "MEI")
#> $lower
#> [,1] [,2] [,3]
#> [1,] 1.00000000 -0.09398461 -0.2570364
#> [2,] -0.09398461 1.00000000 -0.3056464
#> [3,] -0.25703636 -0.30564645 1.0000000
#>
#> $upper
#> [,1] [,2] [,3]
#> [1,] 1.00000000 0.15779563 0.02262386
#> [2,] 0.15779563 1.00000000 -0.02878122
#> [3,] 0.02262386 -0.02878122 1.00000000
#>
# }
# BC intervals contain zero since the functional samples are uncorrelated.