package ‘fdatest’ - r · 2015. 2. 19. · package ‘fdatest’ february 19, 2015 type package...

31
Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05 Depends fda Author Alessia Pini, Simone Vantini Maintainer Alessia Pini <[email protected]> Description Implementation of the Interval Testing Procedure for functional data in different frame- works (i.e., one or two-population frameworks, functional linear models) by means of differ- ent basis expansions (i.e., B-spline, Fourier, and phase-amplitude Fourier). The current ver- sion of the package requires functional data evaluated on a uniform grid; it automati- cally projects each function on a chosen functional basis; it performs the entire family of multi- variate tests; and, finally, it provides the matrix of the p-values of the previous tests and the vec- tor of the corrected p-values. The functional basis, the coupled or uncoupled sce- nario, and the kind of test can be chosen by the user. The package provides also a plotting func- tion creating a graphical output of the procedure: the p-value heat-map, the plot of the cor- rected p-values, and the plot of the functional data. License GPL-2 NeedsCompilation no Repository CRAN Date/Publication 2015-02-05 13:00:51 R topics documented: fdatest-package ....................................... 2 ITP1bspline ......................................... 4 ITP1fourier ......................................... 6 ITP2bspline ......................................... 7 ITP2fourier ......................................... 9 ITP2pafourier ........................................ 11 ITPaovbspline ........................................ 13 ITPimage .......................................... 16 1

Upload: others

Post on 17-Sep-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

Package ‘fdatest’February 19, 2015

Type Package

Title Interval Testing Procedure for Functional Data

Version 2.1

Date 2015-02-05

Depends fda

Author Alessia Pini, Simone Vantini

Maintainer Alessia Pini <[email protected]>

Description Implementation of the Interval Testing Procedure for functional data in different frame-works (i.e., one or two-population frameworks, functional linear models) by means of differ-ent basis expansions (i.e., B-spline, Fourier, and phase-amplitude Fourier). The current ver-sion of the package requires functional data evaluated on a uniform grid; it automati-cally projects each function on a chosen functional basis; it performs the entire family of multi-variate tests; and, finally, it provides the matrix of the p-values of the previous tests and the vec-tor of the corrected p-values. The functional basis, the coupled or uncoupled sce-nario, and the kind of test can be chosen by the user. The package provides also a plotting func-tion creating a graphical output of the procedure: the p-value heat-map, the plot of the cor-rected p-values, and the plot of the functional data.

License GPL-2

NeedsCompilation no

Repository CRAN

Date/Publication 2015-02-05 13:00:51

R topics documented:fdatest-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2ITP1bspline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4ITP1fourier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6ITP2bspline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7ITP2fourier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9ITP2pafourier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11ITPaovbspline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13ITPimage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

1

Page 2: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

2 fdatest-package

ITPlmbspline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17NASAtemp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20plot.ITP1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21plot.ITP2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22plot.ITPaov . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24plot.ITPlm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26summary.ITPaov . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28summary.ITPlm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

Index 31

fdatest-package Interval Testing Procedure for Functional Data

Description

Implementation of the Interval Testing Procedure for functional data in different frameworks (i.e.,one or two-population frameworks, functional linear models) by means of different basis expansions(i.e., B-spline, Fourier, and phase-amplitude Fourier). The current version of the package requiresfunctional data evaluated on a uniform grid; it automatically projects each function on a chosenfunctional basis; it performs the entire family of multivariate tests; and, finally, it provides thematrix of the p-values of the previous tests and the vector of the corrected p-values. The functionalbasis, the coupled or uncoupled scenario, and the kind of test can be chosen by the user. Thepackage provides also a plotting function creating a graphical output of the procedure: the p-valueheat-map, the plot of the corrected p-values, and the plot of the functional data.

Details

Package: fdatestType: PackageVersion: 2.1Date: 2015-02-05License: GPL-2

Author(s)

Alessia Pini, Simone Vantini

Maintainer: Alessia Pini <[email protected]>

References

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

Page 3: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

fdatest-package 3

K. Abramowicz, S. De Luna, C. Häger, A. Pini, L. Schelin, and S. Vantini (2015). Distribution-FreeInterval-Wise Inference for Functional-on-Scalar Linear Models. MOX-report 3/2015, Politecnicodi Milano.

See Also

See also ITP1bspline, ITP1fourier, ITP2bspline, ITP2fourier, ITP2pafourier, ITPlmbspline,ITPaovbspline, and ITPimage.

Examples

# Importing the NASA temperatures data setdata(NASAtemp)

# Example 1:# Performing the ITP for one population with the Fourier basisITP.result <- ITP1fourier(NASAtemp$milan,maxfrequency=10,B=1000)# Plotting the results of the ITPplot(ITP.result)

# Plotting the p-value heatmapITPimage(ITP.result)

# Selecting the significant coefficientswhich(ITP.result$corrected.pval < 0.05)

# Example 2:# Performing the ITP for two populations with the B-spline basisITP.result <- ITP2bspline(NASAtemp$milan,NASAtemp$paris,nknots=20,B=1000)# Plotting the results of the ITPplot(ITP.result)

# Plotting the p-values heatmapITPimage(ITP.result)

# Selecting the significant components for the radius at 5% levelwhich(ITP.result$corrected.pval < 0.05)

# Example 3:# Fitting and testing a functional-on-scalar linear model# Defining data and covariatestemperature <- rbind(NASAtemp$milan,NASAtemp$paris)groups <- c(rep(0,22),rep(1,22))

# Performing the ITPITP.result <- ITPlmbspline(temperature ~ groups,B=1000,nknots=20,order=3)# Summary of the ITP resultssummary(ITP.result)

# Plot of the ITP resultslayout(1)

Page 4: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

4 ITP1bspline

plot(ITP.result,main='NASA data', plot.adjpval = TRUE,xlab='Day',xrange=c(1,365))

# All graphics on the same devicelayout(matrix(1:6,nrow=3,byrow=FALSE))plot(ITP.result,main='NASA data', plot.adjpval = TRUE,xlab='Day',xrange=c(1,365))

ITP1bspline One population Interval Testing Procedure with B-spline basis

Description

The function implements the Interval Testing Procedure for testing the center of symmetry of afunctional population evaluated on a uniform grid. Data are represented by means of the B-splineexpansion and the significance of each basis coefficient is tested with an interval-wise control ofthe Family Wise Error Rate. The default parameters of the basis expansion lead to the piece-wiseinterpolating function.

Usage

ITP1bspline(data, mu = 0, order = 2, nknots = dim(data)[2], B = 10000)

Arguments

data Pointwise evaluations of the functional data set on a uniform grid. data is amatrix of dimensions c(n,J), with J evaluations on columns and n units onrows.

