fmanova.ptbfr {fdANOVA} | R Documentation |
Permutation Tests Based on a Basis Function Representation for FMANOVA Problem
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),\dots,X_{ijp}(t))^{\top}\in SP_p(\boldsymbol{\mu}_i,\mathbf{\Gamma}),
i=1,\dots,l,
j=1,\dots,n_{i}
defined over the interval I=[a,b]
, where SP_{p}(\boldsymbol{\mu},\boldsymbol{\Gamma})
is a set of p
-dimensional stochastic processes with mean vector \boldsymbol{\mu}(t)
, t\in I
and covariance function \boldsymbol{\Gamma}(s, t)
, s,t\in I
. Let n=n_1+\dots+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{\mu}_1(t)=\dots=\boldsymbol{\mu}_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
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 |
group.label |
a vector containing group labels. |
int |
a vector of two elements representing the interval |
B |
a number of permutation replicates. |
parallel |
a logical indicating whether to use parallelization. |
nslaves |
if |
basis |
a choice of basis of functions used in the basis function representation of the data. |
own.basis |
if |
own.cross.prod.mat |
if |
criterion |
a choice of information criterion for selecting the optimum value of |
commonK |
a choice of method for selecting the common value for all observations from the values of |
minK |
a minimum value of |
maxK |
a maximum value of |
norder |
if |
gamma.eBIC |
a |
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 |
Km |
a vector |
KM |
a maximum of a vector |
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.
See Also
fanova.tests
, fmanova.trp
, plotFANOVA
Examples
# 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)