Power_Proj_Test_ufDA {fPASS} | R Documentation |
Power of the Two-sample Projection-based test for functional data with known (or estimated) eigencomponents.
Description
The function Power_Proj_Test_ufDA()
computes the power of
of the two-sample projection-based test for functional response data
setting, when the group difference, the eigenfunctions of the covariance
of the data are specified at dense grid of time points, along with the
(estimated) covariance of the shrinkage
scores.
Usage
Power_Proj_Test_ufDA(
total_sample_size,
argvals,
mean_vector,
eigen_matrix,
scores_var1,
scores_var2,
weights,
sig.level = 0.05,
alloc.ratio = c(1, 1),
npc_to_pick = ncol(eigen_matrix),
nsim = 10000
)
Arguments
total_sample_size |
Total sample size combing the two groups, must be a positive integer. |
argvals |
The working grid of timepoints to evaluate the eigenfunctions and the mean functions.
It is preferred to take the working grid as dense grid so that
|
mean_vector |
The difference in the mean function evaluated at argvals, must be a numeric vector of length same as that that of argavls. |
eigen_matrix |
The matrix of eigenfunctions evaluated at argvals, must be a length(argvals) by K matrix, where K is the number of eigenfunctions. |
scores_var1 |
The true (or estimate) of covariance matrix of the shrinkage scores for the first group.
Must be symmetric ( |
scores_var2 |
The true (or estimate) of covariance matrix of the shrinkage scores for the second group.
Must be symmetric ( |
weights |
The weights to put to compute the projection |
sig.level |
Significance level of the test, default set at 0.05, must be less than 0.2. |
alloc.ratio |
The allocation ratio of samples in the each group. Note that the eigenfunctions
will still be estimated based on the total sample_size, however, the variance
of the |
npc_to_pick |
Number of eigenfunction to be used to compute the power. Typically this is becomes handy when the user want to discard few of the last eigenfunctions, typically with a very small eigenvalues. |
nsim |
The number of samples to be generated from the alternate distribution of Hotelling T statistic. Default value is 10000. |
Details
The projection-based test first extracts K eigenfunctions from the data, and then
project the mean difference function onto each of the eigenfunctions to obtain a K-dimensional
projection vector that reflects the group difference. Wang (2021) pointed that under the null
hypothesis the covariance of K-dimensional functional principal component analysis (fPCA) scores
are the same, and thus a Hotelling T^2
test with assuming equal variance of the shrinkage scores
is a valid test. However, Koner and Luo (2023) pointed out that under the alternate hypothesis,
when the difference is mean is significant, the covariance of the shrinkage scores also differ
between the groups. Therefore, while computing the power of test, we must have to derive the
distribution of the Hotelling T^2
statistic under the assumption of unequal variance. The
alogrithm for the power of multivariate Hotelling T^2
under unequal variance
is coded in pHotellingT()
function. This particular function is a wrapper around that
function, which inputs the mean difference as a function, and the eigenfunctions and
the scores, and subsequently call the pHotellingT()
function to compute the power
under unequal variance. See Koner and Luo (2023) for more details on the
formula of the non-null distribution.
Value
Power of the projection-based test for specified difference in the mean function and the eigencomponents of the covariance of the functional data.
Author(s)
Salil Koner
Maintainer: Salil Koner
salil.koner@duke.edu
References
Wang, Qiyao (2021)
Two-sample inference for sparse functional data, Electronic Journal of Statistics,
Vol. 15, 1395-1423
doi:10.1214/21-EJS1802.
See Also
See pHotellingT()
and Sim_HotellingT_unequal_var()
for samples
from Hotelling T distribution.
Examples
ngrid <- 101
interval <- c(-1,1)
gauss.quad.pts <- gss::gauss.quad(ngrid,interval) # evaluation points
working.grid <- gauss.quad.pts$pt
mean_fn <- function(t) {0.4*sin(2*pi*t)}
mean_vector <- mean_fn(working.grid)
eigen_fn <- function(t, k){ sqrt(2)*{(k==2)*sin(2*pi*t) + (k==1)*cos(2*pi*t)} }
eigen_matrix <- cbind(eigen_fn(working.grid,1), eigen_fn(working.grid,2))
mean_proj <- sapply(1:2, function(r) integrate(function(x)
eigen_fn(x,r)*mean_fn(x), interval[1], interval[2])$value)
sig1 <- diag(2)
sig2 <- 2*diag(2)
alp <- 0.05
n <- 100
k <- ncol(eigen_matrix)
cutoff <- {(n - 2)*k/(n - k -1)}*qf(1-alp, k, n-k-1)
func_power <- Power_Proj_Test_ufDA(total_sample_size=n,
argvals=working.grid,
mean_vector = mean_vector, eigen_matrix = eigen_matrix,
scores_var1 = sig1, scores_var2= sig2, weights = gauss.quad.pts$wt,
sig.level=alp, alloc.ratio = c(1,1), npc_to_pick=ncol(eigen_matrix),
nsim = 5e3)