mu The center of symmetry under the null hypothesis: either a constant (in this case,a constant function is used) or a J-dimensional vector containing the evaluationson the same grid which data are evaluated. The default is mu=0.

order Order of the B-spline basis expansion. The default is order=2.

nknots Number of knots of the B-spline basis expansion. The default is nknots=dim(data)[2].

B The number of iterations of the MC algorithm to evaluate the p-values of thepermutation tests. The defualt is B=10000.

Value

ITP1bspline returns an object of class "ITP1".

An object of class "ITP1" is a list containing at least the following components:

basis String vector indicating the basis used for the first phase of the algorithm. In thiscase equal to "B-spline".

test String vector indicating the type of test performed. In this case equal to "1pop".

mu Center of symmetry under the null hypothesis (as entered by the user).

Page 5: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

ITP1bspline 5

coeff Matrix of dimensions c(n,p) of the p coefficients of the B-spline basis expan-sion. Rows are associated to units and columns to the basis index.

pval Uncorrected p-values for each basis coefficient.

pval.matrix Matrix of dimensions c(p,p) of the p-values of the multivariate tests. The ele-ment (i,j) of matrix pval.matrix contains the p-value of the joint NPC testof the components (j,j+1,...,j+(p-i)).

corrected.pval Corrected p-values for each basis coefficient.

labels Labels indicating the population membership of each data (in this case alwaysequal to 1).

data.eval Evaluation on a fine uniform grid of the functional data obtained through thebasis expansion.

heatmap.matrix Heatmap matrix of p-values (used only for plots).

Author(s)

Alessia Pini, Simone Vantini

References

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

See Also

See also ITP1fourier, ITP2bspline, ITP2fourier, ITP2pafourier, and ITPimage.

Examples

# Importing the NASA temperatures data setdata(NASAtemp)# Performing the ITP for two populations with the B-spline basisITP.result <- ITP1bspline(NASAtemp$paris,mu=4,nknots=50,B=1000)# Plotting the results of the ITPplot(ITP.result,xrange=c(0,12),main='Paris temperatures')

# Plotting the p-value heatmapITPimage(ITP.result,abscissa.range=c(0,12))

# Selecting the significant components for the radius at 5% levelwhich(ITP.result$corrected.pval < 0.05)

Page 6: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

6 ITP1fourier

ITP1fourier One population Interval Testing Procedure with Fourier basis

Description

The function implements the Interval Testing Procedure for testing the center of symmetry of afunctional population evaluated on a uniform grid. Data are represented by means of the Fourierexpansion and the significance of each basis coefficient is tested with an interval-wise control of theFamily Wise Error Rate.

Usage

ITP1fourier(data, mu = 0, maxfrequency=floor(dim(data)[2]/2), B = 10000)

Arguments

data Pointwise evaluations of the functional data set on a uniform grid. data is amatrix of dimensions c(n,J), with J evaluations on columns and n units onrows.

mu The center of symmetry under the null hypothesis: either a constant (in this case,a constant function is used) or a J-dimensional vector containing the evaluationson the same grid which data are evaluated. The default is mu=0.

maxfrequency The maximum frequency to be used in the Fourier basis expansion of data. Thedefault is floor(dim(data)[2]/2), leading to an interpolating expansion.

B The number of iterations of the MC algorithm to evaluate the p-values of thepermutation tests. The defualt is B=10000.

Value

ITP1fourier returns an object of class "ITP1".

An object of class "ITP1" is a list containing at least the following components:

basis String vector indicating the basis used for the first phase of the algorithm. In thiscase equal to "Fourier".

test String vector indicating the type of test performed. In this case equal to "1pop".

mu Center of symmetry under the null hypothesis (as entered by the user).

coeff Matrix of dimensions c(n,p) of the p coefficients of the Fourier basis expan-sion. Rows are associated to units and columns to the basis index: the firstcolumn is a0, the following (p-1)/2 columns are the ak coefficients (sine coef-ficients) and the last (p-1)/2 columns the bk coefficients (cosine coefficients).

pval Uncorrected p-values for each frequency.

pval.matrix Matrix of dimensions c(p,p) of the p-values of the multivariate tests. The ele-ment (i,j) of matrix pval.matrix contains the p-value of the joint NPC testof the components (j,j+1,...,j+(p-i)).

Page 7: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

ITP2bspline 7

corrected.pval Corrected p-values for each frequency.

labels Labels indicating the population membership of each data (in this case alwaysequal to 1).

data.eval Evaluation on a fine uniform grid of the functional data obtained through thebasis expansion.

heatmap.matrix Heatmap matrix of p-values (used only for plots).

Author(s)

Alessia Pini, Simone Vantini

References

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

See Also

See also ITP1bspline, ITP2bspline, ITP2fourier, ITP2pafourier, and ITPimage.

Examples

# Importing the NASA temperatures data setdata(NASAtemp)# Performing the ITPITP.result <- ITP1fourier(NASAtemp$milan,maxfrequency=20,B=1000)# Plotting the results of the ITPplot(ITP.result,main='NASA data',xrange=c(1,365),xlab='Day')

# Plotting the p-value heatmapITPimage(ITP.result,abscissa.range=c(1,365))

# Selecting the significant coefficientswhich(ITP.result$corrected.pval < 0.05)

ITP2bspline Two populations Interval Testing Procedure with B-spline basis

Description

The function implements the Interval Testing Procedure for testing the difference between twofunctional populations evaluated on a uniform grid. Data are represented by means of the B-splinebasis and the significance of each basis coefficient is tested with an interval-wise control of theFamily Wise Error Rate. The default parameters of the basis expansion lead to the piece-wiseinterpolating function.

Page 8: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

8 ITP2bspline

Usage

ITP2bspline(data1, data2, mu = 0,order = 2, nknots = dim(data1)[2], B = 10000, paired = FALSE)

Arguments

data1 Pointwise evaluations of the first population’s functional data set on a uniformgrid. data1 is a matrix of dimensions c(n1,J), with J evaluations on columnsand n1 units on rows.

data2 Pointwise evaluations of the second population’s functional data set on a uni-form grid. data2 is a matrix of dimensions c(n2,J), with J evaluations oncolumns and n2 units on rows.

mu The difference between the first functional population and the second functionalpopulation under the null hypothesis. Either a constant (in this case, a constantfunction is used) or a J-dimensional vector containing the evaluations on thesame grid which data are evaluated. The default is mu=0.

order Order of the B-spline basis expansion. The default is order=2.nknots Number of knots of the B-spline basis expansion. The default is nknots=dim(data1)[2].B The number of iterations of the MC algorithm to evaluate the p-values of the

permutation tests. The defualt is B=10000.paired A logical indicating whether the test is paired. The default is FALSE.

