cor_spearman_accuracy: Bootstrap Spearman's correlation coefficient for multivariate...

Description Usage Arguments Details Value See Also Examples

View source: R/correlation.R

Description

This function computes the bootstrap estimates of standard error and bias of the Spearman's correlation coefficient for a multivariate functional dataset.

Usage

1
2
3
4
5
6
cor_spearman_accuracy(
  mfD,
  ordering = "MEI",
  bootstrap_iterations = 1000,
  verbose = FALSE
)

Arguments

mfD

a multivariate functional dataset whose Spearman's correlation coefficient must be computed, in form of multivariate mfData object.

ordering

the ordering relation to use on functional observations, either "MEI" for MEI or "MHI" for MHI (default is "MEI").

bootstrap_iterations

the number of bootstrap iterations to be used for estimation of bias and standard error.

verbose

a logical flag specifying whether to log information on the estimation progress.

Details

Given a multivariate functional dataset X_1^(i), …, X_n^(i), i=0, …, L defined over the grid I = t_0, …, t_P, having components i=1, …, L, and a chosen ordering strategy (MEI or MHI), the function computes the matrix of Spearman's correlation indices of the dataset components, as well as their bias and standard deviation estimates through a specified number of bootstrap iterations (bias and standard error are updated with on-line formulas).

Value

a list of three elements: mean, the mean of the matrix of correlation coefficients; bias, a matrix containing the estimated bias (mean - point estimate of correlation coefficients); sd, a matrix containing the estimated standard deviation of the coefficients' matrix. In case the multivariate functional dataset has only two components, the return type is scalar and not matrix.

See Also

cor_spearman, mfData

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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(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))


# Computes bootstrap estimate of Spearman correlation
cor_spearman_accuracy(mfD, ordering = "MEI")
cor_spearman_accuracy(mfD, ordering = "MHI")

roahd documentation built on Nov. 4, 2021, 1:07 a.m.