# fmanova.ptbfr: Permutation Tests Based on a Basis Function Representation... In fdANOVA: Analysis of Variance for Univariate and Multivariate Functional Data

## Description

Performs the permutation tests based on a basis function representation for multivariate analysis of variance for functional data, i.e., the W, LH, P and R tests. For details of the tests, see Section 2.2 of the vignette file (vignette("fdANOVA", package = "fdANOVA")).

We consider independent vectors of random functions

\mathbf{X}_{ij}(t)=(X_{ij1}(t),…,X_{ijp}(t))^{\top}\in SP_p(\boldsymbol{μ}_i,\mathbf{Γ}),

i=1,…,l, j=1,…,n_{i} defined over the interval I=[a,b], where SP_{p}(\boldsymbol{μ},\boldsymbol{Γ}) is a set of p-dimensional stochastic processes with mean vector \boldsymbol{μ}(t), t\in I and covariance function \boldsymbol{Γ}(s, t), s,t\in I. Let n=n_1+…+n_l. In the multivariate analysis of variance problem for functional data (FMANOVA), we have to test the null hypothesis as follows:

H_0:\boldsymbol{μ}_1(t)=…=\boldsymbol{μ}_l(t),\ t\in I.

The alternative is the negation of the null hypothesis. We assume that each functional observation is observed on a common grid of \mathcal{T} design time points equally spaced in I (see Section 3.1 of the vignette file, vignette("fdANOVA", package = "fdANOVA")).

## Usage

 1 2 3 4 5 6 7 fmanova.ptbfr(x = NULL, group.label, int, B = 1000, parallel = FALSE, nslaves = NULL, basis = c("Fourier", "b-spline", "own"), own.basis, own.cross.prod.mat, criterion = c("BIC", "eBIC", "AIC", "AICc", "NO"), commonK = c("mode", "min", "max", "mean"), minK = NULL, maxK = NULL, norder = 4, gamma.eBIC = 0.5) 

## Arguments

 x a list of \mathcal{T}\times n matrices of data, whose each column is a discretized version of a function and rows correspond to design time points. The mth element of this list contains the data of mth feature, m=1,…,p. Its default values is NULL, because a basis representation of the data can be given instead of raw observations (see the parameter own.basis below). group.label a vector containing group labels. int a vector of two elements representing the interval I=[a,b]. When it is not specified, it is determined by a number of design time points. B a number of permutation replicates. parallel a logical indicating whether to use parallelization. nslaves if parallel = TRUE, a number of slaves. Its default value means that it will be equal to a number of logical processes of a computer used. basis a choice of basis of functions used in the basis function representation of the data. own.basis if basis = "own", a list of length p, whose elements are K_m\times n matrices (m=1,…,p) with columns containing the coefficients of the basis function representation of the observations. own.cross.prod.mat if basis = "own", a KM\times KM cross product matrix corresponding to a basis used to obtain the list own.basis. criterion a choice of information criterion for selecting the optimum value of K_m, m=1,…,p. criterion = "NO" means that K_m are equal to the parameter maxK defined below. Further remarks about this argument are the same as for the function fanova.tests. commonK a choice of method for selecting the common value for all observations from the values of K_m corresponding to all processes. minK a minimum value of K_m. Further remarks about this argument are the same as for the function fanova.tests. maxK a maximum value of K_m. Further remarks about this argument are the same as for the function fanova.tests. norder if basis = "b-spline", an integer specifying the order of b-splines. gamma.eBIC a γ\in[0,1] parameter in the eBIC.

## Value

A list with class "fmanovaptbfr" containing the following components:

 W a value of the statistic W. pvalueW p-value for the W test. LH a value of the statistic LH. pvalueLH p-value for the LH test. P a value of the statistic P. pvalueP p-value for the P test. R a value of the statistic R. pvalueR p-value for the R test,

the values of parameters used and eventually

 data a list containing the data given in x. Km a vector (K_1,…,K_p). KM a maximum of a vector Km.

## Author(s)

Tomasz Gorecki, Lukasz Smaga

## References

Gorecki T, Smaga L (2015). A Comparison of Tests for the One-Way ANOVA Problem for Functional Data. Computational Statistics 30, 987-1010.

Gorecki T, Smaga L (2017). Multivariate Analysis of Variance for Functional Data. Journal of Applied Statistics 44, 2172-2189.

fanova.tests, fmanova.trp, plotFANOVA
  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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 # Some of the examples may run some time. # gait data (both features) library(fda) gait.data.frame <- as.data.frame(gait) x.gait <- vector("list", 2) x.gait[[1]] <- as.matrix(gait.data.frame[, 1:39]) x.gait[[2]] <- as.matrix(gait.data.frame[, 40:78]) # vector of group labels group.label.gait <- rep(1:3, each = 13) # the tests based on a basis function representation with default parameters set.seed(123) (fmanova1 <- fmanova.ptbfr(x.gait, group.label.gait)) summary(fmanova1) # the tests based on a basis function representation with non-default parameters set.seed(123) fmanova2 <- fmanova.ptbfr(x.gait, group.label.gait, int = c(0.025, 0.975), B = 5000, basis = "b-spline", criterion = "eBIC", commonK = "mean", minK = 5, maxK = 20, norder = 4, gamma.eBIC = 0.7) summary(fmanova2) # the tests based on a basis function representation # with predefined basis function representation library(fda) fbasis <- create.fourier.basis(c(0, nrow(x.gait[[1]])), 17) own.basis <- vector("list", 2) own.basis[[1]] <- Data2fd(1:nrow(x.gait[[1]]), x.gait[[1]], fbasis)$coefs own.basis[[2]] <- Data2fd(1:nrow(x.gait[[2]]), x.gait[[2]], fbasis)$coefs own.cross.prod.mat <- diag(rep(1, 17)) set.seed(123) fmanova3 <- fmanova.ptbfr(group.label = group.label.gait, B = 1000, basis = "own", own.basis = own.basis, own.cross.prod.mat = own.cross.prod.mat) summary(fmanova3) library(fda) fbasis <- create.bspline.basis(c(0, nrow(x.gait[[1]])), 20, norder = 4) own.basis <- vector("list", 2) own.basis[[1]] <- Data2fd(1:nrow(x.gait[[1]]), x.gait[[1]], fbasis)$coefs own.basis[[2]] <- Data2fd(1:nrow(x.gait[[2]]), x.gait[[2]], fbasis)$coefs own.cross.prod.mat <- inprod(fbasis, fbasis) set.seed(123) fmanova4 <- fmanova.ptbfr(group.label = group.label.gait, B = 1000, basis = "own", own.basis = own.basis, own.cross.prod.mat = own.cross.prod.mat) summary(fmanova4)