Value

ITP2bspline returns an object of class "ITP2".An object of class "ITP2" is a list containing at least the following components:

basis String vector indicating the basis used for the first phase of the algorithm. In thiscase equal to "B-spline".

test String vector indicating the type of test performed. In this case equal to "2pop".mu Difference between the first functional population and the second functional

population under the null hypothesis (as entered by the user).paired Logical indicating whether the test is paired (as entered by the user).coeff Matrix of dimensions c(n,p) of the p coefficients of the B-spline basis expan-

sion, with n=n1+n2. Rows are associated to units and columns to the basis index.The first n1 rows report the coefficients of the first population units and the fol-lowing n2 rows report the coefficients of the second population units

pval Uncorrected p-values for each basis coefficient.pval.matrix Matrix of dimensions c(p,p) of the p-values of the multivariate tests. The ele-

ment (i,j) of matrix pval.matrix contains the p-value of the joint NPC testof the components (j,j+1,...,j+(p-i)).

corrected.pval Corrected p-values for each basis coefficient.labels Labels indicating the population membership of each data.data.eval Evaluation on a fine uniform grid of the functional data obtained through the

basis expansion.heatmap.matrix Heatmap matrix of p-values (used only for plots).

Page 9: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

ITP2fourier 9

Author(s)

Alessia Pini, Simone Vantini

References

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

See Also

For tests of comparison between two populations, see ITP2fourier, ITP2pafourier. For differenttypes of ITP-based tests, see ITP1bspline, ITP1fourier, ITPlmbspline, ITPaovbspline andITPimage.

Examples

# Importing the NASA temperatures data setdata(NASAtemp)# Performing the ITPITP.result <- ITP2bspline(NASAtemp$milan,NASAtemp$paris,nknots=50,B=1000)

# Plotting the results of the ITPplot(ITP.result,main='NASA data',xrange=c(1,365),xlab='Day')

# Plotting the p-values heatmapITPimage(ITP.result,abscissa.range=c(0,12))

# Selecting the significant components at 5% levelwhich(ITP.result$corrected.pval < 0.05)

ITP2fourier Two populations Interval Testing Procedure with Fourier basis

Description

The function implements the Interval Testing Procedure for testing the difference between twofunctional populations evaluated on a uniform grid. Data are represented by means of the Fourierbasis and the significance of each basis coefficient is tested with an interval-wise control of theFamily Wise Error Rate.

Usage

ITP2fourier(data1, data2, mu = 0,maxfrequency=floor(dim(data1)[2]/2), B = 10000, paired = FALSE)

Page 10: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

10 ITP2fourier

Arguments

data1 Pointwise evaluations of the first population’s functional data set on a uniformgrid. data1 is a matrix of dimensions c(n1,J), with J evaluations on columnsand n1 units on rows.

data2 Pointwise evaluations of the second population’s functional data set on a uni-form grid. data2 is a matrix of dimensions c(n2,J), with J evaluations oncolumns and n2 units on rows.

mu The difference between the first functional population and the second functionalpopulation under the null hypothesis. Either a constant (in this case, a constantfunction is used) or a J-dimensional vector containing the evaluations on thesame grid which data are evaluated. The default is mu=0.

maxfrequency The maximum frequency to be used in the Fourier basis expansion of data. Thedefault is floor(dim(data1)[2]/2), leading to an interpolating expansion.

B The number of iterations of the MC algorithm to evaluate the p-values of thepermutation tests. The defualt is B=10000.

paired A logical indicating whether the test is paired. The default is FALSE.

Value

ITP2fourier returns an object of class "ITP2".

An object of class "ITP2" is a list containing at least the following components:

basis String vector indicating the basis used for the first phase of the algorithm. In thiscase equal to "Fourier".

test String vector indicating the type of test performed. in this case equal to "2pop".

mu Difference between the first functional population and the second functionalpopulation under the null hypothesis (as entered by the user).

paired Logical indicating whether the test is paired (as entered by the user).

coeff Matrix of dimensions c(n,p) of the p coefficients of the Fourier basis expan-sion. Rows are associated to units and columns to the basis index: the first n1rows report the coefficients of the first population units and the following n2rows report the coefficients of the second population units; the first column isa0, the following (p-1)/2 columns are the ak coefficients (sine coefficients) andthe last (p-1)/2 columns the bk coefficients (cosine coefficients).

pval Uncorrected p-values for each frequency.

pval.matrix Matrix of dimensions c(p,p) of the p-values of the multivariate tests. The ele-ment (i,j) of matrix pval.matrix contains the p-value of the joint NPC testof the frequencies (j,j+1,...,j+(p-i)).

corrected.pval Corrected p-values for each frequency.

labels Labels indicating the population membership of each data.

data.eval Evaluation on a fine uniform grid of the functional data obtained through thebasis expansion.

heatmap.matrix Heatmap matrix of p-values (used only for plots).

Page 11: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

ITP2pafourier 11

Author(s)

Alessia Pini, Simone Vantini

References

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

See Also

See also ITP2pafourier, ITP2bspline, ITP1fourier, ITP1bspline, and ITPimage.

Examples

# Importing the NASA temperatures data setdata(NASAtemp)# Performing the ITPITP.result <- ITP2fourier(NASAtemp$milan,NASAtemp$paris,maxfrequency=20,B=1000,paired=TRUE)

# Plotting the results of the ITPplot(ITP.result,main='NASA data',xrange=c(1,365),xlab='Day')

# Plotting the p-value heatmapITPimage(ITP.result,abscissa.range=c(1,365))

# Selecting the significant coefficientswhich(ITP.result$corrected.pval < 0.05)

ITP2pafourier Two populations Interval Testing Procedure with Fourier basis (phase-amplitude decomposition)

Description

The function implements the Interval Testing Procedure for testing the difference between twofunctional populations evaluated on a uniform grid. Data are represented by means of the Fourierbasis expansion with the phase-amplitude decomposition and the significance of the amplitude andphase of each frequency is tested with an interval-wise control of the Family Wise Error Rate.

Usage

ITP2pafourier(data1, data2,maxfrequency=floor(dim(data1)[2]/2), B = 10000, paired = FALSE)

Page 12: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

12 ITP2pafourier

Arguments

data1 Pointwise evaluations of the first population’s functional data set on a uniformgrid. data1 is a matrix of dimensions c(n1,J), with J evaluations on columnsand n1 units on rows.

data2 Pointwise evaluations of the second population’s functional data set on a uni-form grid. data2 is a matrix of dimensions c(n2,J), with J evaluations oncolumns and n2 units on rows.

maxfrequency The maximum frequency to be used in the Fourier basis expansion of data. Thedefault is floor(dim(data1)[2]/2), leading to an interpolating expansion.

