MyNixOS website logo
Description

Statistical Testing for Functional Data.

Implementation of two sample comparison procedures based on median-based statistical tests for functional data, introduced in Smida et al (2022) <doi:10.1080/10485252.2022.2064997>. Other competitive state-of-the-art approaches proposed by Chakraborty and Chaudhuri (2015) <doi:10.1093/biomet/asu072>, Horvath et al (2013) <doi:10.1111/j.1467-9868.2012.01032.x> or Cuevas et al (2004) <doi:10.1016/j.csda.2003.10.021> are also included in the package, as well as procedures to run test result comparisons and power analysis using simulations.

Statistical Testing for Functional Data

Website and Source code


The funStatTest package implements various statistics for two sample comparison testing regarding functional data introduced and used in Smida et al 2022 [1].

This package is developed by:

Installation

To install the funStatTest package, you can run:

install.packages("funStatTest")

You can also install the development version of funStatTest with the following command:

remotes::install_git("https://plmlab.math.cnrs.fr/gdurif/funStatTest")

Documentation

See the package vignette and function manuals for more details about the package usage.

Development

The funStatTest was developed using the fusen package [2]. See in the dev sub-directory in the package sources for more information, in particular:

  • the file dev/dev_history.Rmd describing the development process
  • the file dev/flat_package.Rmd defining the major package functions (from which the vignette is extracted)
  • the file dev/flat_internal.Rmd defining package internal functions

The funStatTest website was generated using the pkgdown package [3].

Example

This is a basic example which shows you how to solve a common problem:

library(funStatTest)

Data simulation

We simulate two samples of trajectories diverging by a delta function.

simu_data <- simul_data(
    n_point = 100, n_obs1 = 50, n_obs2 = 75, c_val = 10, 
    delta_shape = "quadratic", distrib = "normal"
)

plot_simu(simu_data)

We extract the matrices of trajectories associated to each sample:

MatX <- simu_data$mat_sample1
MatY <- simu_data$mat_sample2

And we compute the different statistics for two sample function data comparison presented in Smida et al 2022 [1]:

res <- comp_stat(MatX, MatY, stat = c("mo", "med", "wmw", "hkr", "cff"))
res
#> $mo
#> [1] 0.9486241
#> 
#> $med
#> [1] 0.9517283
#> 
#> $wmw
#> [1] 0.9074959
#> 
#> $hkr
#>         [,1]
#> T1 31987.663
#> T2  8489.875
#> 
#> $cff
#> [1] 14150.96

We can also compute p-values associated to these statistics:

# small data for the example
simu_data <- simul_data(
    n_point = 20, n_obs1 = 4, n_obs2 = 5, c_val = 10, 
    delta_shape = "constant", distrib = "normal"
)

MatX <- simu_data$mat_sample1
MatY <- simu_data$mat_sample2

res <- permut_pval(
    MatX, MatY, n_perm = 200, stat = c("mo", "med", "wmw", "hkr", "cff"), 
    verbose = TRUE)
res
#> $mo
#> [1] 0.01492537
#> 
#> $med
#> [1] 0.0199005
#> 
#> $wmw
#> [1] 0.01492537
#> 
#> $hkr
#>          T1          T2 
#> 0.014925373 0.009950249 
#> 
#> $cff
#> [1] 0.009950249

:warning: computing p-values based on permutations may take some time (for large data or when using a large number of simulations. :warning:

And we can also run a simulation-based power analysis:

# simulate a few small data for the example
res <- power_exp(
    n_simu = 20, alpha = 0.05, n_perm = 200, 
    stat = c("mo", "med", "wmw", "hkr", "cff"), 
    n_point = 25, n_obs1 = 4, n_obs2 = 5, c_val = 10, delta_shape = "constant", 
    distrib = "normal", max_iter = 10000, verbose = FALSE
)
res$power_res
#> $mo
#> [1] 1
#> 
#> $med
#> [1] 1
#> 
#> $wmw
#> [1] 1
#> 
#> $hkr
#> T1 T2 
#>  1  1 
#> 
#> $cff
#> [1] 1

References

1. Smida, Z, Cucala, L, Gannoun, A, and Durif, G 2022 A median test for functional data. Journal of Nonparametric Statistics, 34(2): 520–553. DOI: https://doi.org/10.1080/10485252.2022.2064997

2. Rochette, S 2022 Fusen: Build a package from rmarkdown files. URL https://CRAN.R-project.org/package=fusen></span

3. Wickham, H, Hesselberth, J, and Salmon, M 2022 Pkgdown: Make static HTML documentation for a package. URL https://CRAN.R-project.org/package=pkgdown></span.

Metadata

Version

1.0.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows