Title: | General Multiple Tests for Univariate and Multivariate Functional Data |
---|---|
Description: | The multiple contrast tests for univariate were proposed by Munko, Ditzhaus, Pauly, Smaga, and Zhang (2023) <doi:10.48550/arXiv.2306.15259>. Recently, they were extended to the multivariate functional data in Munko, Ditzhaus, Pauly, and Smaga (2024) <doi:10.48550/arXiv.2406.01242>. These procedures enable us to evaluate the overall hypothesis regarding equality, as well as specific hypotheses defined by contrasts. In particular, we can perform post hoc tests to examine particular comparisons of interest. Different experimental designs are supported, e.g., one-way and multi-way analysis of variance for functional data. |
Authors: | Marc Ditzhaus [aut], Merle Munko [aut], Markus Pauly [aut], Lukasz Smaga [aut, cre] |
Maintainer: | Lukasz Smaga <[email protected]> |
License: | LGPL-2 | LGPL-3 | GPL-2 | GPL-3 |
Version: | 0.1.0 |
Built: | 2024-11-08 06:40:15 UTC |
Source: | CRAN |
The function gmtFD()
calculates the statistical tests based on globalizing and supremum
pointwise Hotelling's -test statistics (GPH and SPH) for the global null hypothesis and
multiple local null hypotheses. Respective
-values are obtained by a parametric bootstrap strategy.
gmtFD( x, h, blocks_contrasts, n_boot = 1000, alpha = 0.05, parallel = FALSE, n_cores = NULL, multi_gen = FALSE )
gmtFD( x, h, blocks_contrasts, n_boot = 1000, alpha = 0.05, parallel = FALSE, n_cores = NULL, multi_gen = FALSE )
x |
a list of |
h |
contrast matrix. For contrast matrices based on Dunnett’s and Tukey’s contrasts,
it can be created by the |
blocks_contrasts |
a vector with blocks of contrasts labels. The integer labels (from 1 to a number
of blocks of contrasts) should be used in non-decreasing order. For univariate case ( |
n_boot |
number of bootstrap samples. |
alpha |
significance level. |
parallel |
a logical indicating whether to use parallelization. |
n_cores |
if |
multi_gen |
a logical indicating of whether to use separate multiple generations of Gaussian processes
for the parametric bootstrap tests. The default is FALSE, which means that the processes will be
generated once in a big matrix. This method is much faster, but for larger |
The function gmtFD()
concerns the tests for the heteroscedastic
contrast testing problem for univariate and multivariate functional data. The details are
presented in Munko et al. (2023, 2024), but here we present some summary of the problem
and its solutions implemented in the package.
Suppose we have independent functional samples
,
which consist of independent and identically distributed
-dimensional stochastic processes defined
on interval
with mean function vector
and covariance function
for each
. Note that the covariance functions
of the different groups may differ from each other, i.e., heteroscedasticity is explicitly allowed.
We consider the null and alternative hypothesis
where
denotes a known contrast matrix, i.e.,
, and
is the vector of the mean functions. The formulation of this testing framework is very general
and contains many special cases like the analysis of variance for univariate and multivariate functional data
(FANOVA and FMANOVA) problems.
For univariate functional data (), we may choose
for the one-way FANOVA problem to test the null hypothesis of no main effect, where
with
denoting the unit matrix and
denoting the matrix of ones. However, there are different possible choices of the
contrast matrix
which lead to this global null hypothesis.
Many-to-one comparisons can be considered by choosing Dunnett's contrast matrix
, where the mean
functions
are compared to the mean function
of the first group regarding the different contrasts. To compare all pairs
of mean functions
with
, the Tukey's contrast matrix:
can be used.
For multivariate functional data (), we extend the matrices for
given above
as follows:
, where
is the
contrast matrix for the univariate case. For more examples of contrast matrices in different
settings, see Merle et al. (2023, 2024).
For this testing problem, we consider the pointwise Hotelling's -test statistic
for all , where
denotes the vector of all mean function estimators,
denotes the
Moore-Penrose inverse of the matrix
, and
,
is the sample covariance function for the
-th group,
. Based on this pointwise Hotelling's
-test statistic, we construct the globalizing
and supremum of pointwise Hotelling's
-test (GPH and SPH) statistics by integrating and supremum over
the pointwise Hotelling's
-test statistic, that is
We consider the parametric bootstrap test based on these test statistics. However, for better post hoc
analysis, we also consider the multiple contrast testing procedures. The main idea of multiple contrast
tests is to split up the global null hypothesis with matrix
into
matrices
with
,
, where
, and
.
This leads to the multiple testing problem with null hypotheses
To verify this family of null hypotheses, we adopt two approaches. First, we simply apply
the above test to each hypothesis , and the resulting
-values
are then corrected by the Bonferroni's method. However, this approach, denoted in the package as
GPH and SPH, may give conservative test and loss of power. Thus, we also consider the test adopting the
idea for the construction of simultaneous confidence bands proposed by Buhlmann (1998).
This test is denoted by mGPH and mSPH in the package and is a more powerful solution than the GPH and SPH
procedures, which was shown in Munko et al. (2023, 2024).
Note that the value of the test statistics for the mGPH and mSPH tests for global hypotheses are equal to
respectively, where and
are the quantiles calculated using the adaptation of the method by Buhlmann (1998).
The critical value for it is always 1.
Please have a look at a summary function designed for this package. It can be used
to simplify the output of gmtFD()
function.
A list of class multifmanova
containing the following components:
res_global |
a data frame containing the results for testing the global null hypothesis,
i.e., test statistics and |
res_multi |
all results of multiple contrasts tests for particular hypothesis in
a contrast matrix |
k |
a number of groups. |
p |
a number of variables. |
ntp |
a number of design time points. |
n |
a vector of sample sizes. |
h |
an argument |
n_boot |
an argument |
alpha |
an argument |
multi_gen |
an argument |
Buhlmann P. (1998) Sieve bootstrap for smoothing in nonstationary time series. Annals of Statistics 26, 48-83.
Dunnett C. (1955) A multiple comparison procedure for comparing several treatments with a control. Journal of the American Statistical Association 50, 1096-1121.
Munko M., Ditzhaus M., Pauly M., Smaga L., Zhang J.T. (2023) General multiple tests for functional data. Preprint https://arxiv.org/abs/2306.15259
Munko M., Ditzhaus M., Pauly M., Smaga L. (2024) Multiple comparison procedures for simultaneous inference in functional MANOVA. Preprint https://arxiv.org/abs/2406.01242
Tukey J.W. (1953) The problem of multiple comparisons. Princeton University.
# Some of the examples may run some time. # Canadian weather data set # There are three samples of mean temperature and precipitations for # fifteen weather stations in Western Canada, another fifteen in Eastern Canada, # and the remaining five in Northern Canada. # one functional variable - temperature library(fda) data_set_t <- t(CanadianWeather$dailyAv[,, "Temperature.C"]) # number of samples k <- 3 # number of variables p <- 1 # preparing data set gr_label <- rep(c(1, 2, 3), c(15, 15, 5)) data_set <- list(list(data_set_t[gr_label == 1, ]), list(data_set_t[gr_label == 2, ]), list(data_set_t[gr_label == 3, ])) # trajectories of mean temperature and precipitation oldpar <- par(mar = c(4, 4, 2, 0.1)) matplot(t(data_set_t), type = "l", col = gr_label, lty = 1, xlab = "Day", ylab = "Temperature (C)", main = "Canadian weather data set") legend("bottom", legend = c("Western Canada", "Eastern Canada", "Northern Canada"), col = 1:3, lty = 1) par(oldpar) # Tukey's contrast matrix h_tukey <- GFDmcv::contr_mat(k, type = "Tukey") h_tukey_m <- kronecker(h_tukey, diag(p)) # vector of blocks of contrasts labels blocks_contrasts <- rep(1:(nrow(h_tukey_m) / p), each = p) # testing without parallel computing res <- gmtFD(data_set, h_tukey_m, blocks_contrasts) summary(res, digits = 3) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(2, 2), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_tukey_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_tukey_m[1, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_tukey_m[2, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 2", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_tukey_m[3, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 3", xlab = "Day") par(oldpar) # Dunnett's contrast matrix h_dunnett <- GFDmcv::contr_mat(k, type = "Dunnett") h_dunnett_m <- kronecker(h_dunnett, diag(p)) # vector of blocks of contrasts labels blocks_contrasts <- rep(1:(nrow(h_dunnett_m) / p), each = p) # testing without parallel computing res <- gmtFD(data_set, h_dunnett_m, blocks_contrasts) summary(res, digits = 3) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(3, 1), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_dunnett_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[1, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[2, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 2", xlab = "Day") par(oldpar) # two functional variables - temperature and precipitation library(fda) data_set_t <- t(CanadianWeather$dailyAv[,, "Temperature.C"]) data_set_p <- t(CanadianWeather$dailyAv[,, "Precipitation.mm"]) # number of samples k <- 3 # number of variables p <- 2 # preparing data set gr_label <- rep(c(1, 2, 3), c(15, 15, 5)) data_set <- list(list(data_set_t[gr_label == 1, ], data_set_p[gr_label == 1, ]), list(data_set_t[gr_label == 2, ], data_set_p[gr_label == 2, ]), list(data_set_t[gr_label == 3, ], data_set_p[gr_label == 3, ])) # trajectories of mean temperature and precipitation oldpar <- par(mfrow = c(1, 2), mar = c(4, 4, 2, 0.1)) matplot(t(data_set_t), type = "l", col = gr_label, lty = 1, xlab = "Day", ylab = "Temperature (C)", main = "Canadian weather data set") legend("bottom", legend = c("Western Canada", "Eastern Canada", "Northern Canada"), col = 1:3, lty = 1) matplot(t(data_set_p), type = "l", col = gr_label, lty = 1, xlab = "Day", ylab = "Precipitation (mm)", main = "Canadian weather data set") legend("topleft", legend = c("Western Canada", "Eastern Canada", "Northern Canada"), col = 1:3, lty = 1) par(oldpar) # Tukey's contrast matrix h_tukey <- GFDmcv::contr_mat(k, type = "Tukey") h_tukey_m <- kronecker(h_tukey, diag(p)) # vector of blocks of contrasts labels blocks_contrasts <- rep(1:(nrow(h_tukey_m) / p), each = p) # testing without parallel computing res <- gmtFD(data_set, h_tukey_m, blocks_contrasts) summary(res, digits = 3) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(2, 2), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_tukey_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, h_tukey_m[1:2, ]), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, h_tukey_m[3:4, ]), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 2", xlab = "Day") plot(ph_test_statistic(data_set, h_tukey_m[5:6, ]), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 3", xlab = "Day") par(oldpar) # Dunnett's contrast matrix h_dunnett <- GFDmcv::contr_mat(k, type = "Dunnett") h_dunnett_m <- kronecker(h_dunnett, diag(p)) # vector of blocks of contrasts labels blocks_contrasts <- rep(1:(nrow(h_dunnett_m) / p), each = p) # testing without parallel computing res <- gmtFD(data_set, h_dunnett_m, blocks_contrasts) summary(res, digits = 3) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(3, 1), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_dunnett_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[1, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[2, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 2", xlab = "Day") par(oldpar) # testing with parallel computing library(doParallel) blocks_contrasts <- rep(1:(nrow(h_tukey_m) / p), each = p) res <- gmtFD(data_set, h_tukey_m, blocks_contrasts, parallel = TRUE, n_cores = 2) summary(res, digits = 3)
# Some of the examples may run some time. # Canadian weather data set # There are three samples of mean temperature and precipitations for # fifteen weather stations in Western Canada, another fifteen in Eastern Canada, # and the remaining five in Northern Canada. # one functional variable - temperature library(fda) data_set_t <- t(CanadianWeather$dailyAv[,, "Temperature.C"]) # number of samples k <- 3 # number of variables p <- 1 # preparing data set gr_label <- rep(c(1, 2, 3), c(15, 15, 5)) data_set <- list(list(data_set_t[gr_label == 1, ]), list(data_set_t[gr_label == 2, ]), list(data_set_t[gr_label == 3, ])) # trajectories of mean temperature and precipitation oldpar <- par(mar = c(4, 4, 2, 0.1)) matplot(t(data_set_t), type = "l", col = gr_label, lty = 1, xlab = "Day", ylab = "Temperature (C)", main = "Canadian weather data set") legend("bottom", legend = c("Western Canada", "Eastern Canada", "Northern Canada"), col = 1:3, lty = 1) par(oldpar) # Tukey's contrast matrix h_tukey <- GFDmcv::contr_mat(k, type = "Tukey") h_tukey_m <- kronecker(h_tukey, diag(p)) # vector of blocks of contrasts labels blocks_contrasts <- rep(1:(nrow(h_tukey_m) / p), each = p) # testing without parallel computing res <- gmtFD(data_set, h_tukey_m, blocks_contrasts) summary(res, digits = 3) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(2, 2), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_tukey_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_tukey_m[1, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_tukey_m[2, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 2", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_tukey_m[3, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 3", xlab = "Day") par(oldpar) # Dunnett's contrast matrix h_dunnett <- GFDmcv::contr_mat(k, type = "Dunnett") h_dunnett_m <- kronecker(h_dunnett, diag(p)) # vector of blocks of contrasts labels blocks_contrasts <- rep(1:(nrow(h_dunnett_m) / p), each = p) # testing without parallel computing res <- gmtFD(data_set, h_dunnett_m, blocks_contrasts) summary(res, digits = 3) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(3, 1), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_dunnett_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[1, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[2, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 2", xlab = "Day") par(oldpar) # two functional variables - temperature and precipitation library(fda) data_set_t <- t(CanadianWeather$dailyAv[,, "Temperature.C"]) data_set_p <- t(CanadianWeather$dailyAv[,, "Precipitation.mm"]) # number of samples k <- 3 # number of variables p <- 2 # preparing data set gr_label <- rep(c(1, 2, 3), c(15, 15, 5)) data_set <- list(list(data_set_t[gr_label == 1, ], data_set_p[gr_label == 1, ]), list(data_set_t[gr_label == 2, ], data_set_p[gr_label == 2, ]), list(data_set_t[gr_label == 3, ], data_set_p[gr_label == 3, ])) # trajectories of mean temperature and precipitation oldpar <- par(mfrow = c(1, 2), mar = c(4, 4, 2, 0.1)) matplot(t(data_set_t), type = "l", col = gr_label, lty = 1, xlab = "Day", ylab = "Temperature (C)", main = "Canadian weather data set") legend("bottom", legend = c("Western Canada", "Eastern Canada", "Northern Canada"), col = 1:3, lty = 1) matplot(t(data_set_p), type = "l", col = gr_label, lty = 1, xlab = "Day", ylab = "Precipitation (mm)", main = "Canadian weather data set") legend("topleft", legend = c("Western Canada", "Eastern Canada", "Northern Canada"), col = 1:3, lty = 1) par(oldpar) # Tukey's contrast matrix h_tukey <- GFDmcv::contr_mat(k, type = "Tukey") h_tukey_m <- kronecker(h_tukey, diag(p)) # vector of blocks of contrasts labels blocks_contrasts <- rep(1:(nrow(h_tukey_m) / p), each = p) # testing without parallel computing res <- gmtFD(data_set, h_tukey_m, blocks_contrasts) summary(res, digits = 3) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(2, 2), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_tukey_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, h_tukey_m[1:2, ]), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, h_tukey_m[3:4, ]), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 2", xlab = "Day") plot(ph_test_statistic(data_set, h_tukey_m[5:6, ]), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 3", xlab = "Day") par(oldpar) # Dunnett's contrast matrix h_dunnett <- GFDmcv::contr_mat(k, type = "Dunnett") h_dunnett_m <- kronecker(h_dunnett, diag(p)) # vector of blocks of contrasts labels blocks_contrasts <- rep(1:(nrow(h_dunnett_m) / p), each = p) # testing without parallel computing res <- gmtFD(data_set, h_dunnett_m, blocks_contrasts) summary(res, digits = 3) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(3, 1), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_dunnett_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[1, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[2, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 2", xlab = "Day") par(oldpar) # testing with parallel computing library(doParallel) blocks_contrasts <- rep(1:(nrow(h_tukey_m) / p), each = p) res <- gmtFD(data_set, h_tukey_m, blocks_contrasts, parallel = TRUE, n_cores = 2) summary(res, digits = 3)
-test statisticThe function ph_test_statistic()
calculates the pointwise Hotelling's -test statistic.
ph_test_statistic(x, h)
ph_test_statistic(x, h)
x |
a list of |
h |
contrast matrix. For contrast matrices based on Dunnett’s and Tukey’s contrasts,
it can be created by the |
For details, see the documentation of the gmtFD()
function or
the papers Munko et al. (2023, 2024).
A vector of values of the pointwise Hotelling's -test statistic.
Dunnett C. (1955) A multiple comparison procedure for comparing several treatments with a control. Journal of the American Statistical Association 50, 1096-1121.
Munko M., Ditzhaus M., Pauly M., Smaga L., Zhang J.T. (2023) General multiple tests for functional data. Preprint https://arxiv.org/abs/2306.15259
Munko M., Ditzhaus M., Pauly M., Smaga L. (2024) Multiple comparison procedures for simultaneous inference in functional MANOVA. Preprint https://arxiv.org/abs/2406.01242
Tukey J.W. (1953) The problem of multiple comparisons. Princeton University.
# Some of the examples may run some time. # Canadian weather data set # There are three samples of mean temperature and precipitations for # fifteen weather stations in Western Canada, another fifteen in Eastern Canada, # and the remaining five in Northern Canada. # one functional variable - temperature library(fda) data_set_t <- t(CanadianWeather$dailyAv[,, "Temperature.C"]) # number of samples k <- 3 # number of variables p <- 1 # preparing data set gr_label <- rep(c(1, 2, 3), c(15, 15, 5)) data_set <- list(list(data_set_t[gr_label == 1, ]), list(data_set_t[gr_label == 2, ]), list(data_set_t[gr_label == 3, ])) # Tukey's contrast matrix h_tukey <- GFDmcv::contr_mat(k, type = "Tukey") h_tukey_m <- kronecker(h_tukey, diag(p)) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(2, 2), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_tukey_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_tukey_m[1, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_tukey_m[2, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 2", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_tukey_m[3, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 3", xlab = "Day") par(oldpar) # Dunnett's contrast matrix h_dunnett <- GFDmcv::contr_mat(k, type = "Dunnett") h_dunnett_m <- kronecker(h_dunnett, diag(p)) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(3, 1), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_dunnett_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[1, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[2, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 2", xlab = "Day") par(oldpar) # two functional variables - temperature and precipitation library(fda) data_set_t <- t(CanadianWeather$dailyAv[,, "Temperature.C"]) data_set_p <- t(CanadianWeather$dailyAv[,, "Precipitation.mm"]) # number of samples k <- 3 # number of variables p <- 2 # preparing data set gr_label <- rep(c(1, 2, 3), c(15, 15, 5)) data_set <- list(list(data_set_t[gr_label == 1, ], data_set_p[gr_label == 1, ]), list(data_set_t[gr_label == 2, ], data_set_p[gr_label == 2, ]), list(data_set_t[gr_label == 3, ], data_set_p[gr_label == 3, ])) # Tukey's contrast matrix h_tukey <- GFDmcv::contr_mat(k, type = "Tukey") h_tukey_m <- kronecker(h_tukey, diag(p)) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(2, 2), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_tukey_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, h_tukey_m[1:2, ]), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, h_tukey_m[3:4, ]), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 2", xlab = "Day") plot(ph_test_statistic(data_set, h_tukey_m[5:6, ]), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 3", xlab = "Day") par(oldpar) # Dunnett's contrast matrix h_dunnett <- GFDmcv::contr_mat(k, type = "Dunnett") h_dunnett_m <- kronecker(h_dunnett, diag(p)) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(3, 1), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_dunnett_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[1, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[2, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 2", xlab = "Day") par(oldpar)
# Some of the examples may run some time. # Canadian weather data set # There are three samples of mean temperature and precipitations for # fifteen weather stations in Western Canada, another fifteen in Eastern Canada, # and the remaining five in Northern Canada. # one functional variable - temperature library(fda) data_set_t <- t(CanadianWeather$dailyAv[,, "Temperature.C"]) # number of samples k <- 3 # number of variables p <- 1 # preparing data set gr_label <- rep(c(1, 2, 3), c(15, 15, 5)) data_set <- list(list(data_set_t[gr_label == 1, ]), list(data_set_t[gr_label == 2, ]), list(data_set_t[gr_label == 3, ])) # Tukey's contrast matrix h_tukey <- GFDmcv::contr_mat(k, type = "Tukey") h_tukey_m <- kronecker(h_tukey, diag(p)) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(2, 2), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_tukey_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_tukey_m[1, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_tukey_m[2, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 2", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_tukey_m[3, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 3", xlab = "Day") par(oldpar) # Dunnett's contrast matrix h_dunnett <- GFDmcv::contr_mat(k, type = "Dunnett") h_dunnett_m <- kronecker(h_dunnett, diag(p)) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(3, 1), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_dunnett_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[1, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[2, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 2", xlab = "Day") par(oldpar) # two functional variables - temperature and precipitation library(fda) data_set_t <- t(CanadianWeather$dailyAv[,, "Temperature.C"]) data_set_p <- t(CanadianWeather$dailyAv[,, "Precipitation.mm"]) # number of samples k <- 3 # number of variables p <- 2 # preparing data set gr_label <- rep(c(1, 2, 3), c(15, 15, 5)) data_set <- list(list(data_set_t[gr_label == 1, ], data_set_p[gr_label == 1, ]), list(data_set_t[gr_label == 2, ], data_set_p[gr_label == 2, ]), list(data_set_t[gr_label == 3, ], data_set_p[gr_label == 3, ])) # Tukey's contrast matrix h_tukey <- GFDmcv::contr_mat(k, type = "Tukey") h_tukey_m <- kronecker(h_tukey, diag(p)) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(2, 2), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_tukey_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, h_tukey_m[1:2, ]), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, h_tukey_m[3:4, ]), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 2", xlab = "Day") plot(ph_test_statistic(data_set, h_tukey_m[5:6, ]), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_tukey_m))), main = "Contrast 3", xlab = "Day") par(oldpar) # Dunnett's contrast matrix h_dunnett <- GFDmcv::contr_mat(k, type = "Dunnett") h_dunnett_m <- kronecker(h_dunnett, diag(p)) # plots for pointwise Hotelling's T^2-test statistics oldpar <- par(mfrow = c(3, 1), mar = c(4, 2, 2, 0.1)) plot(ph_test_statistic(data_set, h_dunnett_m), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Global hypothesis", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[1, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 1", xlab = "Day") plot(ph_test_statistic(data_set, matrix(h_dunnett_m[2, ], 1)), type = "l", ylim = c(0, max(ph_test_statistic(data_set, h_dunnett_m))), main = "Contrast 2", xlab = "Day") par(oldpar)
Prints the summary of the global and multiple contrasts testing for functional data.
## S3 method for class 'multifmanova' summary(object, ...)
## S3 method for class 'multifmanova' summary(object, ...)
object |
a "multifmanova" object. |
... |
integer indicating the number of decimal places to be used to present the numerical results.
It can be named |
The function prints out the information about the number of functional variables,
number of samples, number of observations in each sample, number of design time points,
contrasts used, test statistics, critical values, -values of tests performed by the
gmtFD()
function. It also gives the decisions.
No return value, called for side effects.
# Some of the examples may run some time. # Canadian weather data set # There are three samples of mean temperature and precipitations for # fifteen weather stations in Western Canada, another fifteen in Eastern Canada, # and the remaining five in Northern Canada. # one functional variable - temperature library(fda) data_set_t <- t(CanadianWeather$dailyAv[,, "Temperature.C"]) # number of samples k <- 3 # number of variables p <- 1 # preparing data set gr_label <- rep(c(1, 2, 3), c(15, 15, 5)) data_set <- list(list(data_set_t[gr_label == 1, ]), list(data_set_t[gr_label == 2, ]), list(data_set_t[gr_label == 3, ])) # Tukey's contrast matrix h_tukey <- GFDmcv::contr_mat(k, type = "Tukey") h_tukey_m <- kronecker(h_tukey, diag(p)) # vector of blocks of contrasts labels blocks_contrasts <- rep(1:(nrow(h_tukey_m) / p), each = p) # testing without parallel computing res <- gmtFD(data_set, h_tukey_m, blocks_contrasts) summary(res, digits = 3) # two functional variables - temperature and precipitation library(fda) data_set_t <- t(CanadianWeather$dailyAv[,, "Temperature.C"]) data_set_p <- t(CanadianWeather$dailyAv[,, "Precipitation.mm"]) # number of samples k <- 3 # number of variables p <- 2 # preparing data set gr_label <- rep(c(1, 2, 3), c(15, 15, 5)) data_set <- list(list(data_set_t[gr_label == 1, ], data_set_p[gr_label == 1, ]), list(data_set_t[gr_label == 2, ], data_set_p[gr_label == 2, ]), list(data_set_t[gr_label == 3, ], data_set_p[gr_label == 3, ])) # Tukey's contrast matrix h_tukey <- GFDmcv::contr_mat(k, type = "Tukey") h_tukey_m <- kronecker(h_tukey, diag(p)) # vector of blocks of contrasts labels blocks_contrasts <- rep(1:(nrow(h_tukey_m) / p), each = p) # testing without parallel computing res <- gmtFD(data_set, h_tukey_m, blocks_contrasts) summary(res, digits = 3)
# Some of the examples may run some time. # Canadian weather data set # There are three samples of mean temperature and precipitations for # fifteen weather stations in Western Canada, another fifteen in Eastern Canada, # and the remaining five in Northern Canada. # one functional variable - temperature library(fda) data_set_t <- t(CanadianWeather$dailyAv[,, "Temperature.C"]) # number of samples k <- 3 # number of variables p <- 1 # preparing data set gr_label <- rep(c(1, 2, 3), c(15, 15, 5)) data_set <- list(list(data_set_t[gr_label == 1, ]), list(data_set_t[gr_label == 2, ]), list(data_set_t[gr_label == 3, ])) # Tukey's contrast matrix h_tukey <- GFDmcv::contr_mat(k, type = "Tukey") h_tukey_m <- kronecker(h_tukey, diag(p)) # vector of blocks of contrasts labels blocks_contrasts <- rep(1:(nrow(h_tukey_m) / p), each = p) # testing without parallel computing res <- gmtFD(data_set, h_tukey_m, blocks_contrasts) summary(res, digits = 3) # two functional variables - temperature and precipitation library(fda) data_set_t <- t(CanadianWeather$dailyAv[,, "Temperature.C"]) data_set_p <- t(CanadianWeather$dailyAv[,, "Precipitation.mm"]) # number of samples k <- 3 # number of variables p <- 2 # preparing data set gr_label <- rep(c(1, 2, 3), c(15, 15, 5)) data_set <- list(list(data_set_t[gr_label == 1, ], data_set_p[gr_label == 1, ]), list(data_set_t[gr_label == 2, ], data_set_p[gr_label == 2, ]), list(data_set_t[gr_label == 3, ], data_set_p[gr_label == 3, ])) # Tukey's contrast matrix h_tukey <- GFDmcv::contr_mat(k, type = "Tukey") h_tukey_m <- kronecker(h_tukey, diag(p)) # vector of blocks of contrasts labels blocks_contrasts <- rep(1:(nrow(h_tukey_m) / p), each = p) # testing without parallel computing res <- gmtFD(data_set, h_tukey_m, blocks_contrasts) summary(res, digits = 3)