B The number of iterations of the MC algorithm to evaluate the p-values of thepermutation tests. The defualt is B=10000.

paired A logical indicating whether the test is paired. The default is FALSE.

Value

ITP2pafourier returns an object of class "ITP2".

An object of class "ITP2" is a list containing at least the following components:

basis String vector indicating the basis used for the first phase of the algorithm. Equalto "paFourier".

test String vector indicating the type of test performed. Equal to "2pop".

paired Logical indicating whether the test is paired (as entered by the user).

coeff_phase Matrix of dimensions c(n,p) of the p phases of the Fourier basis expansion.Rows are associated to units and columns to frequencies: the first n1 rows reportthe coefficients of the first population units and the following n2 rows report thecoefficients of the second population units.

coeff_amplitude

Matrix of dimensions c(n,p) of the p amplitudes of the Fourier basis expansion.Rows are associated to units and columns to frequencies: the first n1 rows reportthe coefficients of the first population units and the following n2 rows report thecoefficients of the second population units.

pval_phase Uncorrected p-values of the phase tests for each frequency.

pval_amplitude Uncorrected p-values of the amplitude tests for each frequency.pval.matrix_phase

Matrix of dimensions c(p,p) of the p-values of the multivariate tests on phase.The element (i,j) of matrix pval.matrix_phase contains the p-value of thejoint NPC test of the frequencies (j,j+1,...,j+(p-i)).

pval.matrix_amplitude

Matrix of dimensions c(p,p) of the p-values of the multivariate tests on am-plitude. The element (i,j) of matrix pval.matrix_amplitude contains thep-value of the joint NPC test of the frequencies (j,j+1,...,j+(p-i)).

corrected.pval_phase

Corrected p-values of the phase tests for each frequency.corrected.pval_amplitude

Corrected p-values of the amplitude tests for each frequency.

Page 13: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

ITPaovbspline 13

labels Labels indicating the population membership of each data.data.eval Evaluation on a fine uniform grid of the functional data obtained through the

basis expansion.heatmap.matrix_phase

Heatmap matrix of p-values for phase (used only for plots).heatmap.matrix_amplitude

Heatmap matrix of p-values for amplitude (used only for plots).

Author(s)

Alessia Pini, Simone Vantini

References

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

See Also

See also ITP2fourier, ITP2bspline, ITP1fourier, ITP1bspline, and ITPimage.

Examples

# Importing the NASA temperatures data setdata(NASAtemp)# Performing the ITPITP.result <- ITP2pafourier(NASAtemp$milan,NASAtemp$paris,maxfrequency=20,B=1000,paired=TRUE)# Plotting the results of the ITPplot(ITP.result,main='NASA data',xrange=c(1,365),xlab='Day')

# Plotting the p-value heatmapITPimage(ITP.result,abscissa.range=c(1,365))

# Selecting the significant coefficientswhich(ITP.result$corrected.pval < 0.05)

ITPaovbspline Interval Testing Procedure for testing Functional analysis of variancewith B-spline basis

Description

ITPaovbspline is used to fit and test functional analysis of variance. The function implements theInterval Testing Procedure for testing for significant differences between several functional pop-ulation evaluated on a uniform grid. Data are represented by means of the B-spline basis and thesignificance of each basis coefficient is tested with an interval-wise control of the Family Wise ErrorRate. The default parameters of the basis expansion lead to the piece-wise interpolating function.

Page 14: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

14 ITPaovbspline

Usage

ITPaovbspline(formula, order = 2,nknots = dim(model.response(model.frame(formula)))[2],B = 10000, method = "residuals")

Arguments

formula An object of class "formula" (or one that can be coerced to that class): a sym-bolic description of the model to be fitted.

order Order of the B-spline basis expansion. The default is order=2.

nknots Number of knots of the B-spline basis expansion.The default is dim(model.response(model.frame(formula)))[2].

B The number of iterations of the MC algorithm to evaluate the p-values of thepermutation tests. The defualt is B=10000.

method Permutation method used to calculate the p-value of permutation tests. Choose"residuals" for the permutations of residuals under the reduced model, accord-ing to the Freedman and Lane scheme, and "responses" for the permutation ofthe responses, according to the Manly scheme.

Value

ITPaovbspline returns an object of class "ITPaov".

The function summary is used to obtain and print a summary of the results.

An object of class "ITPlm" 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.

basis String vector indicating the basis used for the first phase of the algorithm. In thiscase equal to "B-spline".

coeff Matrix of dimensions c(n,p) of the p coefficients of the B-spline basis expan-sion. Rows are associated to units and columns to the basis index.

coeff.regr Matrix of dimensions c(L+1,p) of the p coefficients of the B-spline basis ex-pansion of the intercept (first row) and the L effects of the covariates specifiedin formula. Columns are associated to the basis index.

pval.F Uncorrected p-values of the functional F-test for each basis coefficient.

pval.matrix.F Matrix of dimensions c(p,p) of the p-values of the multivariate F-tests. Theelement (i,j) of matrix pval.matrix contains the p-value of the joint NPCtest of the components (j,j+1,...,j+(p-i)).

corrected.pval.F

Corrected p-values of the functional F-test for each basis coefficient.

pval.factors Uncorrected p-values of the functional F-tests on each factor of the analysis ofvariance, separately (rows) and each basis coefficient (columns).

Page 15: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

ITPaovbspline 15

pval.matrix.factors

Array of dimensions c(L+1,p,p) of the p-values of the multivariate F-tests onfactors. The element (l,i,j) of array pval.matrix contains the p-value of thejoint NPC test on factor l of the components (j,j+1,...,j+(p-i)).

corrected.pval.factors

Corrected p-values of the functional F-tests on each factor of the analysis ofvariance (rows) and each basis coefficient (columns).

data.eval Evaluation on a fine uniform grid of the functional data obtained through thebasis 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 analysisof variance (used only for plots).

Author(s)

Alessia Pini, Simone Vantini

References

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.

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

K. Abramowicz, S. De Luna, C. Häger, A. Pini, L. Schelin, and S. Vantini (2015). Distribution-FreeInterval-Wise Inference for Functional-on-Scalar Linear Models. MOX-report 3/2015, Politecnicodi Milano.

See Also

See summary.ITPaov for summaries and plot.ITPaov for plotting the results.

See also ITPlmbspline to fit and test a functional-on-scalar linear model applying the ITP, andITP1bspline, ITP2bspline, ITP2fourier, ITP2pafourier for one-population and two-populationtests.

Page 16: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

16 ITPimage

Examples

# Importing the NASA temperatures data setdata(NASAtemp)

temperature <- rbind(NASAtemp$milan,NASAtemp$paris)groups <- c(rep(0,22),rep(1,22))

