Package 'energymethod'

Title: Two-Sample Test of many Functional Means using the Energy Method
Description: Given two samples of size n_1 and n_2 from a data set where each sample consists of K functional observations (channels), each recorded on T grid points, the function energy method implements a hypothesis test of equality of channel-wise mean at each channel using the bootstrapped distribution of maximum energy to control family wise error. The function energy_method_complex accomodates complex valued functional observations.
Authors: David Colin Decker [aut, cre]
Maintainer: David Colin Decker <[email protected]>
License: GPL-3
Version: 1.1
Built: 2026-05-20 08:33:11 UTC
Source: https://github.com/cran/energymethod

Help Index


Implements the two sample paired or independent energy method

Description

This function takes two samples of high-dimensional functional data, implements the energy method, and returns a p-value for the global test of equality of mean and a channel-wise p-value for each functional coordinate.

Usage

energy_method(sample_1, sample_2, num_bootstrap_reps, seed, type)

Arguments

sample_1

A three dimensional array with dimension attribute (K,T,n_1) where K is the number of channels, T is the number of functional recordings, and n_1 is the sample size.

sample_2

A three dimensional array with dimension attribute (K,T,n_1) where K is the number of channels, T is the number of functional recordings, and n_2 is the sample size.

num_bootstrap_reps

A number. The number of bootstrap resamples to use when implementing the test

seed

A number. The seed used for randomness in bootstrap procedure

type

A sting. Either "paired" or "independent""

Value

A list containg the p-values of the test for the global hypothesis and channel-wise hypotheses, as well as summary information about the samples.

Author(s)

David Colin Decker

References

Article on energy method forthcoming

Examples

K=10
T=100
n_1=10
n_2=20
sample_1 = array(rnorm (K*T*n_1), dim=c(K, T, n_1))
sample_2 = array(rnorm (K*T*n_2), dim=c(K, T, n_2))
energy_method(sample_1, sample_2, num_bootstrap_reps=1000, seed=123, type="independent")

Implements the two sample paired or independent energy method

Description

This function takes two samples of complex-valued high-dimensional functional data, implements the energy method, and returns a p-value for the global test of equality of mean and a channel-wise p-value for each functional coordinate.

Usage

energy_method_complex(sample_1, sample_2, num_bootstrap_reps, seed, type)

Arguments

sample_1

A three dimensional complex array with dimension attribute (K,T,n_1) where K is the number of channels, T is the number of functional recordings, and n_1 is the sample size.

sample_2

A three dimensional complex array with dimension attribute (K,T,n_1) where K is the number of channels, T is the number of functional recordings, and n_2 is the sample size.

num_bootstrap_reps

A number. The number of bootstrap resamples to use when implementing the test

seed

A number. The seed used for randomness in bootstrap procedure

type

A sting. Either "paired" or "independent""

Value

A list containg the p-values of the test for the global hypothesis and channel-wise hypotheses, as well as summary information about the samples.

Author(s)

David Colin Decker

References

Article on energy method forthcoming

Examples

K=10
T=100
n_1=10
n_2=20
  sample_1_real=array(rnorm(K*T*n_1), dim=c(K,T,n_1))
  sample_1_complex=array(rnorm(K*T*n_1), dim=c(K,T,n_1))
  
  sample_1<-array(complex(real=sample_1_real, imaginary=sample_1_complex), dim=c(K,T,n_1))
  
  sample_2_real=array(rnorm(K*T*n_2), dim=c(K,T,n_2))
  sample_2_complex=array(rnorm(K*T*n_2), dim=c(K,T,n_2))
  
  sample_2<-array(complex(real=sample_2_real, imaginary=sample_2_complex), dim=c(K,T,n_2))
energy_method_complex(sample_1, sample_2, num_bootstrap_reps=1000, seed=123, type="independent")

Energy Method

Description

Given two samples from a multi-channel functional distribtution, this package implements the energy method to perform a test of equality of mean. It returns channel-wise p-values and the global p-value.

Author(s)

David Colin Decker [email protected]