# IWTaov: Interval Wise Testing procedure for testing functional... In alessiapini/fdatest: Interval Wise Testing for Functional Data

## Description

The function implements the Interval Wise Testing procedure for testing mean differences between several functional populations in a one-way or multi-way functional analysis of variance framework. Functional data are tested locally and unadjusted and adjusted p-value functions are provided. The unadjusted p-value function controls the point-wise error rate. The adjusted p-value function controls the interval-wise error rate.

## Usage

 ```1 2``` ```IWTaov(formula, B = 1000, method = "residuals", dx = NULL, recycle = TRUE) ```

## Arguments

 `formula` An object of class "`formula`" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The output variable of the formula can be either a matrix of dimension `c(n,J)` collecting the pointwise evaluations of `n` functional data on the same grid of `J` points, or a `fd` object from the package `fda`. `B` The number of iterations of the MC algorithm to evaluate the p-values of the permutation tests. The defualt is `B=1000`. `method` Permutation method used to calculate the p-value of permutation tests. Choose "`residuals`" for the permutations of residuals under the reduced model, according to the Freedman and Lane scheme, and "`responses`" for the permutation of the responses, according to the Manly scheme. `dx` Used only if a `fd` object is provided. In this case, `dx` is the size of the discretization step of the grid used to evaluate functional data. If set to `NULL`, a grid of size 100 is used. Default is `NULL`. `recycle` Flag used to decide whether the recycled version of the IWT should be used (see Pini and Vantini, 2017 for details). Default is `TRUE`.

## Value

`IWTaov` returns an object of `class` "`IWTaov`". The function `summary` is used to obtain and print a summary of the results. An object of class "`IWTaov`" is a list containing at least the following components:

 `call` The matched call. `design_matrix` The design matrix of the functional-on-scalar linear model. `unadjusted_pval_F` Evaluation on a grid of the unadjusted p-value function of the functional F-test. `pval_matrix_F` Matrix of dimensions `c(p,p)` of the p-values of the intervalwise F-tests. The element `(i,j)` of matrix `pval.matrix` contains the p-value of the test of interval indexed by `(j,j+1,...,j+(p-i))`. `adjusted_pval_F` Evaluation on a grid of the adjusted p-value function of the functional F-test. `unadjusted_pval_factors` Evaluation on a grid of the unadjusted p-value function of the functional F-tests on each factor of the analysis of variance (rows). `pval.matrix.factors` Array of dimensions `c(L+1,p,p)` of the p-values of the multivariate F-tests on factors. The element `(l,i,j)` of array `pval.matrix` contains the p-value of the joint NPC test on factor `l` of the components `(j,j+1,...,j+(p-i))`. `adjusted.pval.factors` adjusted p-values of the functional F-tests on each factor of the analysis of variance (rows) and each basis coefficient (columns). `data.eval` Evaluation on a fine uniform grid of the functional data obtained through the basis expansion. `coeff.regr.eval` Evaluation on a fine uniform grid of the functional regression coefficients. `fitted.eval` Evaluation on a fine uniform grid of the fitted values of the functional regression. `residuals.eval` Evaluation on a fine uniform grid of the residuals of the functional regression. `R2.eval` Evaluation on a fine uniform grid of the functional R-squared of the regression. `heatmap.matrix.F` Heatmap matrix of p-values of functional F-test (used only for plots). `heatmap.matrix.factors` Heatmap matrix of p-values of functional F-tests on each factor of the analysis of variance (used only for plots).

## References

Pini, A., & Vantini, S. (2017). Interval-wise testing for functional data. Journal of Nonparametric Statistics, 29(2), 407-424

Pini, A., Vantini, S., Colosimo, B. M., & Grasso, M. (2018). Domain‐selective functional analysis of variance for supervised statistical profile monitoring of signal data. Journal of the Royal Statistical Society: Series C (Applied Statistics) 67(1), 55-81.

Abramowicz, K., Hager, C. K., Pini, A., Schelin, L., Sjostedt de Luna, S., & Vantini, S. (2018). Nonparametric inference for functional‐on‐scalar linear models applied to knee kinematic hop data after injury of the anterior cruciate ligament. Scandinavian Journal of Statistics 45(4), 1036-1061.

D. Freedman and D. Lane (1983). A Nonstochastic Interpretation of Reported Significance Levels. Journal of Business & Economic Statistics 1.4, 292-298.

B. F. J. Manly (2006). Randomization, Bootstrap and Monte Carlo Methods in Biology. Vol. 70. CRC Press.

See `summary.IWTaov` for summaries and `plot.IWTaov` for plotting the results. See `ITPaov` for a functional analysis of variance test based on B-spline basis expansion. See also `IWTlm` to fit and test a functional-on-scalar linear model applying the IWT, and `IWT1`, `IWT2` for one-population and two-population tests.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18``` ```# Importing the NASA temperatures data set data(NASAtemp) temperature <- rbind(NASAtemp\$milan,NASAtemp\$paris) groups <- c(rep(0,22),rep(1,22)) # Performing the IWT IWT.result <- IWTaov(temperature ~ groups,B=1000) # Summary of the ITP results summary(IWT.result) # Plot of the IWT results layout(1) plot(IWT.result) # All graphics on the same device layout(matrix(1:4,nrow=2,byrow=FALSE)) plot(IWT.result,main='NASA data', plot.adjpval = TRUE,xlab='Day',xrange=c(1,365)) ```