# Performing the ITPITP.result <- ITPaovbspline(temperature ~ groups,B=1000,nknots=20,order=3)

# Summary of the ITP resultssummary(ITP.result)

# Plot of the ITP resultslayout(1)plot(ITP.result)

# All graphics on the same devicelayout(matrix(1:4,nrow=2,byrow=FALSE))plot(ITP.result,main='NASA data', plot.adjpval = TRUE,xlab='Day',xrange=c(1,365))

ITPimage Plot of the Interval Testing Procedure results

Description

Plotting function creating a graphical output of the ITP: the p-value heat-map, the plot of the cor-rected p-values, and the plot of the functional data.

Usage

ITPimage(ITP.result, alpha = 0.05, abscissa.range = c(0, 1), nlevel = 20)

Arguments

ITP.result Results of the ITP, as created by ITP1bspline, ITP1fourier, ITP2bspline,ITP2fourier, and ITP2pafourier.

alpha Level of the hypothesis test. The default is alpha=0.05.

abscissa.range Range of the plot abscissa. The default is c(0,1).

nlevel Number of desired color levels for the p-value heatmap. The default is nlevel=20.

Value

No value returned. The function produces a graphical output of the ITP results: the p-value heatmap,a plot of the corrected p-values and the plot of the functional data. The basis components selectedas significant by the test at level alpha are highlighted in the plot of the corrected p-values by agray area.

Page 17: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

ITPlmbspline 17

Author(s)

Alessia pini, Simone Vantini

References

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

See Also

See plot.ITP1, plot.ITP2, plot.ITPlm, and plot.ITPaov for the plot method applied to the ITPresults of one- and two-population tests, linear models, and ANOVA, respectively.

See also ITP1bspline, ITP1fourier, ITP2bspline, ITP2fourier, and ITP2pafourier for ap-plying the ITP.

Examples

# Importing the NASA temperatures data setdata(NASAtemp)

# Performing the ITP for two populations with the B-spline basisITP.result <- ITP2bspline(NASAtemp$milan,NASAtemp$paris,nknots=20,B=1000)

# Plotting the results of the ITPITPimage(ITP.result,abscissa.range=c(0,12))

# Selecting the significant components for the radius at 5% levelwhich(ITP.result$corrected.pval < 0.05)

ITPlmbspline Interval Testing Procedure for testing Functional-on-Scalar LinearModels with B-spline basis

Description

ITPlmbspline is used to fit and test functional linear models. It can be used to carry out regression,and analysis of variance. The function implements the Interval Testing Procedure for testing thesignificance of the effects of scalar covariates on a functional population evaluated on a uniformgrid. Data are represented by means of the B-spline basis and the significance of each basis coeffi-cient is tested with an interval-wise control of the Family Wise Error Rate. The default parametersof the basis expansion lead to the piece-wise interpolating function.

Usage

ITPlmbspline(formula, order = 2,nknots = dim(model.response(model.frame(formula)))[2],B = 10000, method = "residuals")

Page 18: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

18 ITPlmbspline

Arguments

formula An object of class "formula" (or one that can be coerced to that class): a sym-bolic description of the model to be fitted.

order Order of the B-spline basis expansion. The default is order=2.

nknots Number of knots of the B-spline basis expansion.The default is dim(model.response(model.frame(formula)))[2].

B The number of iterations of the MC algorithm to evaluate the p-values of thepermutation tests. The defualt is B=10000.

method Permutation method used to calculate the p-value of permutation tests. Choose"residuals" for the permutations of residuals under the reduced model, accord-ing to the Freedman and Lane scheme, and "responses" for the permutation ofthe responses, according to the Manly scheme.

Value

ITPlmbspline returns an object of class "ITPlm".

The function summary is used to obtain and print a summary of the results.

An object of class "ITPlm" 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.

basis String vector indicating the basis used for the first phase of the algorithm. In thiscase equal to "B-spline".

coeff Matrix of dimensions c(n,p) of the p coefficients of the B-spline basis expan-sion. Rows are associated to units and columns to the basis index.

coeff.regr Matrix of dimensions c(L+1,p) of the p coefficients of the B-spline basis ex-pansion of the intercept (first row) and the L effects of the covariates specifiedin formula. Columns are associated to the basis index.

pval.F Uncorrected p-values of the functional F-test for each basis coefficient.

pval.matrix.F Matrix of dimensions c(p,p) of the p-values of the multivariate F-tests. Theelement (i,j) of matrix pval.matrix contains the p-value of the joint NPCtest of the components (j,j+1,...,j+(p-i)).

corrected.pval.F

Corrected p-values of the functional F-test for each basis coefficient.

pval.t Uncorrected p-values of the functional t-tests for each partial regression coeffi-cient including the intercept (rows) and each basis coefficient (columns).

pval.matrix.t Array of dimensions c(L+1,p,p) of the p-values of the multivariate t-tests. Theelement (l,i,j) of array pval.matrix contains the p-value of the joint NPCtest on covariate l of the components (j,j+1,...,j+(p-i)).

corrected.pval.t

Corrected p-values of the functional t-tests for each partial regression coefficientincluding the intercept (rows) and each basis coefficient (columns).

data.eval Evaluation on a fine uniform grid of the functional data obtained through thebasis expansion.

Page 19: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

ITPlmbspline 19

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.t

Heatmap matrix of p-values of functional t-tests (used only for plots).

Author(s)

Alessia Pini, Simone Vantini

References

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.

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

K. Abramowicz, S. De Luna, C. Häger, A. Pini, L. Schelin, and S. Vantini (2015). Distribution-FreeInterval-Wise Inference for Functional-on-Scalar Linear Models. MOX-report 3/2015, Politecnicodi Milano.

See Also

See summary.ITPlm for summaries and plot.ITPlm for plotting the results.

See also ITPaovbspline to fit and test a functional analysis of variance applying the ITP, andITP1bspline, ITP2bspline, ITP2fourier, ITP2pafourier for one-population and two-populationtests.

Examples

# Importing the NASA temperatures data setdata(NASAtemp)

# Defining the covariatestemperature <- rbind(NASAtemp$milan,NASAtemp$paris)groups <- c(rep(0,22),rep(1,22))

# Performing the ITPITP.result <- ITPlmbspline(temperature ~ groups,B=1000,nknots=20)# Summary of the ITP resultssummary(ITP.result)

# Plot of the ITP results

Page 20: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

20 NASAtemp

layout(1)plot(ITP.result,main='NASA data', plot.adjpval = TRUE,xlab='Day',xrange=c(1,365))

# All graphics on the same devicelayout(matrix(1:6,nrow=3,byrow=FALSE))plot(ITP.result,main='NASA data', plot.adjpval = TRUE,xlab='Day',xrange=c(1,365))

