| Title: | Interval Wise Testing for Functional Data |
|---|---|
| Description: | Implementation of local inferential (domain-selection) procedures for functional data in different frameworks (one- and two-sample tests, ANOVA, linear models). The current version of the package requires functional data evaluated on a common uniform grid or objects of class 'fd' as produced by the 'fda' package and provides the adjusted and unadjusted p-value functions based on nonparametric local tests. The package provides tools for visualization: (i) the p-value heatmap, the plot of the p-value functions and the plot of the functional data. |
| Authors: | Alessia Pini [aut], Aymeric Stamm [ctb, cre] (ORCID: <https://orcid.org/0000-0002-8725-3654>), Simone Vantini [aut] |
| Maintainer: | Aymeric Stamm <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 2.1.1 |
| Built: | 2026-05-25 09:03:28 UTC |
| Source: | https://github.com/alessiapini/fdatest |
The function implements the functional Benjamini Hochberg (fBH) procedure for testing mean differences between two functional populations. 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 family-wise error rate asymptotically.
fdr2( data1, data2, mu = 0, dx = NULL, n_perm = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), standardize = FALSE, verbose = FALSE ) FDR2( data1, data2, mu = 0, dx = NULL, B = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), statistic = c("Integral", "Integral_std"), verbose = FALSE )fdr2( data1, data2, mu = 0, dx = NULL, n_perm = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), standardize = FALSE, verbose = FALSE ) FDR2( data1, data2, mu = 0, dx = NULL, B = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), statistic = c("Integral", "Integral_std"), verbose = FALSE )
data1 |
Either a numeric matrix or an object of class |
data2 |
Either a numeric matrix or an object of class |
mu |
Either a numeric value or a numeric vector or an object of class
|
dx |
A numeric value specifying the step of the uniform grid on which
the data are evaluated. If |
n_perm |
An integer value specifying the number of permutations to use
for the local testing procedure. Defaults to |
paired |
A boolean value specifying whether a paired test should be
performed. Defaults to |
alternative |
A string specifying the type of alternative hypothesis.
Choices are |
standardize |
A boolean value specifying whether to standardize the test
statistic. Defaults to |
verbose |
A boolean value specifying whether to print the progress of
the computation. Defaults to |
B |
An integer value specifying the number of permutations to use
for the local testing procedure. Defaults to |
statistic |
A string specifying the test statistic to use. Possible values are:
Defaults to |
An object of class fts containing the following components:
data: A numeric matrix of shape containing the
evaluation of the functions on a common uniform
grid of size .
group_labels: An integer vector of size containing
the group membership of each function.
mu: A numeric vector of shape containing the evaluation of the
functional mean difference under the null hypothesis on the same uniform
grid used to evaluate the functional samples.
unadjusted_pvalues: A numeric vector of size containing the
evaluation of the unadjusted p-value function on the same uniform grid
used to evaluate the functional samples.
adjusted_pvalues: A numeric vector of size containing the
evaluation of the adjusted p-value functione on the same uniform grid
used to evaluate the functional samples.
correction_method: A string containing the correction method used to
compute the adjusted p-value function.
Optionally, the list may contain the following components:
global_pvalue: A numeric value containing the global p-value. Only
present if the correction argument is set to "Global".
pvalue_matrix: A numeric matrix of shape containing
the p-values of the interval-wise tests. Element contains
the p-value of the test performed on the interval indexed by
. Only present if the correction argument is
set to "IWT".
Lundtorp Olsen, Niels, Alessia Pini, and Simone Vantini. 2021. "False discovery rate for functional data." TEST 30, 784–809.
global2(), twt2(), pct2(), iwt2() for calling directly
one of the other tests, functional_two_sample_test() for calling the
interface test and plot.fts() for plotting the results.
# Performing the fBH for two populations FDR_result <- fdr2(NASAtemp$paris, NASAtemp$milan) # Plotting the results of the fBH plot( FDR_result, xrange = c(0, 12), title = "FDR results for testing mean differences" ) # Selecting the significant components at 5% level which(FDR_result$adjusted_pvalues < 0.05)# Performing the fBH for two populations FDR_result <- fdr2(NASAtemp$paris, NASAtemp$milan) # Plotting the results of the fBH plot( FDR_result, xrange = c(0, 12), title = "FDR results for testing mean differences" ) # Selecting the significant components at 5% level which(FDR_result$adjusted_pvalues < 0.05)
Implements local testing procedures for comparing the mean functions of multiple functional populations in a one-way or multi-way functional analysis of variance (FANOVA) 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 can be computed according to the following methods:
global testing (controlling the FWER weakly)
interval-wise testing (controlling the interval-wise error rate)
threshold-wise testing (controlling the FWER asymptotically)
functional_anova_test( formula, correction = c("IWT", "TWT", "Global"), dx = NULL, B = 1000L, method = c("residuals", "responses"), recycle = TRUE, stat = c("Integral", "Max") )functional_anova_test( formula, correction = c("IWT", "TWT", "Global"), dx = NULL, B = 1000L, method = c("residuals", "responses"), recycle = TRUE, stat = c("Integral", "Max") )
formula |
An object of class |
correction |
A string specifying the method used to calculate the
adjusted p-value function. Choices are |
dx |
A numeric value specifying the discretization step of the grid used
to evaluate functional data when it is provided as objects of class
|
B |
An integer value specifying the number of permutations used to
evaluate the p-values of the permutation tests. Defaults to |
method |
A string specifying the permutation scheme. |
recycle |
A boolean value specifying whether the recycled version of the
interval-wise testing procedure should be used. See Pini and Vantini (2017)
for details. Defaults to |
stat |
A string specifying the test statistic used for the global test.
|
An object of class faov containing the following components:
call: The matched call.
design_matrix: The design matrix of the functional ANOVA model.
unadjusted_pval_F: A numeric vector of length containing the
unadjusted p-value function of the global F-test evaluated on the grid.
adjusted_pval_F: A numeric vector of length containing the
adjusted p-value function of the global F-test evaluated on the grid.
unadjusted_pval_factors: A numeric matrix with one row per factor
containing the unadjusted p-value functions of the per-factor F-tests.
adjusted_pval_factors: A numeric matrix with one row per factor
containing the adjusted p-value functions of the per-factor F-tests.
data_eval: A numeric matrix containing the functional data evaluated
on the grid.
coeff_regr_eval: A numeric matrix containing the functional regression
coefficients evaluated on the grid.
fitted_eval: A numeric matrix containing the fitted values of the
functional regression evaluated on the grid.
residuals_eval: A numeric matrix containing the residuals of the
functional regression evaluated on the grid.
R2_eval: A numeric vector containing the functional R-squared evaluated
on the grid.
Optionally, the list may contain the following components:
pval_matrix_F: A matrix of dimensions of p-values of
the interval-wise F-tests. Element contains the p-value of the
test on the interval . Present only if
correction is "IWT".
pval_matrix_factors: An array of dimensions
of p-values of the per-factor interval-wise F-tests. Element
contains the p-value of the joint test on factor and interval
. Present only if correction is "IWT".
global_pval_F: Global p-value of the overall F-test. Present only if
correction is "Global".
global_pval_factors: A numeric vector of global p-values of the
per-factor F-tests. Present only if correction is "Global".
Abramowicz, K., Pini, A., Schelin, L., Stamm, A., & Vantini, S. (2022). “Domain selection and familywise error rate for functional data: A unified framework. Biometrics 79(2), 1119-1132.
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.
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.
iwt_aov(), twt_aov() and global_aov() for calling a
specific correction directly. plot.faov() for plotting the results and
summary.faov() for summarizing the results.
temperature <- rbind(NASAtemp$milan[, 1:100], NASAtemp$paris[, 1:100]) groups <- c(rep(0, 22), rep(1, 22)) # Performing the TWT for multiple populations TWT_result <- functional_anova_test( temperature ~ groups, correction = "TWT", B = 10L ) # Plotting the results of the TWT plot( TWT_result, xrange = c(0, 12), main = "TWT results for testing mean differences" ) # Selecting the significant components at 5% level which(TWT_result$adjusted_pval_F < 0.05) # Performing the IWT for multiple populations IWT_result <- functional_anova_test( temperature ~ groups, correction = "IWT", B = 10L ) # Plotting the results of the IWT plot( IWT_result, xrange = c(0, 12), main = "IWT results for testing mean differences" ) # Selecting the significant components at 5% level which(IWT_result$adjusted_pval_F < 0.05)temperature <- rbind(NASAtemp$milan[, 1:100], NASAtemp$paris[, 1:100]) groups <- c(rep(0, 22), rep(1, 22)) # Performing the TWT for multiple populations TWT_result <- functional_anova_test( temperature ~ groups, correction = "TWT", B = 10L ) # Plotting the results of the TWT plot( TWT_result, xrange = c(0, 12), main = "TWT results for testing mean differences" ) # Selecting the significant components at 5% level which(TWT_result$adjusted_pval_F < 0.05) # Performing the IWT for multiple populations IWT_result <- functional_anova_test( temperature ~ groups, correction = "IWT", B = 10L ) # Plotting the results of the IWT plot( IWT_result, xrange = c(0, 12), main = "IWT results for testing mean differences" ) # Selecting the significant components at 5% level which(IWT_result$adjusted_pval_F < 0.05)
Implements local testing procedures for testing the significance of the effects of scalar covariates on a functional response in a functional-on-scalar linear model. 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 can be computed according to the following methods:
global testing (controlling the FWER weakly)
interval-wise testing (controlling the interval-wise error rate)
threshold-wise testing (controlling the FWER asymptotically)
functional_lm_test( formula, correction = c("IWT", "TWT", "Global"), dx = NULL, B = 1000L, method = c("residuals", "responses"), recycle = TRUE, stat = c("Integral", "Max") )functional_lm_test( formula, correction = c("IWT", "TWT", "Global"), dx = NULL, B = 1000L, method = c("residuals", "responses"), recycle = TRUE, stat = c("Integral", "Max") )
formula |
An object of class |
correction |
A string specifying the method used to calculate the
adjusted p-value function. Choices are |
dx |
A numeric value specifying the discretization step of the grid used
to evaluate functional data when it is provided as objects of class
|
B |
An integer value specifying the number of permutations used to
evaluate the p-values of the permutation tests. Defaults to |
method |
A string specifying the permutation scheme. |
recycle |
A boolean value specifying whether the recycled version of the
interval-wise testing procedure should be used. See Pini and Vantini (2017)
for details. Defaults to |
stat |
A string specifying the test statistic used for the global test.
|
An object of class flm containing the following components:
call: The matched call.
design_matrix: The design matrix of the functional-on-scalar linear
model.
unadjusted_pval_F: A numeric vector of length containing the
unadjusted p-value function of the global F-test evaluated on the grid.
adjusted_pval_F: A numeric vector of length containing the
adjusted p-value function of the global F-test evaluated on the grid.
unadjusted_pval_part: A numeric matrix with one row per model term
containing the unadjusted p-value functions of the per-term t-tests.
adjusted_pval_part: A numeric matrix with one row per model term
containing the adjusted p-value functions of the per-term t-tests.
data_eval: A numeric matrix containing the functional response
evaluated on the grid.
coeff_regr_eval: A numeric matrix containing the functional regression
coefficients evaluated on the grid.
fitted_eval: A numeric matrix containing the fitted values of the
functional regression evaluated on the grid.
residuals_eval: A numeric matrix containing the residuals of the
functional regression evaluated on the grid.
R2_eval: A numeric vector containing the functional R-squared evaluated
on the grid.
Optionally, the list may contain the following components:
pval_matrix_F: A matrix of dimensions of p-values of
the interval-wise F-tests. Element contains the p-value of the
test on the interval . Present only if
correction is "IWT".
pval_matrix_part: An array of dimensions
of p-values of the per-term interval-wise t-tests. Element
contains the p-value of the joint test on term and interval
. Present only if correction is "IWT".
global_pval_F: Global p-value of the overall F-test. Present only if
correction is "Global".
global_pval_part: A numeric vector of global p-values of the per-term
t-tests. Present only if correction is "Global".
Abramowicz, K., Pini, A., Schelin, L., Stamm, A., & Vantini, S. (2022). “Domain selection and familywise error rate for functional data: A unified framework. Biometrics 79(2), 1119-1132.
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.
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.
iwt_lm(), twt_lm() and global_lm() for calling a
specific correction directly. plot.flm() for plotting the results and
summary.flm() for summarizing the results.
# Defining the covariates temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the TWT TWT_result <- functional_lm_test( temperature ~ groups, correction = "TWT", B = 10L ) # Summary of the TWT results summary(TWT_result)# Defining the covariates temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the TWT TWT_result <- functional_lm_test( temperature ~ groups, correction = "TWT", B = 10L ) # Summary of the TWT results summary(TWT_result)
The function implements local testing procedures for testing the center of symmetry of a functional population. 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 can be computed according to the following methods:
interval-wise testing (controlling the interval-wise error rate)
functional_one_sample_test( data, correction = c("IWT"), mu = 0, dx = NULL, n_perm = 1000L, verbose = FALSE, aggregation_strategy = c("integral", "max"), recycle = TRUE )functional_one_sample_test( data, correction = c("IWT"), mu = 0, dx = NULL, n_perm = 1000L, verbose = FALSE, aggregation_strategy = c("integral", "max"), recycle = TRUE )
data |
Either a numeric matrix or an object of class |
correction |
A string specifying the correction method to perform the
local functional testing procedure and adjust the p-value function.
Currently only |
mu |
Either a numeric value or a numeric vector or an object of class
|
dx |
A numeric value specifying the step of the uniform grid on which
the data are evaluated. If |
n_perm |
An integer value specifying the number of permutations to use
for the local testing procedure. Defaults to |
verbose |
A boolean value specifying whether to print the progress of
the computation. Defaults to |
aggregation_strategy |
A string specifying the strategy to aggregate the
point-wise test statistics for the correction procedure. Possible values
are |
recycle |
A boolean value specifying whether to recycle the test
statistic values across permutations for the IWT procedure. Defaults to
|
An object of class fos containing the following components:
data: A numeric matrix of shape containing the
evaluation of the functions on a uniform grid of size .
mu: A numeric vector of shape containing the evaluation of the
functional center of symmetry under the null hypothesis on the same uniform
grid used to evaluate the functional sample.
unadjusted_pvalues: A numeric vector of size containing the
evaluation of the unadjusted p-value function on the same uniform grid
used to evaluate the functional sample.
adjusted_pvalues: A numeric vector of size containing the
evaluation of the adjusted p-value function on the same uniform grid used
to evaluate the functional sample.
correction_method: A string containing the correction method used to
compute the adjusted p-value function.
Optionally, the list may contain the following component:
pvalue_matrix: A numeric matrix of shape containing
the p-values of the interval-wise tests. Element contains the
p-value of the test performed on the interval indexed by
. Only present if the correction argument
is set to "IWT".
For the interval-wise testing procedure:
Pini, Alessia, and Simone Vantini. 2016. "The interval testing procedure: a general framework for inference in functional data analysis." Biometrics 72 (3): 835–845.
Pini, Alessia, and Simone Vantini. 2017. "Interval-Wise Testing for Functional Data." Journal of Nonparametric Statistics 29 (2): 407–24.
iwt1() for calling directly the IWT test and
plot.fos() and autoplot.fos() for plotting the results.
# Performing the IWT for one population IWT_result <- functional_one_sample_test( NASAtemp$paris, mu = 4, n_perm = 10L ) # Plotting the results of the IWT IWTimage(IWT_result, abscissa_range = c(0, 12)) # Selecting the significant components at 5% level which(IWT_result$adjusted_pvalues < 0.05)# Performing the IWT for one population IWT_result <- functional_one_sample_test( NASAtemp$paris, mu = 4, n_perm = 10L ) # Plotting the results of the IWT IWTimage(IWT_result, abscissa_range = c(0, 12)) # Selecting the significant components at 5% level which(IWT_result$adjusted_pvalues < 0.05)
The function implements local testing procedures for testing mean differences between two functional populations. 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 can be computed according to the following methods:
global testing (controlling the FWER weakly)
interval-wise testing (controlling the interval-wise error rate)
threshold-wise testing (controlling the FWER asymptotically)
partition closed testing (controlling the FWER on a partition)
functional Benjamini Hochberg (controlling the FDR)
functional_two_sample_test( data1, data2, correction = c("Global", "IWT", "TWT", "PCT", "FDR"), mu = 0, dx = NULL, n_perm = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), standardize = FALSE, verbose = FALSE, aggregation_strategy = c("integral", "max"), recycle = TRUE, partition = NULL )functional_two_sample_test( data1, data2, correction = c("Global", "IWT", "TWT", "PCT", "FDR"), mu = 0, dx = NULL, n_perm = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), standardize = FALSE, verbose = FALSE, aggregation_strategy = c("integral", "max"), recycle = TRUE, partition = NULL )
data1 |
Either a numeric matrix or an object of class |
data2 |
Either a numeric matrix or an object of class |
correction |
A string specifying the correction method to perform the
local functional testing procedure and adjust the p-value function. Choices
are |
mu |
Either a numeric value or a numeric vector or an object of class
|
dx |
A numeric value specifying the step of the uniform grid on which
the data are evaluated. If |
n_perm |
An integer value specifying the number of permutations to use
for the local testing procedure. Defaults to |
paired |
A boolean value specifying whether a paired test should be
performed. Defaults to |
alternative |
A string specifying the type of alternative hypothesis.
Choices are |
standardize |
A boolean value specifying whether to standardize the test
statistic. Defaults to |
verbose |
A boolean value specifying whether to print the progress of
the computation. Defaults to |
aggregation_strategy |
A string specifying the strategy to aggregate the
point-wise test statistics for the correction procedure. Possible values
are |
recycle |
A boolean value specifying whether to recycle the test statistic
values across permutations for the IWT procedure. Defaults to |
partition |
An integer vector of length |
An object of class fts containing the following components:
data: A numeric matrix of shape containing the
evaluation of the functions on a common uniform
grid of size .
group_labels: An integer vector of size containing
the group membership of each function.
mu: A numeric vector of shape containing the evaluation of the
functional mean difference under the null hypothesis on the same uniform
grid used to evaluate the functional samples.
unadjusted_pvalues: A numeric vector of size containing the
evaluation of the unadjusted p-value function on the same uniform grid
used to evaluate the functional samples.
adjusted_pvalues: A numeric vector of size containing the
evaluation of the adjusted p-value functione on the same uniform grid
used to evaluate the functional samples.
correction_method: A string containing the correction method used to
compute the adjusted p-value function.
Optionally, the list may contain the following components:
global_pvalue: A numeric value containing the global p-value. Only
present if the correction argument is set to "Global".
pvalue_matrix: A numeric matrix of shape containing
the p-values of the interval-wise tests. Element contains
the p-value of the test performed on the interval indexed by
. Only present if the correction argument is
set to "IWT".
For the global testing procedure:
Hall, Peter, and Nader Tajvidi. 2002. “Permutation Tests for Equality of Distributions in High-Dimensional Settings.” Biometrika 89 (2): 359–74.
Pini, Alessia, Aymeric Stamm, and Simone Vantini. 2018. “Hotelling’s T2 in Separable Hilbert Spaces.” Journal of Multivariate Analysis 167: 284–305.
For the partition closed testing procedure:
Vsevolozhskaya, Olga A, Mark C Greenwood, GJ Bellante, Scott L Powell, Rick L Lawrence, and Kevin S Repasky. 2013. “Combining Functions and the Closure Principle for Performing Follow-up Tests in Functional Analysis of Variance.” Computational Statistics & Data Analysis 67: 175–84.
Vsevolozhskaya, Olga, Mark Greenwood, and Dmitri Holodov. 2014. “Pairwise comparison of treatment levels in functional analysis of variance with application to erythrocyte hemolysis.” The Annals of Applied Statistics 8 (2): 905–25. https://doi.org/10.1214/14-AOAS723.
For the interval-wise testing procedure:
Pini, Alessia, and Simone Vantini. 2016. “The interval testing procedure: a general framework for inference in functional data analysis.” Biometrics 72 (3): 835–845.
Pini, Alessia, and Simone Vantini. 2017. “Interval-Wise Testing for Functional Data.” Journal of Nonparametric Statistics 29 (2): 407–24.
Pini, Alessia, Simone Vantini, Bianca Maria Colosimo, and Marco Grasso. 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, Konrad, Charlotte K Häger, Alessia Pini, Lina Schelin, Sara Sjöstedt de Luna, and Simone Vantini. 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–61.
For the threshold-wise testing procedure:
Abramowicz, Konrad, Alessia Pini, Lina Schelin, Sara Sjöstedt de Luna, Aymeric Stamm, and Simone Vantini. 2023. “Domain Selection and Familywise Error Rate for Functional Data: A Unified Framework.” Biometrics 79 (2): 1119–32.
For the functional Benjamini-Hochberg procedure:
Lundtorp Olsen, Niels, Alessia Pini, and Simone Vantini. 2021. "False discovery rate for functional data." TEST 30, 784–809.
global2(), iwt2(), twt2(), pct2(), fdr2() for
calling directly one specific test and plot.fts() for plotting the results.
# Performing the TWT for two populations TWT_result <- functional_two_sample_test( NASAtemp$paris, NASAtemp$milan, correction = "TWT", n_perm = 10L ) # Plotting the results of the TWT plot( TWT_result, xrange = c(0, 12), title = "TWT results for testing mean differences" ) # Selecting the significant components at 5% level which(TWT_result$adjusted_pvalues < 0.05) # Performing the IWT for two populations IWT_result <- functional_two_sample_test( NASAtemp$paris, NASAtemp$milan, correction = "IWT", n_perm = 10L ) # Plotting the results of the IWT plot( IWT_result, xrange = c(0, 12), title = "IWT results for testing mean differences" ) # Selecting the significant components at 5% level which(IWT_result$adjusted_pvalues < 0.05)# Performing the TWT for two populations TWT_result <- functional_two_sample_test( NASAtemp$paris, NASAtemp$milan, correction = "TWT", n_perm = 10L ) # Plotting the results of the TWT plot( TWT_result, xrange = c(0, 12), title = "TWT results for testing mean differences" ) # Selecting the significant components at 5% level which(TWT_result$adjusted_pvalues < 0.05) # Performing the IWT for two populations IWT_result <- functional_two_sample_test( NASAtemp$paris, NASAtemp$milan, correction = "IWT", n_perm = 10L ) # Plotting the results of the IWT plot( IWT_result, xrange = c(0, 12), title = "IWT results for testing mean differences" ) # Selecting the significant components at 5% level which(IWT_result$adjusted_pvalues < 0.05)
Implements the Global Testing procedure for comparing the mean functions of several functional populations in a one-way or multi-way functional analysis of variance framework. Functional data are tested globally. The adjusted p-value function is constant and controls the family-wise error rate weakly.
global_aov( formula, dx = NULL, n_perm = 1000L, method = c("residuals", "responses"), stat = c("Integral", "Max") ) Globalaov( formula, dx = NULL, B = 1000L, method = c("residuals", "responses"), stat = c("Integral", "Max") )global_aov( formula, dx = NULL, n_perm = 1000L, method = c("residuals", "responses"), stat = c("Integral", "Max") ) Globalaov( formula, dx = NULL, B = 1000L, method = c("residuals", "responses"), stat = c("Integral", "Max") )
formula |
An object of class |
dx |
A numeric value specifying the discretization step of the grid used
to evaluate functional data when it is provided as objects of class
|
n_perm |
An integer value specifying the number of permutations for the
permutation tests. Defaults to |
method |
A string specifying the permutation scheme. |
stat |
A string specifying the test statistic used for the global test.
|
B |
An integer value specifying the number of permutations used to
evaluate the p-values of the permutation tests. Defaults to |
An object of class faov containing the following components:
call: The matched call.
design_matrix: The design matrix of the functional ANOVA model.
unadjusted_pval_F: A numeric vector of length containing the
unadjusted p-value function of the global F-test evaluated on the grid.
adjusted_pval_F: A numeric vector of length containing the
adjusted p-value function of the global F-test evaluated on the grid.
unadjusted_pval_factors: A numeric matrix with one row per factor
containing the unadjusted p-value functions of the per-factor F-tests.
adjusted_pval_factors: A numeric matrix with one row per factor
containing the adjusted p-value functions of the per-factor F-tests.
data_eval: A numeric matrix containing the functional data evaluated
on the grid.
coeff_regr_eval: A numeric matrix containing the functional regression
coefficients evaluated on the grid.
fitted_eval: A numeric matrix containing the fitted values of the
functional regression evaluated on the grid.
residuals_eval: A numeric matrix containing the residuals of the
functional regression evaluated on the grid.
R2_eval: A numeric vector containing the functional R-squared evaluated
on the grid.
Optionally, the list may contain the following components:
pval_matrix_F: A matrix of dimensions of p-values of
the interval-wise F-tests. Element contains the p-value of the
test on the interval . Present only if
correction is "IWT".
pval_matrix_factors: An array of dimensions
of p-values of the per-factor interval-wise F-tests. Element
contains the p-value of the joint test on factor and interval
. Present only if correction is "IWT".
global_pval_F: Global p-value of the overall F-test. Present only if
correction is "Global".
global_pval_factors: A numeric vector of global p-values of the
per-factor F-tests. Present only if correction is "Global".
Abramowicz, K., Pini, A., Schelin, L., Stamm, A., & Vantini, S. (2022). “Domain selection and familywise error rate for functional data: A unified framework. Biometrics 79(2), 1119-1132.
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.
iwt_aov(), twt_aov() and global_aov() for calling a
specific correction directly. plot.faov() for plotting the results and
summary.faov() for summarizing the results.
temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the test Global_result <- global_aov(temperature ~ groups, n_perm = 1000L) # Summary of the test results summary(Global_result) # Plot of the results layout(1) plot(Global_result) # All graphics on the same device layout(matrix(1:4, nrow = 2, byrow = FALSE)) plot( Global_result, main = "NASA data", plot_adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the test Global_result <- global_aov(temperature ~ groups, n_perm = 1000L) # Summary of the test results summary(Global_result) # Plot of the results layout(1) plot(Global_result) # All graphics on the same device layout(matrix(1:4, nrow = 2, byrow = FALSE)) plot( Global_result, main = "NASA data", plot_adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )
The function implements the Global Testing procedure for testing mean differences between two functional populations. Functional data are tested globally and a global p-value and a constant adjusted p-value function are provided. The adjusted p-value function controls the family-wise error rate weakly.
global2( data1, data2, mu = 0, dx = NULL, n_perm = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), standardize = FALSE, verbose = FALSE, aggregation_strategy = c("integral", "max") ) Global2( data1, data2, mu = 0, dx = NULL, B = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), statistic = c("Integral", "Max", "Integral_std", "Max_std"), verbose = FALSE )global2( data1, data2, mu = 0, dx = NULL, n_perm = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), standardize = FALSE, verbose = FALSE, aggregation_strategy = c("integral", "max") ) Global2( data1, data2, mu = 0, dx = NULL, B = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), statistic = c("Integral", "Max", "Integral_std", "Max_std"), verbose = FALSE )
data1 |
Either a numeric matrix or an object of class |
data2 |
Either a numeric matrix or an object of class |
mu |
Either a numeric value or a numeric vector or an object of class
|
dx |
A numeric value specifying the step of the uniform grid on which
the data are evaluated. If |
n_perm |
An integer value specifying the number of permutations to use
for the local testing procedure. Defaults to |
paired |
A boolean value specifying whether a paired test should be
performed. Defaults to |
alternative |
A string specifying the type of alternative hypothesis.
Choices are |
standardize |
A boolean value specifying whether to standardize the test
statistic. Defaults to |
verbose |
A boolean value specifying whether to print the progress of
the computation. Defaults to |
aggregation_strategy |
A string specifying the strategy to aggregate the
point-wise test statistics for the correction procedure. Possible values
are |
B |
An integer value specifying the number of permutations to use
for the local testing procedure. Defaults to |
statistic |
A string specifying the test statistic to use. Possible values are:
Defaults to |
An object of class fts containing the following components:
data: A numeric matrix of shape containing the
evaluation of the functions on a common uniform
grid of size .
group_labels: An integer vector of size containing
the group membership of each function.
mu: A numeric vector of shape containing the evaluation of the
functional mean difference under the null hypothesis on the same uniform
grid used to evaluate the functional samples.
unadjusted_pvalues: A numeric vector of size containing the
evaluation of the unadjusted p-value function on the same uniform grid
used to evaluate the functional samples.
adjusted_pvalues: A numeric vector of size containing the
evaluation of the adjusted p-value functione on the same uniform grid
used to evaluate the functional samples.
correction_method: A string containing the correction method used to
compute the adjusted p-value function.
Optionally, the list may contain the following components:
global_pvalue: A numeric value containing the global p-value. Only
present if the correction argument is set to "Global".
pvalue_matrix: A numeric matrix of shape containing
the p-values of the interval-wise tests. Element contains
the p-value of the test performed on the interval indexed by
. Only present if the correction argument is
set to "IWT".
Hall, Peter, and Nader Tajvidi. 2002. “Permutation Tests for Equality of Distributions in High-Dimensional Settings.” Biometrika 89 (2): 359–74.
Pini, Alessia, Aymeric Stamm, and Simone Vantini. 2018. “Hotelling’s T2 in Separable Hilbert Spaces.” Journal of Multivariate Analysis 167: 284–305.
iwt2(), twt2(), pct2(), fdr2() for calling directly
one of the other tests, functional_two_sample_test() for calling the
interface test and plot.fts() for plotting the results.
# Performing the Global for two populations Global_result <- global2(NASAtemp$paris, NASAtemp$milan) # Plotting the results of the Global plot( Global_result, xrange = c(0, 12), title = "Global results for testing mean differences" ) # Selecting the significant components at 5% level which(Global_result$adjusted_pvalues < 0.05)# Performing the Global for two populations Global_result <- global2(NASAtemp$paris, NASAtemp$milan) # Plotting the results of the Global plot( Global_result, xrange = c(0, 12), title = "Global results for testing mean differences" ) # Selecting the significant components at 5% level which(Global_result$adjusted_pvalues < 0.05)
The function is used to fit and test functional linear models. It can be used to carry out regression, and analysis of variance. It implements the global testing procedure for testing the significance of the effects of scalar covariates on a functional population.
Globallm( formula, dx = NULL, B = 1000L, method = c("residuals", "responses"), stat = c("Integral", "Max") ) global_lm( formula, dx = NULL, n_perm = 1000L, method = c("residuals", "responses"), stat = c("Integral", "Max") )Globallm( formula, dx = NULL, B = 1000L, method = c("residuals", "responses"), stat = c("Integral", "Max") ) global_lm( formula, dx = NULL, n_perm = 1000L, method = c("residuals", "responses"), stat = c("Integral", "Max") )
formula |
An object of class |
dx |
A numeric value specifying the discretization step of the grid used
to evaluate functional data when it is provided as objects of class
|
B |
An integer value specifying the number of permutations used to
evaluate the p-values of the permutation tests. Defaults to |
method |
A string specifying the permutation scheme. |
stat |
A string specifying the test statistic used for the global test.
|
n_perm |
An integer value specifying the number of permutations for the
permutation tests. Defaults to |
An object of class flm containing the following components:
call: The matched call.
design_matrix: The design matrix of the functional-on-scalar linear
model.
unadjusted_pval_F: A numeric vector of length containing the
unadjusted p-value function of the global F-test evaluated on the grid.
adjusted_pval_F: A numeric vector of length containing the
adjusted p-value function of the global F-test evaluated on the grid.
unadjusted_pval_part: A numeric matrix with one row per model term
containing the unadjusted p-value functions of the per-term t-tests.
adjusted_pval_part: A numeric matrix with one row per model term
containing the adjusted p-value functions of the per-term t-tests.
data_eval: A numeric matrix containing the functional response
evaluated on the grid.
coeff_regr_eval: A numeric matrix containing the functional regression
coefficients evaluated on the grid.
fitted_eval: A numeric matrix containing the fitted values of the
functional regression evaluated on the grid.
residuals_eval: A numeric matrix containing the residuals of the
functional regression evaluated on the grid.
R2_eval: A numeric vector containing the functional R-squared evaluated
on the grid.
Optionally, the list may contain the following components:
pval_matrix_F: A matrix of dimensions of p-values of
the interval-wise F-tests. Element contains the p-value of the
test on the interval . Present only if
correction is "IWT".
pval_matrix_part: An array of dimensions
of p-values of the per-term interval-wise t-tests. Element
contains the p-value of the joint test on term and interval
. Present only if correction is "IWT".
global_pval_F: Global p-value of the overall F-test. Present only if
correction is "Global".
global_pval_part: A numeric vector of global p-values of the per-term
t-tests. Present only if correction is "Global".
Abramowicz, K., Pini, A., Schelin, L., Stamm, A., & Vantini, S. (2022). “Domain selection and familywise error rate for functional data: A unified framework. Biometrics 79(2), 1119-1132.
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.
iwt_lm(), twt_lm() and global_lm() for calling a
specific correction directly. plot.flm() for plotting the results and
summary.flm() for summarizing the results.
# Defining the covariates temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the Global test Global_result <- Globallm(temperature ~ groups, B = 1000) # Summary of the Global test results summary(Global_result) # Plot of the Global test results plot( Global_result, main = "NASA data", plot_adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )# Defining the covariates temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the Global test Global_result <- Globallm(temperature ~ groups, B = 1000) # Summary of the Global test results summary(Global_result) # Plot of the Global test results plot( Global_result, main = "NASA data", plot_adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )
The function implements the Interval Wise Testing procedure for testing the center of symmetry of a functional population. 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.
ITP1bspline(data, mu = 0, B = 1000, order = 2, nknots = dim(data)[2]) ITP1fourier(data, mu = 0, B = 1000, maxfrequency = floor(dim(data)[2]/2)) iwt1( data, mu = 0, n_perm = 1000L, dx = NULL, recycle = TRUE, verbose = FALSE, aggregation_strategy = c("integral", "max") ) IWT1(data, mu = 0, B = 1000L, dx = NULL, recycle = TRUE)ITP1bspline(data, mu = 0, B = 1000, order = 2, nknots = dim(data)[2]) ITP1fourier(data, mu = 0, B = 1000, maxfrequency = floor(dim(data)[2]/2)) iwt1( data, mu = 0, n_perm = 1000L, dx = NULL, recycle = TRUE, verbose = FALSE, aggregation_strategy = c("integral", "max") ) IWT1(data, mu = 0, B = 1000L, dx = NULL, recycle = TRUE)
data |
Either a numeric matrix or an object of class |
mu |
Either a numeric value or a numeric vector or an object of class
|
B |
The number of iterations of the MC algorithm to evaluate the
p-values of the permutation tests. Defaults to |
order |
Order of the B-spline basis expansion. Defaults to |
nknots |
Number of knots of the B-spline basis expansion. Defaults to
|
maxfrequency |
The maximum frequency to be used in the Fourier basis
expansion of data. Defaults to |
n_perm |
An integer value specifying the number of permutations to use
for the local testing procedure. Defaults to |
dx |
A numeric value specifying the step of the uniform grid on which
the data are evaluated. If |
recycle |
A boolean value specifying whether to recycle the test
statistic values across permutations for the IWT procedure. Defaults to
|
verbose |
A boolean value specifying whether to print the progress of
the computation. Defaults to |
aggregation_strategy |
A string specifying the strategy to aggregate the
point-wise test statistics for the correction procedure. Possible values
are |
An object of class fos containing the following components:
data: A numeric matrix of shape containing the
evaluation of the functions on a uniform grid of size .
mu: A numeric vector of shape containing the evaluation of the
functional center of symmetry under the null hypothesis on the same uniform
grid used to evaluate the functional sample.
unadjusted_pvalues: A numeric vector of size containing the
evaluation of the unadjusted p-value function on the same uniform grid
used to evaluate the functional sample.
adjusted_pvalues: A numeric vector of size containing the
evaluation of the adjusted p-value function on the same uniform grid used
to evaluate the functional sample.
correction_method: A string containing the correction method used to
compute the adjusted p-value function.
Optionally, the list may contain the following component:
pvalue_matrix: A numeric matrix of shape containing
the p-values of the interval-wise tests. Element contains the
p-value of the test performed on the interval indexed by
. Only present if the correction argument
is set to "IWT".
Pini, Alessia, and Simone Vantini. 2016. "The interval testing procedure: a general framework for inference in functional data analysis." Biometrics 72 (3): 835–845.
Pini, Alessia, and Simone Vantini. 2017. "Interval-Wise Testing for Functional Data." Journal of Nonparametric Statistics 29 (2): 407–24.
functional_one_sample_test() for the interface function and
plot.fos() and IWTimage() for plotting the results.
# Performing the IWT for one population IWT_result <- iwt1(NASAtemp$paris, mu = 4, n_perm = 10L) # Selecting the significant components at 5% level which(IWT_result$adjusted_pvalues < 0.05) # Performing the IWT for one population IWT_result <- IWT1(NASAtemp$paris, mu = 4, B = 10L) # Plotting the results of the IWT plot(IWT_result, xrange = c(0, 12), main = "Paris temperatures") # Plotting the p-value heatmap IWTimage(IWT_result, abscissa_range = c(0, 12)) # Selecting the significant components at 5% level which(IWT_result$adjusted_pval < 0.05)# Performing the IWT for one population IWT_result <- iwt1(NASAtemp$paris, mu = 4, n_perm = 10L) # Selecting the significant components at 5% level which(IWT_result$adjusted_pvalues < 0.05) # Performing the IWT for one population IWT_result <- IWT1(NASAtemp$paris, mu = 4, B = 10L) # Plotting the results of the IWT plot(IWT_result, xrange = c(0, 12), main = "Paris temperatures") # Plotting the p-value heatmap IWTimage(IWT_result, abscissa_range = c(0, 12)) # Selecting the significant components at 5% level which(IWT_result$adjusted_pval < 0.05)
The function implements the Interval Wise Testing procedure for testing mean differences between two functional populations. 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.
ITP2bspline( data1, data2, mu = 0, B = 1000, paired = FALSE, order = 2, nknots = dim(data1)[2] ) ITP2fourier( data1, data2, mu = 0, B = 1000, paired = FALSE, maxfrequency = floor(dim(data1)[2]/2) ) ITP2pafourier( data1, data2, mu = 0, B = 1000, paired = FALSE, maxfrequency = floor(dim(data1)[2]/2) ) iwt2( data1, data2, mu = 0, dx = NULL, n_perm = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), standardize = FALSE, verbose = FALSE, aggregation_strategy = c("integral", "max"), recycle = TRUE ) IWT2( data1, data2, mu = 0, dx = NULL, B = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), statistic = c("Integral", "Max", "Integral_std", "Max_std"), verbose = FALSE, recycle = TRUE )ITP2bspline( data1, data2, mu = 0, B = 1000, paired = FALSE, order = 2, nknots = dim(data1)[2] ) ITP2fourier( data1, data2, mu = 0, B = 1000, paired = FALSE, maxfrequency = floor(dim(data1)[2]/2) ) ITP2pafourier( data1, data2, mu = 0, B = 1000, paired = FALSE, maxfrequency = floor(dim(data1)[2]/2) ) iwt2( data1, data2, mu = 0, dx = NULL, n_perm = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), standardize = FALSE, verbose = FALSE, aggregation_strategy = c("integral", "max"), recycle = TRUE ) IWT2( data1, data2, mu = 0, dx = NULL, B = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), statistic = c("Integral", "Max", "Integral_std", "Max_std"), verbose = FALSE, recycle = TRUE )
data1 |
Either a numeric matrix or an object of class |
data2 |
Either a numeric matrix or an object of class |
mu |
Either a numeric value or a numeric vector or an object of class
|
B |
An integer value specifying the number of permutations to use
for the local testing procedure. Defaults to |
paired |
A boolean value specifying whether a paired test should be
performed. Defaults to |
order |
Order of the B-spline basis expansion. Defaults to |
nknots |
Number of knots of the B-spline basis expansion. Defaults to
|
maxfrequency |
The maximum frequency to be used in the Fourier basis
expansion of data. Defaults to |
dx |
A numeric value specifying the step of the uniform grid on which
the data are evaluated. If |
n_perm |
An integer value specifying the number of permutations to use
for the local testing procedure. Defaults to |
alternative |
A string specifying the type of alternative hypothesis.
Choices are |
standardize |
A boolean value specifying whether to standardize the test
statistic. Defaults to |
verbose |
A boolean value specifying whether to print the progress of
the computation. Defaults to |
aggregation_strategy |
A string specifying the strategy to aggregate the
point-wise test statistics for the correction procedure. Possible values
are |
recycle |
A boolean value specifying whether to recycle the test statistic
values across permutations for the IWT procedure. Defaults to |
statistic |
A string specifying the test statistic to use. Possible values are:
Defaults to |
An object of class fts containing the following components:
data: A numeric matrix of shape containing the
evaluation of the functions on a common uniform
grid of size .
group_labels: An integer vector of size containing
the group membership of each function.
mu: A numeric vector of shape containing the evaluation of the
functional mean difference under the null hypothesis on the same uniform
grid used to evaluate the functional samples.
unadjusted_pvalues: A numeric vector of size containing the
evaluation of the unadjusted p-value function on the same uniform grid
used to evaluate the functional samples.
adjusted_pvalues: A numeric vector of size containing the
evaluation of the adjusted p-value functione on the same uniform grid
used to evaluate the functional samples.
correction_method: A string containing the correction method used to
compute the adjusted p-value function.
Optionally, the list may contain the following components:
global_pvalue: A numeric value containing the global p-value. Only
present if the correction argument is set to "Global".
pvalue_matrix: A numeric matrix of shape containing
the p-values of the interval-wise tests. Element contains
the p-value of the test performed on the interval indexed by
. Only present if the correction argument is
set to "IWT".
Pini, Alessia, and Simone Vantini. 2016. “The interval testing procedure: a general framework for inference in functional data analysis.” Biometrics 72 (3): 835–845.
Pini, Alessia, and Simone Vantini. 2017. “Interval-Wise Testing for Functional Data.” Journal of Nonparametric Statistics 29 (2): 407–24.
Pini, Alessia, Simone Vantini, Bianca Maria Colosimo, and Marco Grasso. 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, Konrad, Charlotte K Häger, Alessia Pini, Lina Schelin, Sara Sjöstedt de Luna, and Simone Vantini. 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–61.
global2(), twt2(), pct2(), fdr2() for calling directly
one of the other tests, functional_two_sample_test() for calling the
interface test and plot.fts() for plotting the results.
# Performing the IWT for two populations IWT_result <- iwt2(NASAtemp$paris, NASAtemp$milan, n_perm = 10L) # Plotting the results of the IWT plot( IWT_result, xrange = c(0, 12), title = "IWT results for testing mean differences" ) # Plotting the p-value heatmap IWTimage(IWT_result, abscissa_range = c(0, 12)) # Selecting the significant components at 5% level which(IWT_result$adjusted_pvalues < 0.05)# Performing the IWT for two populations IWT_result <- iwt2(NASAtemp$paris, NASAtemp$milan, n_perm = 10L) # Plotting the results of the IWT plot( IWT_result, xrange = c(0, 12), title = "IWT results for testing mean differences" ) # Plotting the p-value heatmap IWTimage(IWT_result, abscissa_range = c(0, 12)) # Selecting the significant components at 5% level which(IWT_result$adjusted_pvalues < 0.05)
The function implements the Interval Testing Procedure for testing for significant differences between several functional population evaluated on a uniform grid, in a functional analysis of variance setting. Data are represented by means of the B-spline basis and the significance of each basis coefficient is tested with an interval-wise control of the Family Wise Error Rate. The default parameters of the basis expansion lead to the piece-wise interpolating function.
ITPaovbspline( formula, order = 2, nknots = dim(stats::model.response(stats::model.frame(formula)))[2], B = 1000, method = "residuals" )ITPaovbspline( formula, order = 2, nknots = dim(stats::model.response(stats::model.frame(formula)))[2], B = 1000, method = "residuals" )
formula |
An object of class " |
order |
Order of the B-spline basis expansion. The default is |
nknots |
Number of knots of the B-spline basis expansion. The default is |
B |
The number of iterations of the MC algorithm to evaluate the p-values of the permutation tests. The defualt is |
method |
Permutation method used to calculate the p-value of permutation tests. Choose " |
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 "ITPaov" 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 this case equal to |
coeff |
Matrix of dimensions |
coeff_regr |
Matrix of dimensions |
pval_F |
Unadjusted p-values of the functional F-test for each basis coefficient. |
pval_matrix_F |
Matrix of dimensions |
adjusted_pval_F |
Adjusted p-values of the functional F-test for each basis coefficient. |
pval_factors |
Unadjusted p-values of the functional F-tests on each factor of the analysis of variance, separately (rows) and each basis coefficient (columns). |
pval_matrix_factors |
Array of dimensions |
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). |
A. Pini and S. Vantini (2017). The Interval Testing Procedure: Inference for Functional Data Controlling the Family Wise Error Rate on Intervals. Biometrics 73(3): 835–845.
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.
temperature <- rbind(NASAtemp$milan,NASAtemp$paris) groups <- c(rep(0,22),rep(1,22)) # Performing the ITP ITP_result <- ITPaovbspline(temperature ~ groups,B=5,nknots=20,order=3) # Summary of the ITP results summary(ITP_result) # Plot of the ITP results plot( ITP_result, main = "NASA data", plot_adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )temperature <- rbind(NASAtemp$milan,NASAtemp$paris) groups <- c(rep(0,22),rep(1,22)) # Performing the ITP ITP_result <- ITPaovbspline(temperature ~ groups,B=5,nknots=20,order=3) # Summary of the ITP results summary(ITP_result) # Plot of the ITP results plot( ITP_result, main = "NASA data", plot_adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )
Plotting function creating a graphical output of the ITP: the p-value heat-map, the plot of the corrected p-values, and the plot of the functional data.
ITPimage(ITP_result, alpha = 0.05, abscissa_range = c(0, 1), nlevel = 20)ITPimage(ITP_result, alpha = 0.05, abscissa_range = c(0, 1), nlevel = 20)
ITP_result |
Results of the ITP, as created by
|
alpha |
Threshold for the interval-wise error rate used for the
hypothesis test. The default is |
abscissa_range |
Range of the plot abscissa. The default is
|
nlevel |
Number of desired color levels for the p-value heatmap. The
default is |
A. Pini and S. Vantini (2017). The Interval Testing Procedure: Inference for Functional Data Controlling the Family Wise Error Rate on Intervals. Biometrics 73(3): 835–845.
# Performing the ITP for two populations with the B-spline basis ITP_result <- ITP2bspline( NASAtemp$milan, NASAtemp$paris, nknots = 20, B = 10L ) # Plotting the results of the ITP ITPimage(ITP_result, abscissa_range=c(0,12)) # Selecting the significant components for the radius at 5% level which(ITP_result$corrected_pval < 0.05)# Performing the ITP for two populations with the B-spline basis ITP_result <- ITP2bspline( NASAtemp$milan, NASAtemp$paris, nknots = 20, B = 10L ) # Plotting the results of the ITP ITPimage(ITP_result, abscissa_range=c(0,12)) # Selecting the significant components for the radius at 5% level which(ITP_result$corrected_pval < 0.05)
The function is used to fit and test functional linear models. It can be used to carry out regression, and analysis of variance. It implements the Interval Testing Procedure for testing the significance of the effects of scalar covariates on a functional population evaluated on a uniform grid. Data are represented by means of the B-spline basis and the significance of each basis coefficient is tested with an interval-wise control of the Family Wise Error Rate. The default parameters of the basis expansion lead to the piece-wise interpolating function.
ITPlmbspline( formula, order = 2, nknots = dim(stats::model.response(stats::model.frame(formula)))[2], B = 10000, method = "residuals" )ITPlmbspline( formula, order = 2, nknots = dim(stats::model.response(stats::model.frame(formula)))[2], B = 10000, method = "residuals" )
formula |
An object of class " |
order |
Order of the B-spline basis expansion. The default is |
nknots |
Number of knots of the B-spline basis expansion. The default is |
B |
The number of iterations of the MC algorithm to evaluate the p-values of the permutation tests. The defualt is |
method |
Permutation method used to calculate the p-value of permutation tests. Choose " |
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 this case equal to |
coeff |
Matrix of dimensions |
coeff_regr |
Matrix of dimensions |
pval_F |
Unadjusted p-values of the functional F-test for each basis coefficient. |
pval_matrix_F |
Matrix of dimensions |
adjusted_pval_F |
Adjusted p-values of the functional F-test for each basis coefficient. |
pval_t |
Unadjusted p-values of the functional t-tests for each partial regression coefficient including the intercept (rows) and each basis coefficient (columns). |
pval_matrix_t |
Array of dimensions |
adjusted_pval_t |
adjusted p-values of the functional t-tests for each partial regression coefficient including the intercept (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_t |
Heatmap matrix of p-values of functional t-tests (used only for plots). |
A. Pini and S. Vantini (2017). The Interval Testing Procedure: Inference for Functional Data Controlling the Family Wise Error Rate on Intervals. Biometrics 73(3): 835–845.
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.
# Defining the covariates temperature <- rbind(NASAtemp$milan,NASAtemp$paris) groups <- c(rep(0,22),rep(1,22)) # Performing the ITP #ITP_result <- ITPlmbspline(temperature ~ groups,B=100,nknots=20) # Summary of the ITP results #summary(ITP_result) # Plot of the ITP results #plot(ITP_result,main='NASA data', plot_adjpval = TRUE,xlab='Day',xrange=c(1,365)) #plot(ITP_result,main='NASA data', plot_adjpval = TRUE,xlab='Day',xrange=c(1,365))# Defining the covariates temperature <- rbind(NASAtemp$milan,NASAtemp$paris) groups <- c(rep(0,22),rep(1,22)) # Performing the ITP #ITP_result <- ITPlmbspline(temperature ~ groups,B=100,nknots=20) # Summary of the ITP results #summary(ITP_result) # Plot of the ITP results #plot(ITP_result,main='NASA data', plot_adjpval = TRUE,xlab='Day',xrange=c(1,365)) #plot(ITP_result,main='NASA data', plot_adjpval = TRUE,xlab='Day',xrange=c(1,365))
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.
IWTaov( formula, dx = NULL, B = 1000L, method = c("residuals", "responses"), recycle = TRUE ) iwt_aov( formula, dx = NULL, n_perm = 1000L, method = c("residuals", "responses"), recycle = TRUE )IWTaov( formula, dx = NULL, B = 1000L, method = c("residuals", "responses"), recycle = TRUE ) iwt_aov( formula, dx = NULL, n_perm = 1000L, method = c("residuals", "responses"), recycle = TRUE )
formula |
An object of class |
dx |
A numeric value specifying the discretization step of the grid used
to evaluate functional data when it is provided as objects of class
|
B |
An integer value specifying the number of permutations used to
evaluate the p-values of the permutation tests. Defaults to |
method |
A string specifying the permutation scheme. |
recycle |
A boolean value specifying whether the recycled version of the
interval-wise testing procedure should be used. See Pini and Vantini (2017)
for details. Defaults to |
n_perm |
An integer value specifying the number of permutations for the
permutation tests. Defaults to |
An object of class faov containing the following components:
call: The matched call.
design_matrix: The design matrix of the functional ANOVA model.
unadjusted_pval_F: A numeric vector of length containing the
unadjusted p-value function of the global F-test evaluated on the grid.
adjusted_pval_F: A numeric vector of length containing the
adjusted p-value function of the global F-test evaluated on the grid.
unadjusted_pval_factors: A numeric matrix with one row per factor
containing the unadjusted p-value functions of the per-factor F-tests.
adjusted_pval_factors: A numeric matrix with one row per factor
containing the adjusted p-value functions of the per-factor F-tests.
data_eval: A numeric matrix containing the functional data evaluated
on the grid.
coeff_regr_eval: A numeric matrix containing the functional regression
coefficients evaluated on the grid.
fitted_eval: A numeric matrix containing the fitted values of the
functional regression evaluated on the grid.
residuals_eval: A numeric matrix containing the residuals of the
functional regression evaluated on the grid.
R2_eval: A numeric vector containing the functional R-squared evaluated
on the grid.
Optionally, the list may contain the following components:
pval_matrix_F: A matrix of dimensions of p-values of
the interval-wise F-tests. Element contains the p-value of the
test on the interval . Present only if
correction is "IWT".
pval_matrix_factors: An array of dimensions
of p-values of the per-factor interval-wise F-tests. Element
contains the p-value of the joint test on factor and interval
. Present only if correction is "IWT".
global_pval_F: Global p-value of the overall F-test. Present only if
correction is "Global".
global_pval_factors: A numeric vector of global p-values of the
per-factor F-tests. Present only if correction is "Global".
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.
iwt_aov(), twt_aov() and global_aov() for calling a
specific correction directly. plot.faov() for plotting the results and
summary.faov() for summarizing the results.
temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the IWT IWT_result <- IWTaov(temperature ~ groups, B = 10L) # Summary of the IWT results summary(IWT_result) # Plot of the IWT results graphics::layout(1) plot(IWT_result) # All graphics on the same device graphics::layout(matrix(1:4, nrow = 2, byrow = FALSE)) plot( IWT_result, main = "NASA data", plot.adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the IWT IWT_result <- IWTaov(temperature ~ groups, B = 10L) # Summary of the IWT results summary(IWT_result) # Plot of the IWT results graphics::layout(1) plot(IWT_result) # All graphics on the same device graphics::layout(matrix(1:4, nrow = 2, byrow = FALSE)) plot( IWT_result, main = "NASA data", plot.adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )
Plotting function creating a ggplot2 graphical output of the IWT: the p-value heat-map, the adjusted p-value function, and the functional data, assembled via patchwork.
IWTimage( IWT_result, alpha = 0.05, abscissa_range = c(0, 1), nlevel = 20L, plot_unadjusted = FALSE )IWTimage( IWT_result, alpha = 0.05, abscissa_range = c(0, 1), nlevel = 20L, plot_unadjusted = FALSE )
IWT_result |
Results of the IWT, as created by
|
alpha |
Threshold for the interval-wise error rate used for the
hypothesis test. Regions where the adjusted p-value is below |
abscissa_range |
Range of the plot abscissa. The default is |
nlevel |
Number of desired color levels for the p-value heatmap. The
default is |
plot_unadjusted |
Flag indicating if the unadjusted p-value function
has to be overlaid (dashed line) on the adjusted p-value panel. The
default is |
An object of class patchwork containing the assembled ggplot2
panels, returned invisibly. The plot is also printed as a side effect.
Pini, A., & Vantini, S. (2018). 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.
See plot.fos(), plot.fts(), plot.flm() and
plot.faov() for the plot method applied to the IWT results of one-
and two-population tests, linear models, and ANOVA, respectively.
# Performing the IWT for one population IWT_result <- functional_one_sample_test( NASAtemp$paris, mu = 4, n_perm = 10L ) # Plotting the results of the IWT IWTimage(IWT_result, abscissa_range = c(0, 12)) # Selecting the significant components at 5% level which(IWT_result$adjusted_pvalues < 0.05)# Performing the IWT for one population IWT_result <- functional_one_sample_test( NASAtemp$paris, mu = 4, n_perm = 10L ) # Plotting the results of the IWT IWTimage(IWT_result, abscissa_range = c(0, 12)) # Selecting the significant components at 5% level which(IWT_result$adjusted_pvalues < 0.05)
The function is used to fit and test functional linear models. It can be used to carry out regression, and analysis of variance. It implements the interval-wise testing procedure (IWT) for testing the significance of the effects of scalar covariates on a functional population.
IWTlm( formula, dx = NULL, B = 1000L, method = c("residuals", "responses"), recycle = TRUE ) iwt_lm( formula, dx = NULL, n_perm = 1000L, method = c("residuals", "responses"), recycle = TRUE )IWTlm( formula, dx = NULL, B = 1000L, method = c("residuals", "responses"), recycle = TRUE ) iwt_lm( formula, dx = NULL, n_perm = 1000L, method = c("residuals", "responses"), recycle = TRUE )
formula |
An object of class |
dx |
A numeric value specifying the discretization step of the grid used
to evaluate functional data when it is provided as objects of class
|
B |
An integer value specifying the number of permutations used to
evaluate the p-values of the permutation tests. Defaults to |
method |
A string specifying the permutation scheme. |
recycle |
A boolean value specifying whether the recycled version of the
interval-wise testing procedure should be used. See Pini and Vantini (2017)
for details. Defaults to |
n_perm |
An integer value specifying the number of permutations for the
permutation tests. Defaults to |
An object of class flm containing the following components:
call: The matched call.
design_matrix: The design matrix of the functional-on-scalar linear
model.
unadjusted_pval_F: A numeric vector of length containing the
unadjusted p-value function of the global F-test evaluated on the grid.
adjusted_pval_F: A numeric vector of length containing the
adjusted p-value function of the global F-test evaluated on the grid.
unadjusted_pval_part: A numeric matrix with one row per model term
containing the unadjusted p-value functions of the per-term t-tests.
adjusted_pval_part: A numeric matrix with one row per model term
containing the adjusted p-value functions of the per-term t-tests.
data_eval: A numeric matrix containing the functional response
evaluated on the grid.
coeff_regr_eval: A numeric matrix containing the functional regression
coefficients evaluated on the grid.
fitted_eval: A numeric matrix containing the fitted values of the
functional regression evaluated on the grid.
residuals_eval: A numeric matrix containing the residuals of the
functional regression evaluated on the grid.
R2_eval: A numeric vector containing the functional R-squared evaluated
on the grid.
Optionally, the list may contain the following components:
pval_matrix_F: A matrix of dimensions of p-values of
the interval-wise F-tests. Element contains the p-value of the
test on the interval . Present only if
correction is "IWT".
pval_matrix_part: An array of dimensions
of p-values of the per-term interval-wise t-tests. Element
contains the p-value of the joint test on term and interval
. Present only if correction is "IWT".
global_pval_F: Global p-value of the overall F-test. Present only if
correction is "Global".
global_pval_part: A numeric vector of global p-values of the per-term
t-tests. Present only if correction is "Global".
A. Pini and S. Vantini (2017). The Interval Testing Procedure: Inference for Functional Data Controlling the Family Wise Error Rate on Intervals. Biometrics 73(3): 835–845.
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.
iwt_lm(), twt_lm() and global_lm() for calling a
specific correction directly. plot.flm() for plotting the results and
summary.flm() for summarizing the results.
# Defining the covariates temperature <- rbind(NASAtemp$milan[, 1:100], NASAtemp$paris[, 1:100]) groups <- c(rep(0, 22), rep(1, 22)) # Performing the IWT IWT_result <- IWTlm(temperature ~ groups, B = 2L) # Summary of the IWT results summary(IWT_result) # Plot of the IWT results plot( IWT_result, main = "NASA data", plot_adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )# Defining the covariates temperature <- rbind(NASAtemp$milan[, 1:100], NASAtemp$paris[, 1:100]) groups <- c(rep(0, 22), rep(1, 22)) # Performing the IWT IWT_result <- IWTlm(temperature ~ groups, B = 2L) # Summary of the IWT results summary(IWT_result) # Plot of the IWT results plot( IWT_result, main = "NASA data", plot_adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )
It contains the daily mean temperatures registered from July 1983 to June 2005 and stored in the NASA database Earth Surface Meteorology for Solar Energy of two different geographical locations: the region (45-46 North, 9-10 East), including the city of Milan (Italy), and the region (48-49 North, 2-3 East), including the city of Paris (France).
NASAtempNASAtemp
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 June 2005 (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 June 2005 (22 years).
These data were obtained from the NASA Langley Research Center Atmospheric Science Data Center Surface meteorological and Solar Energy (SSE) web portal supported by the NASA LaRC POWER Project. Data are freely available at: NASA Surface Meteorology and Solar Energy, A Renewable Energy Resource web site (release 6.0).
The function implements the Partition Closed Testing procedure for testing mean differences between two functional populations. 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 family-wise error rate asymptotically.
pct2( data1, data2, partition, mu = 0, dx = NULL, n_perm = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), standardize = FALSE, verbose = FALSE, aggregation_strategy = c("integral", "max") ) PCT2( data1, data2, partition, mu = 0, dx = NULL, B = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), statistic = c("Integral", "Max", "Integral_std", "Max_std"), verbose = FALSE )pct2( data1, data2, partition, mu = 0, dx = NULL, n_perm = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), standardize = FALSE, verbose = FALSE, aggregation_strategy = c("integral", "max") ) PCT2( data1, data2, partition, mu = 0, dx = NULL, B = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), statistic = c("Integral", "Max", "Integral_std", "Max_std"), verbose = FALSE )
data1 |
Either a numeric matrix or an object of class |
data2 |
Either a numeric matrix or an object of class |
partition |
An integer vector of length |
mu |
Either a numeric value or a numeric vector or an object of class
|
dx |
A numeric value specifying the step of the uniform grid on which
the data are evaluated. If |
n_perm |
An integer value specifying the number of permutations to use
for the local testing procedure. Defaults to |
paired |
A boolean value specifying whether a paired test should be
performed. Defaults to |
alternative |
A string specifying the type of alternative hypothesis.
Choices are |
standardize |
A boolean value specifying whether to standardize the test
statistic. Defaults to |
verbose |
A boolean value specifying whether to print the progress of
the computation. Defaults to |
aggregation_strategy |
A string specifying the strategy to aggregate the
point-wise test statistics for the correction procedure. Possible values
are |
B |
An integer value specifying the number of permutations to use
for the local testing procedure. Defaults to |
statistic |
A string specifying the test statistic to use. Possible values are:
Defaults to |
An object of class fts containing the following components:
data: A numeric matrix of shape containing the
evaluation of the functions on a common uniform
grid of size .
group_labels: An integer vector of size containing
the group membership of each function.
mu: A numeric vector of shape containing the evaluation of the
functional mean difference under the null hypothesis on the same uniform
grid used to evaluate the functional samples.
unadjusted_pvalues: A numeric vector of size containing the
evaluation of the unadjusted p-value function on the same uniform grid
used to evaluate the functional samples.
adjusted_pvalues: A numeric vector of size containing the
evaluation of the adjusted p-value functione on the same uniform grid
used to evaluate the functional samples.
correction_method: A string containing the correction method used to
compute the adjusted p-value function.
Optionally, the list may contain the following components:
global_pvalue: A numeric value containing the global p-value. Only
present if the correction argument is set to "Global".
pvalue_matrix: A numeric matrix of shape containing
the p-values of the interval-wise tests. Element contains
the p-value of the test performed on the interval indexed by
. Only present if the correction argument is
set to "IWT".
Vsevolozhskaya, Olga A, Mark C Greenwood, GJ Bellante, Scott L Powell, Rick L Lawrence, and Kevin S Repasky. 2013. “Combining Functions and the Closure Principle for Performing Follow-up Tests in Functional Analysis of Variance.” Computational Statistics & Data Analysis 67: 175–84.
Vsevolozhskaya, Olga, Mark Greenwood, and Dmitri Holodov. 2014. “Pairwise comparison of treatment levels in functional analysis of variance with application to erythrocyte hemolysis.” The Annals of Applied Statistics 8 (2): 905–25. https://doi.org/10.1214/14-AOAS723.
global2(), twt2(), iwt2(), fdr2() for calling directly
one of the other tests, functional_two_sample_test() for calling the
interface test and plot.fts() for plotting the results.
# Performing the PCT for two populations # Choosing as partition the 4 seasons of the year partition <- c( rep(1, 31 + 28 + 21), rep(2, 10 + 30 + 31 + 21), rep(3, 9 + 31 + 31 + 23), rep(4, 7 + 31 + 30 + 21), rep(1, 10) ) partition <- factor(partition) PCT_result <- PCT2(NASAtemp$paris, NASAtemp$milan, partition = partition) # Plotting the results of the PCT plot( PCT_result, xrange = c(0, 12), title = "PCT results for testing mean differences" ) # Selecting the significant components at 5% level which(PCT_result$adjusted_pvalues < 0.05)# Performing the PCT for two populations # Choosing as partition the 4 seasons of the year partition <- c( rep(1, 31 + 28 + 21), rep(2, 10 + 30 + 31 + 21), rep(3, 9 + 31 + 31 + 23), rep(4, 7 + 31 + 30 + 21), rep(1, 10) ) partition <- factor(partition) PCT_result <- PCT2(NASAtemp$paris, NASAtemp$milan, partition = partition) # Plotting the results of the PCT plot( PCT_result, xrange = c(0, 12), title = "PCT results for testing mean differences" ) # Selecting the significant components at 5% level which(PCT_result$adjusted_pvalues < 0.05)
The S3 methods autoplot.faov() and plot.faov() are methods
for plotting results of functional analysis of variance tests. They visualize the
functional data and the adjusted p-values obtained from the testing
procedures for mean comparison of multiple groups. The plots highlight significant
effects at two levels of significance, alpha1 and alpha2, using shaded
areas.
## S3 method for class 'faov' autoplot( object, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, plot_adjpval = FALSE, ylim = NULL, col = 1, ylabel = "Functional Data", title = NULL, linewidth = 0.5, type = "l", ... ) ## S3 method for class 'faov' plot( x, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, plot_adjpval = FALSE, ylim = NULL, col = 1, ylab = "Functional Data", main = NULL, lwd = 0.5, type = "l", ... )## S3 method for class 'faov' autoplot( object, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, plot_adjpval = FALSE, ylim = NULL, col = 1, ylabel = "Functional Data", title = NULL, linewidth = 0.5, type = "l", ... ) ## S3 method for class 'faov' plot( x, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, plot_adjpval = FALSE, ylim = NULL, col = 1, ylab = "Functional Data", main = NULL, lwd = 0.5, type = "l", ... )
object, x
|
An object of class |
xrange |
A length-2 numeric vector specifying the range of the x-axis
for the plots. Defaults to |
alpha1 |
A numeric value specifying the first level of significance used
to select and display significant effects. Defaults to |
alpha2 |
A numeric value specifying the second level of significance
used to select and display significant effects. Defaults to |
plot_adjpval |
A boolean value specifying whether the plots of adjusted
p-values should be displayed. Defaults to |
ylim |
A 2-length numeric vector specifying the range of the y-axis.
Defaults to |
col |
An integer specifying the color for the plot of functional data. Defaults
to |
ylabel, ylab
|
A string specifying the label of the y-axis of the functional
data plot. Defaults to |
title, main
|
A string specifying the title of the functional data plot.
Defaults to |
linewidth, lwd
|
A numeric value specifying the width of the line for the
functional data plot. Note that the line width for the adjusted p-value
plot will be twice this value. Defaults to |
type |
A string specifying the type of plot for the functional data. Defaults
to |
... |
Other arguments passed to specific methods. Not used in this function. |
The autoplot.faov() function creates a ggplot object that
displays the functional data and the adjusted p-values. The significant
intervals at levels alpha1 and alpha2 are highlighted in the plots.
The plot.faov() function is a wrapper around autoplot.faov()
that prints the plot directly.
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.
IWTimage() for the plot of p-values heatmaps (for IWT).
temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the TWT TWT_result <- functional_anova_test( temperature ~ groups, correction = "TWT", B = 5L ) # Plotting the results of the TWT plot( TWT_result, xrange = c(0, 12), main = "TWT results for testing mean differences" )temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the TWT TWT_result <- functional_anova_test( temperature ~ groups, correction = "TWT", B = 5L ) # Plotting the results of the TWT plot( TWT_result, xrange = c(0, 12), main = "TWT results for testing mean differences" )
The S3 methods autoplot.flm() and plot.flm() are methods
for plotting results of functional-on-scalar linear model tests. They
visualize the functional regression coefficients and the adjusted p-values
obtained from the testing procedures. The plots highlight significant
effects at two levels of significance, alpha1 and alpha2, using shaded
areas.
## S3 method for class 'flm' autoplot( object, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, plot_adjpval = FALSE, col = c(1, grDevices::rainbow(dim(object$adjusted_pval_part)[1])), ylim = NULL, ylabel = "Functional Data", title = NULL, linewidth = 1, type = "l", ... ) ## S3 method for class 'flm' plot( x, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, plot_adjpval = FALSE, ylim = NULL, col = 1, ylab = "Functional Data", main = NULL, lwd = 0.5, type = "l", ... )## S3 method for class 'flm' autoplot( object, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, plot_adjpval = FALSE, col = c(1, grDevices::rainbow(dim(object$adjusted_pval_part)[1])), ylim = NULL, ylabel = "Functional Data", title = NULL, linewidth = 1, type = "l", ... ) ## S3 method for class 'flm' plot( x, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, plot_adjpval = FALSE, ylim = NULL, col = 1, ylab = "Functional Data", main = NULL, lwd = 0.5, type = "l", ... )
object, x
|
An object of class |
xrange |
A length-2 numeric vector specifying the range of the x-axis
for the plots. Defaults to |
alpha1 |
A numeric value specifying the first level of significance used
to select and display significant effects. Defaults to |
alpha2 |
A numeric value specifying the second level of significance
used to select and display significant effects. Defaults to |
plot_adjpval |
A boolean value specifying whether the plots of adjusted
p-values should be displayed. Defaults to |
col |
An integer specifying the color for the plot of functional data. Defaults
to |
ylim |
A 2-length numeric vector specifying the range of the y-axis.
Defaults to |
ylabel, ylab
|
A string specifying the label of the y-axis of the functional
data plot. Defaults to |
title, main
|
A string specifying the title of the functional data plot.
Defaults to |
linewidth, lwd
|
A numeric value specifying the width of the line for the
functional data plot. Note that the line width for the adjusted p-value
plot will be twice this value. Defaults to |
type |
A string specifying the type of plot for the functional data. Defaults
to |
... |
Other arguments passed to specific methods. Not used in this function. |
The autoplot.flm() function creates a ggplot object that
displays the functional data and the adjusted p-values. The significant
intervals at levels alpha1 and alpha2 are highlighted in the plots.
The plot.flm() function is a wrapper around autoplot.flm()
that prints the plot directly.
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.
IWTimage() for the plot of p-values heatmaps (for IWT).
temperature <- rbind(NASAtemp$milan[, 1:100], NASAtemp$paris[, 1:100]) groups <- c(rep(0, 22), rep(1, 22)) # Performing the IWT IWT_result <- IWTlm(temperature ~ groups, B = 2L) # Summary of the IWT results summary(IWT_result) # Plot of the IWT results plot( IWT_result, main = "NASA data", plot_adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )temperature <- rbind(NASAtemp$milan[, 1:100], NASAtemp$paris[, 1:100]) groups <- c(rep(0, 22), rep(1, 22)) # Performing the IWT IWT_result <- IWTlm(temperature ~ groups, B = 2L) # Summary of the IWT results summary(IWT_result) # Plot of the IWT results plot( IWT_result, main = "NASA data", plot_adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )
The S3 methods autoplot.fos() and plot.fos() are methods for plotting
results of functional one-sample tests. They visualize the functional data
and the adjusted p-values obtained from the testing procedures for testing
the center of symmetry of a functional population. The plots highlight
significant effects at two levels of significance, alpha1 and alpha2,
using shaded areas.
## S3 method for class 'fos' autoplot( object, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, ylabel = "Functional Data", title = NULL, linewidth = 0.5, ... ) ## S3 method for class 'fos' plot( x, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, ylabel = "Functional Data", title = NULL, linewidth = 0.5, ... ) ## S3 method for class 'IWT1' plot( x, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, ylab = "Functional Data", main = NULL, lwd = 1, col = 1, ylim = NULL, type = "l", ... )## S3 method for class 'fos' autoplot( object, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, ylabel = "Functional Data", title = NULL, linewidth = 0.5, ... ) ## S3 method for class 'fos' plot( x, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, ylabel = "Functional Data", title = NULL, linewidth = 0.5, ... ) ## S3 method for class 'IWT1' plot( x, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, ylab = "Functional Data", main = NULL, lwd = 1, col = 1, ylim = NULL, type = "l", ... )
object, x
|
An object of class |
xrange |
A length-2 numeric vector specifying the range of the x-axis
for the plots. Defaults to |
alpha1 |
A numeric value specifying the first level of significance used
to select and display significant effects. Defaults to |
alpha2 |
A numeric value specifying the second level of significance
used to select and display significant effects. Defaults to |
ylabel |
A string specifying the label of the y-axis of the functional
data plot. Defaults to |
title |
A string specifying the title of the plots. Defaults to |
linewidth |
A numeric value specifying the width of the line for the
functional data plot. Note that the line width for the adjusted p-value
plot will be twice this value. Defaults to |
... |
Other arguments passed to specific methods. Not used in this function. |
ylab |
Label of the y-axis (legacy alias for |
main |
Plot title (legacy alias for |
lwd |
Line width (legacy alias for |
col, ylim, type
|
Ignored; retained for backward compatibility only. |
The autoplot.fos() function creates a ggplot object that displays
the functional data (with the null mean function mu overlaid as a dashed
reference line) and the adjusted p-values. The significant intervals at
levels alpha1 and alpha2 are highlighted in both panels. The
plot.fos() function is a wrapper around autoplot.fos() that prints the
plot directly.
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.
IWTimage() for the plot of p-value heatmaps (for IWT).
# Performing the IWT for one population IWT_result <- functional_one_sample_test( NASAtemp$paris, mu = 4, n_perm = 10L ) # Plotting the results plot(IWT_result, xrange = c(0, 12), title = "Paris temperatures") # Selecting the significant components at 5% level which(IWT_result$adjusted_pvalues < 0.05)# Performing the IWT for one population IWT_result <- functional_one_sample_test( NASAtemp$paris, mu = 4, n_perm = 10L ) # Plotting the results plot(IWT_result, xrange = c(0, 12), title = "Paris temperatures") # Selecting the significant components at 5% level which(IWT_result$adjusted_pvalues < 0.05)
The S3 methods autoplot.fts() and plot.fts() are methods
for plotting results of functional two-sample tests. They visualize the
functional data and the adjusted p-values obtained from the testing
procedures for mean comparison of two groups. The plots highlight significant
effects at two levels of significance, alpha1 and alpha2, using shaded
areas.
## S3 method for class 'fts' autoplot( object, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, ylabel = "Functional Data", title = NULL, linewidth = 0.5, ... ) ## S3 method for class 'fts' plot( x, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, ylabel = "Functional Data", title = NULL, linewidth = 0.5, ... )## S3 method for class 'fts' autoplot( object, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, ylabel = "Functional Data", title = NULL, linewidth = 0.5, ... ) ## S3 method for class 'fts' plot( x, xrange = c(0, 1), alpha1 = 0.05, alpha2 = 0.01, ylabel = "Functional Data", title = NULL, linewidth = 0.5, ... )
object, x
|
An object of class |
xrange |
A length-2 numeric vector specifying the range of the x-axis
for the plots. Defaults to |
alpha1 |
A numeric value specifying the first level of significance used
to select and display significant effects. Defaults to |
alpha2 |
A numeric value specifying the second level of significance
used to select and display significant effects. Defaults to |
ylabel |
A string specifying the label of the y-axis of the functional
data plot. Defaults to |
title |
A string specifying the title of the functional data plot.
Defaults to |
linewidth |
A numeric value specifying the width of the line for the
functional data plot. Note that the line width for the adjusted p-value
plot will be twice this value. Defaults to |
... |
Other arguments passed to specific methods. Not used in this function. |
The autoplot.fts() function creates a ggplot object that
displays the functional data and the adjusted p-values. The significant
intervals at levels alpha1 and alpha2 are highlighted in the plots. The
plot.fts() function is a wrapper around autoplot.fts()
that prints the plot directly.
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.
IWTimage() for the plot of p-values heatmaps (for IWT).
# Performing the TWT for two populations TWT_result <- functional_two_sample_test( NASAtemp$paris, NASAtemp$milan, correction = "TWT", n_perm = 10L ) # Plotting the results of the TWT plot( TWT_result, xrange = c(0, 12), title = "TWT results for testing mean differences" ) # Selecting the significant components at 5% level which(TWT_result$adjusted_pval < 0.05) # Performing the IWT for two populations IWT_result <- functional_two_sample_test( NASAtemp$paris, NASAtemp$milan, correction = "IWT", n_perm = 10L ) # Plotting the results of the IWT plot( IWT_result, xrange = c(0, 12), title = "IWT results for testing mean differences" ) # Selecting the significant components at 5% level which(IWT_result$adjusted_pval < 0.05)# Performing the TWT for two populations TWT_result <- functional_two_sample_test( NASAtemp$paris, NASAtemp$milan, correction = "TWT", n_perm = 10L ) # Plotting the results of the TWT plot( TWT_result, xrange = c(0, 12), title = "TWT results for testing mean differences" ) # Selecting the significant components at 5% level which(TWT_result$adjusted_pval < 0.05) # Performing the IWT for two populations IWT_result <- functional_two_sample_test( NASAtemp$paris, NASAtemp$milan, correction = "IWT", n_perm = 10L ) # Plotting the results of the IWT plot( IWT_result, xrange = c(0, 12), title = "IWT results for testing mean differences" ) # Selecting the significant components at 5% level which(IWT_result$adjusted_pval < 0.05)
summary method for class faov. Returns a summary of the results of the
local testing procedure for functional analysis of variance: the minimum
adjusted p-values of the F-test on the whole model and on each factor are
reported.
## S3 method for class 'faov' summary(object, ...)## S3 method for class 'faov' summary(object, ...)
object |
An object of class |
... |
Further arguments passed to or from other methods. |
A list of summary statistics of the fitted functional analysis of
variance given in object, using the component call from its arguments,
plus:
factors: A data frame with one row per factor
reporting the minimum adjusted p-value of the corresponding F-test and a
significance code.
R2: A matrix giving the range of the functional
R-squared.
ftest: A data frame reporting the minimum adjusted
p-value of the global F-test and a significance code.
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.
IWTimage() for the plot of p-value heatmaps and plot.faov()
for the plot of analysis of variance results.
temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the IWT IWT_result <- functional_anova_test( temperature ~ groups, B = 10L, correction = "IWT" ) # Summary of the IWT results summary(IWT_result)temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the IWT IWT_result <- functional_anova_test( temperature ~ groups, B = 10L, correction = "IWT" ) # Summary of the IWT results summary(IWT_result)
summary method for class flm. Returns a summary of the results of the
local testing procedure for a functional-on-scalar linear model: the minimum
adjusted p-values of the F-test on the whole model and the t-tests on each
covariate are reported.
## S3 method for class 'flm' summary(object, ...)## S3 method for class 'flm' summary(object, ...)
object |
An object of class |
... |
Further arguments passed to or from other methods. |
A list of summary statistics of the fitted functional linear model
given in object, using the component call from its arguments, plus:
ttest: A data frame with one row per model term
(intercept plus each predictor) reporting the minimum adjusted p-value of
the corresponding t-test and a significance code.
R2: A matrix giving the range of the functional
R-squared.
ftest: A data frame reporting the minimum adjusted
p-value of the functional F-test and a significance code.
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.
IWTimage() for the plot of p-value heatmaps and plot.flm()
for the plot of functional linear model results.
temperature <- rbind(NASAtemp$milan[, 1:100], NASAtemp$paris[, 1:100]) groups <- c(rep(0, 22), rep(1, 22)) # Performing the IWT IWT_result <- functional_lm_test( temperature ~ groups, B = 2L, correction = "IWT" ) # Summary of the IWT results summary(IWT_result)temperature <- rbind(NASAtemp$milan[, 1:100], NASAtemp$paris[, 1:100]) groups <- c(rep(0, 22), rep(1, 22)) # Performing the IWT IWT_result <- functional_lm_test( temperature ~ groups, B = 2L, correction = "IWT" ) # Summary of the IWT results summary(IWT_result)
The function implements the Threshold Wise Testing procedure for testing mean differences between two functional populations. 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 family-wise error rate asymptotically.
twt2( data1, data2, mu = 0, dx = NULL, n_perm = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), standardize = FALSE, verbose = FALSE, aggregation_strategy = c("integral", "max") ) TWT2( data1, data2, mu = 0, dx = NULL, B = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), statistic = c("Integral", "Max", "Integral_std", "Max_std"), verbose = FALSE )twt2( data1, data2, mu = 0, dx = NULL, n_perm = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), standardize = FALSE, verbose = FALSE, aggregation_strategy = c("integral", "max") ) TWT2( data1, data2, mu = 0, dx = NULL, B = 1000L, paired = FALSE, alternative = c("two.sided", "less", "greater"), statistic = c("Integral", "Max", "Integral_std", "Max_std"), verbose = FALSE )
data1 |
Either a numeric matrix or an object of class |
data2 |
Either a numeric matrix or an object of class |
mu |
Either a numeric value or a numeric vector or an object of class
|
dx |
A numeric value specifying the step of the uniform grid on which
the data are evaluated. If |
n_perm |
An integer value specifying the number of permutations to use
for the local testing procedure. Defaults to |
paired |
A boolean value specifying whether a paired test should be
performed. Defaults to |
alternative |
A string specifying the type of alternative hypothesis.
Choices are |
standardize |
A boolean value specifying whether to standardize the test
statistic. Defaults to |
verbose |
A boolean value specifying whether to print the progress of
the computation. Defaults to |
aggregation_strategy |
A string specifying the strategy to aggregate the
point-wise test statistics for the correction procedure. Possible values
are |
B |
An integer value specifying the number of permutations to use
for the local testing procedure. Defaults to |
statistic |
A string specifying the test statistic to use. Possible values are:
Defaults to |
An object of class fts containing the following components:
data: A numeric matrix of shape containing the
evaluation of the functions on a common uniform
grid of size .
group_labels: An integer vector of size containing
the group membership of each function.
mu: A numeric vector of shape containing the evaluation of the
functional mean difference under the null hypothesis on the same uniform
grid used to evaluate the functional samples.
unadjusted_pvalues: A numeric vector of size containing the
evaluation of the unadjusted p-value function on the same uniform grid
used to evaluate the functional samples.
adjusted_pvalues: A numeric vector of size containing the
evaluation of the adjusted p-value functione on the same uniform grid
used to evaluate the functional samples.
correction_method: A string containing the correction method used to
compute the adjusted p-value function.
Optionally, the list may contain the following components:
global_pvalue: A numeric value containing the global p-value. Only
present if the correction argument is set to "Global".
pvalue_matrix: A numeric matrix of shape containing
the p-values of the interval-wise tests. Element contains
the p-value of the test performed on the interval indexed by
. Only present if the correction argument is
set to "IWT".
Abramowicz, Konrad, Alessia Pini, Lina Schelin, Sara Sjöstedt de Luna, Aymeric Stamm, and Simone Vantini. 2023. “Domain Selection and Familywise Error Rate for Functional Data: A Unified Framework.” Biometrics 79 (2): 1119–32.
global2(), iwt2(), pct2(), fdr2() for calling directly
one of the other tests, functional_two_sample_test() for calling the
interface test and plot.fts() for plotting the results.
# Performing the TWT for two populations TWT_result <- twt2(NASAtemp$paris, NASAtemp$milan) # Plotting the results of the TWT plot( TWT_result, xrange = c(0, 12), title = "TWT results for testing mean differences" ) # Selecting the significant components at 5% level which(TWT_result$adjusted_pvalues < 0.05)# Performing the TWT for two populations TWT_result <- twt2(NASAtemp$paris, NASAtemp$milan) # Plotting the results of the TWT plot( TWT_result, xrange = c(0, 12), title = "TWT results for testing mean differences" ) # Selecting the significant components at 5% level which(TWT_result$adjusted_pvalues < 0.05)
The function implements the Threshold 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 threshold-wise error rate.
TWTaov(formula, dx = NULL, B = 1000L, method = c("residuals", "responses")) twt_aov( formula, dx = NULL, n_perm = 1000L, method = c("residuals", "responses") )TWTaov(formula, dx = NULL, B = 1000L, method = c("residuals", "responses")) twt_aov( formula, dx = NULL, n_perm = 1000L, method = c("residuals", "responses") )
formula |
An object of class |
dx |
A numeric value specifying the discretization step of the grid used
to evaluate functional data when it is provided as objects of class
|
B |
An integer value specifying the number of permutations used to
evaluate the p-values of the permutation tests. Defaults to |
method |
A string specifying the permutation scheme. |
n_perm |
An integer value specifying the number of permutations for the
permutation tests. Defaults to |
An object of class faov containing the following components:
call: The matched call.
design_matrix: The design matrix of the functional ANOVA model.
unadjusted_pval_F: A numeric vector of length containing the
unadjusted p-value function of the global F-test evaluated on the grid.
adjusted_pval_F: A numeric vector of length containing the
adjusted p-value function of the global F-test evaluated on the grid.
unadjusted_pval_factors: A numeric matrix with one row per factor
containing the unadjusted p-value functions of the per-factor F-tests.
adjusted_pval_factors: A numeric matrix with one row per factor
containing the adjusted p-value functions of the per-factor F-tests.
data_eval: A numeric matrix containing the functional data evaluated
on the grid.
coeff_regr_eval: A numeric matrix containing the functional regression
coefficients evaluated on the grid.
fitted_eval: A numeric matrix containing the fitted values of the
functional regression evaluated on the grid.
residuals_eval: A numeric matrix containing the residuals of the
functional regression evaluated on the grid.
R2_eval: A numeric vector containing the functional R-squared evaluated
on the grid.
Optionally, the list may contain the following components:
pval_matrix_F: A matrix of dimensions of p-values of
the interval-wise F-tests. Element contains the p-value of the
test on the interval . Present only if
correction is "IWT".
pval_matrix_factors: An array of dimensions
of p-values of the per-factor interval-wise F-tests. Element
contains the p-value of the joint test on factor and interval
. Present only if correction is "IWT".
global_pval_F: Global p-value of the overall F-test. Present only if
correction is "Global".
global_pval_factors: A numeric vector of global p-values of the
per-factor F-tests. Present only if correction is "Global".
Abramowicz, K., Pini, A., Schelin, L., Stamm, A., & Vantini, S. (2022). “Domain selection and familywise error rate for functional data: A unified framework. Biometrics 79(2), 1119-1132.
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.
iwt_aov(), twt_aov() and global_aov() for calling a
specific correction directly. plot.faov() for plotting the results and
summary.faov() for summarizing the results.
temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the TWT TWT_result <- TWTaov(temperature ~ groups, B = 100L) # Summary of the TWT results summary(TWT_result) # Plot of the TWT results layout(1) plot(TWT_result) # All graphics on the same device layout(matrix(1:4, nrow = 2, byrow = FALSE)) plot( TWT_result, main = "NASA data", plot_adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the TWT TWT_result <- TWTaov(temperature ~ groups, B = 100L) # Summary of the TWT results summary(TWT_result) # Plot of the TWT results layout(1) plot(TWT_result) # All graphics on the same device layout(matrix(1:4, nrow = 2, byrow = FALSE)) plot( TWT_result, main = "NASA data", plot_adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )
The function is used to fit and test functional linear models. It can be used to carry out regression, and analysis of variance. It implements the Threshold-wise testing procedure (TWT) for testing the significance of the effects of scalar covariates on a functional population.
TWTlm(formula, dx = NULL, B = 1000L, method = c("residuals", "responses")) twt_lm( formula, dx = NULL, n_perm = 1000L, method = c("residuals", "responses") )TWTlm(formula, dx = NULL, B = 1000L, method = c("residuals", "responses")) twt_lm( formula, dx = NULL, n_perm = 1000L, method = c("residuals", "responses") )
formula |
An object of class |
dx |
A numeric value specifying the discretization step of the grid used
to evaluate functional data when it is provided as objects of class
|
B |
An integer value specifying the number of permutations used to
evaluate the p-values of the permutation tests. Defaults to |
method |
A string specifying the permutation scheme. |
n_perm |
An integer value specifying the number of permutations for the
permutation tests. Defaults to |
An object of class flm containing the following components:
call: The matched call.
design_matrix: The design matrix of the functional-on-scalar linear
model.
unadjusted_pval_F: A numeric vector of length containing the
unadjusted p-value function of the global F-test evaluated on the grid.
adjusted_pval_F: A numeric vector of length containing the
adjusted p-value function of the global F-test evaluated on the grid.
unadjusted_pval_part: A numeric matrix with one row per model term
containing the unadjusted p-value functions of the per-term t-tests.
adjusted_pval_part: A numeric matrix with one row per model term
containing the adjusted p-value functions of the per-term t-tests.
data_eval: A numeric matrix containing the functional response
evaluated on the grid.
coeff_regr_eval: A numeric matrix containing the functional regression
coefficients evaluated on the grid.
fitted_eval: A numeric matrix containing the fitted values of the
functional regression evaluated on the grid.
residuals_eval: A numeric matrix containing the residuals of the
functional regression evaluated on the grid.
R2_eval: A numeric vector containing the functional R-squared evaluated
on the grid.
Optionally, the list may contain the following components:
pval_matrix_F: A matrix of dimensions of p-values of
the interval-wise F-tests. Element contains the p-value of the
test on the interval . Present only if
correction is "IWT".
pval_matrix_part: An array of dimensions
of p-values of the per-term interval-wise t-tests. Element
contains the p-value of the joint test on term and interval
. Present only if correction is "IWT".
global_pval_F: Global p-value of the overall F-test. Present only if
correction is "Global".
global_pval_part: A numeric vector of global p-values of the per-term
t-tests. Present only if correction is "Global".
Abramowicz, K., Pini, A., Schelin, L., Stamm, A., & Vantini, S. (2022). “Domain selection and familywise error rate for functional data: A unified framework. Biometrics 79(2), 1119-1132.
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.
iwt_lm(), twt_lm() and global_lm() for calling a
specific correction directly. plot.flm() for plotting the results and
summary.flm() for summarizing the results.
# Defining the covariates temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the TWT TWT_result <- TWTlm(temperature ~ groups, B = 100L) # Summary of the TWT results summary(TWT_result) # Plot of the TWT results plot( TWT_result, main = "NASA data", plot_adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )# Defining the covariates temperature <- rbind(NASAtemp$milan, NASAtemp$paris) groups <- c(rep(0, 22), rep(1, 22)) # Performing the TWT TWT_result <- TWTlm(temperature ~ groups, B = 100L) # Summary of the TWT results summary(TWT_result) # Plot of the TWT results plot( TWT_result, main = "NASA data", plot_adjpval = TRUE, xlab = "Day", xrange = c(1, 365) )