NASAtemp NASA daily temperatures data set

Description

It contains the daily mean temperatures registered from July 1983 to June 2005 and stored in theNASA database Earth Surface Meteorology for Solar Energy of two different geographical loca-tions: the region (45-46 North, 9-10 East), including the city of Milan (Italy), and the region (48-49North, 2-3 East), including the city of Paris (France).

Usage

data(NASAtemp)

Format

List of 2 elements:

• milan Matrix of dimensions c(22,365) containing the daily mean temperatures of the region(45-46 North, 9-10 East), including the city of Milan (Italy) registered from July 1983 to June2005 (22 years).

• paris Matrix of dimensions c(22,365) containing the daily mean temperatures of the region(48-49 North, 2-3 East), including the city of Paris (France) registered from July 1983 to June2005 (22 years).

Source

These data were obtained from the NASA Langley Research Center Atmospheric Science DataCenter Surface meteorological and Solar Energy (SSE) web portal supported by the NASA LaRCPOWER Project. Data are freely available at: NASA Surface Meteorology and Solar Energy, ARenewable Energy Resource web site (release 6.0): http://eosweb.larc.nasa.gov

Examples

data(NASAtemp)## Not run:

matplot(t(NASAtemp$milan),type='l')matplot(t(NASAtemp$paris),type='l')

Page 21: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

plot.ITP1 21

## End(Not run)

plot.ITP1 Plotting ITP results for one-population tests

Description

plot method for class "ITP1". Plotting function creating a graphical output of the ITP for the testof the mean of one population: functional data and ITP-adjusted p-values are plotted.

Usage

## S3 method for class 'ITP1'plot(x, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01,

ylab = "Functional Data", main = NULL, lwd = 1, col = 1,pch = 16, ylim = range(object$data.eval), ...)

Arguments

x The object to be plotted. An object of class "ITP1", that is, a result of an ITPfor comparison between two populations. Usually a call to ITP1bspline orITP1fourier.

xrange Range of the x axis.alpha1 First level of significance used to select and display significant differences. De-

fault is alpha1 = 0.05.alpha2 Second level of significance used to select and display significant differences.

Default is alpha1 = 0.01. alpha1 and alpha2 are s.t. alpha2 < alpha1.Otherwise the two values are switched.

ylab Label of y axis of the plot of functional data. Default is "Functional Data".main An overall title for the plots (it will be pasted to "Functional Data" for the

first plot and "adjusted p-values" for the second plot).lwd Line width for the plot of functional data.col Color used to plot the functional data.pch Point character for the plot of adjusted p-values.ylim Range of the y axis.... Additional plotting arguments that can be used with function plot, such as

graphical parameters (see par).

Value

No value returned. The function produces a graphical output of the ITP results: the plot of thefunctional data and the one of the adjusted p-values. The basis components selected as significantby the test at level alpha1 and alpha2 are highlighted in the plot of the corrected p-values and inthe one of functional data (in case the test is based on a local basis, such as B-splines) by gray areas(light and dark gray, respectively).

Page 22: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

22 plot.ITP2

Author(s)

Alessia Pini, Simone Vantini

References

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

See Also

ITPimage for the plot of p-values heatmaps.

See also ITP1bspline and ITP1fourier to perform the ITP to test for the mean of a functionalpopulations. See plot.ITP2 and plot.ITPlm for the plot method applied to the ITP results oftwo-population tests and linear models, respectively.

Examples

# Importing the NASA temperatures data setdata(NASAtemp)

# Performing the ITP for one population with the B-spline basisITP.result.bspline <- ITP1bspline(NASAtemp$paris,mu=4,nknots=50,B=1000)# Plotting the results of the ITPplot(ITP.result.bspline,xlab='Day',xrange=c(0,365),main='NASA data')# Selecting the significant components for the radius at 5% levelwhich(ITP.result.bspline$corrected.pval < 0.05)

plot.ITP2 Plotting ITP results for two-population tests

Description

plot method for class "ITP2". Plotting function creating a graphical output of the ITP for the testof comparison between two populations: functional data and ITP-adjusted p-values are plotted.

Usage

## S3 method for class 'ITP2'plot(x, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01,

ylab = "Functional Data", main = NULL, lwd = 1,col = c(1, 2), pch = 16, ylim = range(object$data.eval), ...)

Page 23: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

plot.ITP2 23

Arguments

x The object to be plotted. An object of class "ITP2", that is, a result of anITP for comparison between two populations. Usually a call to ITP2bspline,ITP2fourier or ITP2pafourier.

xrange Range of the x axis.

alpha1 First level of significance used to select and display significant differences. De-fault is alpha1 = 0.05.

alpha2 Second level of significance used to select and display significant differences.Default is alpha1 = 0.01. alpha1 and alpha2 are s.t. alpha2 < alpha1.Otherwise the two values are switched.

ylab Label of y axis of the plot of functional data. Default is "Functional Data".

main An overall title for the plots (it will be pasted to "Functional Data" for thefirst plot and "adjusted p-values" for the second plot).

lwd Line width for the plot of functional data.

col Color used to plot the functional data.

pch Point character for the plot of adjusted p-values.

ylim Range of the y axis.

... Additional plotting arguments that can be used with function plot, such asgraphical parameters (see par).

Value

No value returned. The function produces a graphical output of the ITP results: the plot of thefunctional data and the one of the adjusted p-values. The basis components selected as significantby the test at level alpha1 and alpha2 are highlighted in the plot of the corrected p-values andin the one of functional data (in case the test is based on a local basis, such as B-splines) by grayareas (light and dark gray, respectively). In the case of a Fourier basis with amplitude and phasedecomposition, two plots of adjusted p-values are done, one for phase and one for amplitude.

Author(s)

Alessia Pini, Simone Vantini

References

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

See Also

ITPimage for the plot of p-values heatmaps.

See also ITP2bspline, ITP2fourier, ITP2pafourier to perform the ITP to test for differencesbetween two populations. See plot.ITP1 and plot.ITPlm for the plot method applied to the ITPresults of one-population tests and a linear models, respectively.

Page 24: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

24 plot.ITPaov

Examples

# Importing the NASA temperatures data setdata(NASAtemp)

# Performing the ITP for two populations with the B-spline basisITP.result.bspline <- ITP2bspline(NASAtemp$milan,NASAtemp$paris,nknots=30,B=1000)# Plotting the results of the ITPplot(ITP.result.bspline,xlab='Day',xrange=c(1,365),main='NASA data')

# Selecting the significant components for the radius at 5% levelwhich(ITP.result.bspline$corrected.pval < 0.05)

plot.ITPaov Plotting ITP results for functional analysis of variance testing

Description

plot method for class "ITPaov". Plotting function creating a graphical output of the ITP for thetest on a functional analysis of variance: functional data, and ITP-adjusted p-values of the F-testson the whole model and on each factor are plotted.

Usage

## S3 method for class 'ITPaov'plot(x,xrange=c(0,1), alpha1=0.05, alpha2=0.01,

plot.adjpval=FALSE,ylim=range(x$data.eval),col=1,ylab='Functional Data',main=NULL,lwd=1,pch=16,...)

Arguments

x The object to be plotted. An object of class "ITPaov", usually, a result of a callto ITPaovbspline.

xrange Range of the x axis.

alpha1 First level of significance used to select and display significant effects. Defaultis alpha1 = 0.05.

alpha2 Second level of significance used to select and display significant effects. De-fault is alpha1 = 0.01. alpha1 and alpha2 are s.t. alpha2 < alpha1.Otherwise the two values are switched.

plot.adjpval A logical indicating wether the plots of adjusted p-values have to be done. De-fault is plot.adjpval = FALSE.

col Colors for the plot of functional data. Default is col = 1.

ylim Range of the y axis. Default is ylim = range(x$data.eval).

ylab Label of y axis of the plot of functional data. Default is "Functional Data".

Page 25: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

plot.ITPaov 25

main An overall title for the plots (it will be pasted to "Functional Data and F-test"for the first plot and "factor" for the other plots).

lwd Line width for the plot of functional data. Default is lwd=16.

pch Point character for the plot of adjusted p-values. Default is pch=16.

... Additional plotting arguments that can be used with function plot, such asgraphical parameters (see par).

Value

No value returned. The function produces a graphical output of the ITP results: the plot of the func-tional data, functional regression coefficients, and ITP-adjusted p-values of the F-tests on the wholemodel and on each factor. The basis components selected as significant by the tests at level alpha1and alpha2 are highlighted in the plot of the corrected p-values and in the one of functional data bygray areas (light and dark gray, respectively). The first plot reports the gray areas corresponding toa significant F-test on the whole model. The remaining plots report the gray areas corresponding tosignificant F-tests on each factor (with colors corresponding to the levels of the factor).

Author(s)

Alessia Pini, Simone Vantini

References

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

K. Abramowicz, S. De Luna, C. Häger, A. Pini, L. Schelin, and S. Vantini (2015). Distribution-FreeInterval-Wise Inference for Functional-on-Scalar Linear Models. MOX-report 3/2015, Politecnicodi Milano.

See Also

See also ITPaovbspline to fit and test a functional analysis of variance applying the ITP, andsummary.ITPaov for summaries. See plot.ITPlm, plot.ITP1, and plot.ITP2 for the plot methodapplied to the ITP results of functional-on-scalar linear models, one-population and two-population,respectively.

Examples

# Importing the NASA temperatures data setdata(NASAtemp)

temperature <- rbind(NASAtemp$milan,NASAtemp$paris)groups <- c(rep(0,22),rep(1,22))

# Performing the ITPITP.result <- ITPaovbspline(temperature ~ groups,B=1000,nknots=20,order=3)

# Summary of the ITP resultssummary(ITP.result)

Page 26: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

26 plot.ITPlm

# Plot of the ITP resultslayout(1)plot(ITP.result)

# All graphics on the same devicelayout(matrix(1:4,nrow=2,byrow=FALSE))plot(ITP.result,main='NASA data', plot.adjpval = TRUE,xlab='Day',xrange=c(1,365))

plot.ITPlm Plotting ITP results for functional-on-scalar linear model testing

Description

plot method for class "ITPlm". Plotting function creating a graphical output of the ITP for the teston a functional-on-scalar linear model: functional data, functional coefficients and ITP-adjustedp-values for the F-test and t-tests are plotted.

Usage

## S3 method for class 'ITPlm'plot(x, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01,

plot.adjpval = FALSE, col = c(1, rainbow(dim(x$corrected.pval.t)[1])),ylim = range(x$data.eval), ylab = "Functional Data",main = NULL, lwd = 1, pch = 16, ...)

Arguments

x The object to be plotted. An object of class "ITPlm", usually, a result of a call toITPlmbspline.

xrange Range of the x axis.

alpha1 First level of significance used to select and display significant effects. Defaultis alpha1 = 0.05.

alpha2 Second level of significance used to select and display significant effects. De-fault is alpha1 = 0.01. alpha1 and alpha2 are s.t. alpha2 < alpha1.Otherwise the two values are switched.

plot.adjpval A logical indicating wether the plots of adjusted p-values have to be done. De-fault is plot.adjpval = FALSE.

col Vector of colors for the plot of functional data (first element), and functionalcoefficients (following elements).Default is col = c(1, rainbow(dim(x$corrected.pval.t)[1])).

ylim Range of the y axis. Default is ylim = range(x$data.eval).

ylab Label of y axis of the plot of functional data. Default is "Functional Data".

main An overall title for the plots (it will be pasted to "Functional Data and F-test"for the first plot and "t-test" for the other plots).

Page 27: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

plot.ITPlm 27

lwd Line width for the plot of functional data. Default is lwd=16.

pch Point character for the plot of adjusted p-values. Default is pch=16.

... Additional plotting arguments that can be used with function plot, such asgraphical parameters (see par).

Value

No value returned. The function produces a graphical output of the ITP results: the plot of thefunctional data, functional regression coefficients, and ITP-adjusted p-values for the F-test and t-tests. The basis components selected as significant by the tests at level alpha1 and alpha2 arehighlighted in the plot of the corrected p-values and in the one of functional data by gray areas (lightand dark gray, respectively). The plot of functional data reports the gray areas corresponding to asignificant F-test. The plots of functional regression coefficients report the gray areas correspondingto significant t-tests for the corresponding covariate.

Author(s)

Alessia Pini, Simone Vantini

References

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

K. Abramowicz, S. De Luna, C. Häger, A. Pini, L. Schelin, and S. Vantini (2015). Distribution-FreeInterval-Wise Inference for Functional-on-Scalar Linear Models. MOX-report 3/2015, Politecnicodi Milano.

See Also

See also ITPlmbspline to fit and test a functional-on-scalar linear model applying the ITP, andsummary.ITPlm for summaries. See plot.ITPaov, plot.ITP1, and plot.ITP2 for the plot methodapplied to the ITP results of functional analysis of variance, one-population and two-population,respectively.

Examples

# Importing the NASA temperatures data setdata(NASAtemp)

data <- rbind(NASAtemp$milan,NASAtemp$paris)lab <- c(rep(0,22),rep(1,22))

# Performing the ITPITP.result <- ITPlmbspline(data ~ lab,B=1000,nknots=20,order=3)# Summary of the ITP resultssummary(ITP.result)

# Plot of the ITP resultslayout(1)plot(ITP.result,main='NASA data',xlab='Day',xrange=c(1,365))

Page 28: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

28 summary.ITPaov

# Plots of the adjusted p-valuesplot(ITP.result,main='NASA data', plot.adjpval = TRUE,xlab='Day',xrange=c(1,365))

# To have all plots in one devicelayout(matrix(1:6,nrow=3,byrow=FALSE))plot(ITP.result,main='NASA data', plot.adjpval = TRUE,xlab='Day',xrange=c(1,365))

summary.ITPaov Summarizing Functional Analysis of Variance Fits

Description

summary method for class "ITPaov".

Usage

## S3 method for class 'ITPaov'summary(object, ...)

Arguments

object An object of class "ITPaov", usually, a result of a call to ITPaovbspline.... Further arguments passed to or from other methods.

Value

The function summary.ITPaov computes and returns a list of summary statistics of the fitted func-tional analysis of variance given in object, using the component "call" from its arguments, plus:

factors A L x 1 matrix with columns for the factors of ANOVA, and corresponding(two-sided) ITP-adjusted minimum p-values of the corresponding tests of signif-icance (i.e., the minimum p-value over all p basis components used to describefunctional data).

R2 Range of the functional R-squared.ftest ITP-adjusted minimum p-value of functional F-test.

Author(s)

Alessia Pini, Simone Vantini

References

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

K. Abramowicz, S. De Luna, C. Häger, A. Pini, L. Schelin, and S. Vantini (2015). Distribution-FreeInterval-Wise Inference for Functional-on-Scalar Linear Models. MOX-report 3/2015, Politecnicodi Milano.

Page 29: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

summary.ITPlm 29

See Also

See ITPaovbspline for fitting and testing the functional ANOVA and plot.ITPaov for plots. Seealso ITPlmbspline, ITP1bspline, ITP2bspline, ITP2fourier, ITP2pafourier.

Examples

# Importing the NASA temperatures data setdata(NASAtemp)

temperature <- rbind(NASAtemp$milan,NASAtemp$paris)groups <- c(rep(0,22),rep(1,22))

# Performing the ITPITP.result <- ITPaovbspline(temperature ~ groups,B=1000,nknots=20,order=3)

# Summary of the ITP resultssummary(ITP.result)

summary.ITPlm Summarizing Functional-on-Scalar Linear Model Fits

Description

summary method for class "ITPlm".

Usage

## S3 method for class 'ITPlm'summary(object, ...)

Arguments

object An object of class "ITPlm", usually, a result of a call to ITPlmbspline.

... Further arguments passed to or from other methods.

Value

The function summary.ITPlm computes and returns a list of summary statistics of the fitted functional-on-scalar linear model given in object, using the component "call" from its arguments, plus:

ttest A L+1 x 1 matrix with columns for the functional regression coefficients, andcorresponding (two-sided) ITP-adjusted minimum p-values of t-tests (i.e., theminimum p-value over all p basis components used to describe functional data).

R2 Range of the functional R-squared.

ftest ITP-adjusted minimum p-value of functional F-test.

Page 30: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

30 summary.ITPlm

Author(s)

Alessia Pini, Simone Vantini

References

A. Pini and S. Vantini (2013). The Interval Testing Procedure: Inference for Functional Data Con-trolling the Family Wise Error Rate on Intervals. MOX-report 13/2013, Politecnico di Milano.

K. Abramowicz, S. De Luna, C. Häger, A. Pini, L. Schelin, and S. Vantini (2015). Distribution-FreeInterval-Wise Inference for Functional-on-Scalar Linear Models. MOX-report 3/2015, Politecnicodi Milano.

See Also

See ITPlmbspline for fitting and testing the functional linear model and plot.ITPlm for plots. Seealso ITPaovbspline, ITP1bspline, ITP2bspline, ITP2fourier, ITP2pafourier.

Examples

# Importing the NASA temperatures data setdata(NASAtemp)

temperature <- rbind(NASAtemp$milan,NASAtemp$paris)groups <- c(rep(0,22),rep(1,22))

# Performing the ITPITP.result <- ITPlmbspline(temperature ~ groups, B=1000,nknots=20)

# Summary of the ITP resultssummary(ITP.result)

Page 31: Package ‘fdatest’ - R · 2015. 2. 19. · Package ‘fdatest’ February 19, 2015 Type Package Title Interval Testing Procedure for Functional Data Version 2.1 Date 2015-02-05

Index

∗Topic \textasciitildekwd1ITP1bspline, 4ITP1fourier, 6ITP2bspline, 7ITP2fourier, 9ITP2pafourier, 11ITPaovbspline, 13ITPimage, 16ITPlmbspline, 17plot.ITP1, 21plot.ITP2, 22plot.ITPaov, 24plot.ITPlm, 26summary.ITPaov, 28summary.ITPlm, 29

∗Topic \textasciitildekwd2ITP1bspline, 4ITP1fourier, 6ITP2bspline, 7ITP2fourier, 9ITP2pafourier, 11ITPaovbspline, 13ITPimage, 16ITPlmbspline, 17plot.ITP1, 21plot.ITP2, 22plot.ITPaov, 24plot.ITPlm, 26summary.ITPaov, 28summary.ITPlm, 29

∗Topic datasetsNASAtemp, 20

∗Topic packagefdatest-package, 2

class, 4, 6, 8, 10, 12, 14, 18

fdatest (fdatest-package), 2fdatest-package, 2formula, 14, 18

ITP1bspline, 3, 4, 7, 9, 11, 13, 15–17, 19, 21,22, 29, 30

ITP1fourier, 3, 5, 6, 9, 11, 13, 16, 17, 21, 22ITP2bspline, 3, 5, 7, 7, 11, 13, 15–17, 19, 23,

29, 30ITP2fourier, 3, 5, 7, 9, 9, 13, 15–17, 19, 23,

29, 30ITP2pafourier, 3, 5, 7, 9, 11, 11, 15–17, 19,

23, 29, 30ITPaovbspline, 3, 9, 13, 19, 24, 25, 28–30ITPimage, 3, 5, 7, 9, 11, 13, 16, 22, 23ITPlmbspline, 3, 9, 15, 17, 26, 27, 29, 30

NASAtemp, 20

par, 21, 23, 25, 27plot.ITP1, 17, 21, 23, 25, 27plot.ITP2, 17, 22, 22, 25, 27plot.ITPaov, 15, 17, 24, 27, 29plot.ITPlm, 17, 19, 22, 23, 25, 26, 30

summary.ITPaov, 15, 25, 28summary.ITPlm, 19, 27, 29

31