Title: | Permutation-Based All-Resolutions Inference |
---|---|
Description: | Computes the All-Resolution Inference method in the permutation framework, i.e., simultaneous lower confidence bounds for the number of true discoveries. <doi:10.1002/sim.9725>. |
Authors: | Angela Andreella [aut, cre] (Main author, <https://orcid.org/0000-0002-1141-3041>) |
Maintainer: | Angela Andreella <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.1.2 |
Built: | 2024-11-07 06:17:12 UTC |
Source: | CRAN |
Compute critical vector curve.
criticalVector(pvalues, family = "simes", alpha = 0.05, lambda, delta = 1, m = NULL)
criticalVector(pvalues, family = "simes", alpha = 0.05, lambda, delta = 1, m = NULL)
pvalues |
Matrix of pvalues with dimensions |
family |
String character. Name of the family confidence envelope to compute the critical vector
from |
alpha |
Numeric value in '[0,1]'. |
lambda |
Numeric value. |
delta |
Numeric value. |
m |
Numeric value. Number of hypothesis. Default to |
Numeric vector. Critical vector curve with length .
Angela Andreella
Andreella, A., Hemerik, J., Finos, L., Weeda, W., & Goeman, J. (2023). Permutation-based true discovery proportions for functional magnetic resonance imaging cluster analysis. Statistics in Medicine, 42(14), 2311-2340.
db <- simulateData(pi0 = 0.8, m = 100, n = 20, rho = 0) out <- pARI::signTest(X = db) pv <- cbind(out$pv, out$pv_H0) cv <- criticalVector(pvalues = pv, family = "simes", lambda = 1) plot(sort(pv[,1]), type = "l") lines(cv)
db <- simulateData(pi0 = 0.8, m = 100, n = 20, rho = 0) out <- pARI::signTest(X = db) pv <- cbind(out$pv, out$pv_H0) cv <- criticalVector(pvalues = pv, family = "simes", lambda = 1) plot(sort(pv[,1]), type = "l") lines(cv)
Calculates 1- lower confidence bound for the set-wise of false null hypotheses.
dI(ix, cv, pvalues, iterative, approx, ncomb, ...)
dI(ix, cv, pvalues, iterative, approx, ncomb, ...)
ix |
Numeric vector: set-wise hypotheses considered. |
cv |
Numeric vector: critical vector computed by |
pvalues |
If |
iterative |
Boolean value. If |
approx |
Boolean value. Default to |
ncomb |
Numeric value. If |
... |
Further arguments for the iterative approach, i.e., |
Numeric value: the lower confidence bound for the number of true discoveries concerning the cluster ix
specified.
Angela Andreella
Andreella, A., Hemerik, J., Finos, L., Weeda, W., & Goeman, J. (2023). Permutation-based true discovery proportions for functional magnetic resonance imaging cluster analysis. Statistics in Medicine, 42(14), 2311-2340.
db <- simulateData(pi0 = 0.7, m = 100, n = 20, rho = 0) out <- signTest(X = db) pv <- cbind(out$pv, out$pv_H0) cv <- criticalVector(pvalues = pv, family = "simes", lambda = 0.1, alpha = 0.1) dI(ix = c(1:100), cv = cv, pvalues = pv)
db <- simulateData(pi0 = 0.7, m = 100, n = 20, rho = 0) out <- signTest(X = db) pv <- cbind(out$pv, out$pv_H0) cv <- criticalVector(pvalues = pv, family = "simes", lambda = 0.1, alpha = 0.1) dI(ix = c(1:100), cv = cv, pvalues = pv)
Computes the optimal lambda calibration parameter used in the critical vector criticalVector
.
lambdaOpt(pvalues, family, alpha = 0.05, delta = 0, step.down = FALSE, max.step = 10, m = NULL)
lambdaOpt(pvalues, family, alpha = 0.05, delta = 0, step.down = FALSE, max.step = 10, m = NULL)
pvalues |
Matrix of |
family |
String character. Name of the family confidence envelope to compute the critical vector
from |
alpha |
Numeric value in '[0,1]'. |
delta |
Numeric value. |
step.down |
Boolean value. Default to |
max.step |
Numeric value. Default to 10. Maximum number of steps for the step down approach, so useful when |
m |
Numeric value. Number of hypotheses. Default to |
Numeric value. parameter estimate.
Angela Andreella
Andreella, A., Hemerik, J., Finos, L., Weeda, W., & Goeman, J. (2023). Permutation-based true discovery proportions for functional magnetic resonance imaging cluster analysis. Statistics in Medicine, 42(14), 2311-2340.
db <- simulateData(pi0 = 0.8, m = 100, n = 20, rho = 0) out <- signTest(X = db) pv <- cbind(out$pv, out$pv_H0) cv <- lambdaOpt(pvalues = pv, family = "simes", alpha = 0.05)
db <- simulateData(pi0 = 0.8, m = 100, n = 20, rho = 0) out <- signTest(X = db) pv <- cbind(out$pv, out$pv_H0) cv <- lambdaOpt(pvalues = pv, family = "simes", alpha = 0.05)
Performs the True Discovery Proportion brain map.
map_TDP(ARIout,path,name,mask)
map_TDP(ARIout,path,name,mask)
ARIout |
Output object by |
path |
Character string. Path to save the NIfTI file. The path does not must end with |
name |
Character string. The name of the map NIfTI file that will be used. |
mask |
NIfTI file or character string. 3D array of logical values (i.e. |
The function write directly in the path
specified the true discovery proportion NIfTI map with name specified in name
.
Angela Andreella
The main function for All-Resolutions Inference (ARI) method based on the critical vector constructed
using the -values permutation distribution. The function computes simultaneous lower bounds for the number of true discoveries
for each set of hypotheses specified in
ix
controlling family-wise error rate at level alpha
.
pARI(X= NULL, ix, alpha = 0.05, family = "simes", delta = 0, B = 1000, pvalues = NULL, test.type = "one_sample", complete = FALSE, clusters = FALSE, iterative = FALSE, approx = TRUE, ncomb = 100, step.down = FALSE, max.step = 10, ...)
pARI(X= NULL, ix, alpha = 0.05, family = "simes", delta = 0, B = 1000, pvalues = NULL, test.type = "one_sample", complete = FALSE, clusters = FALSE, iterative = FALSE, approx = TRUE, ncomb = 100, step.down = FALSE, max.step = 10, ...)
X |
Data matrix where rows represent the |
ix |
Numeric vector which expresses the set of hypotheses of interest. It can be a vector with length equals |
alpha |
Numeric value in '[0,1]'. |
family |
String character. Name of the family confidence envelope to compute the critical vector
from |
delta |
Numeric value. |
B |
Numeric value. Number of permutations, default to 1000. |
pvalues |
Matrix of |
test.type |
Character string. Choose a type of tests among |
complete |
Boolean value. If |
clusters |
Boolean value. If |
iterative |
Boolean value. If |
approx |
Boolean value. Default to |
ncomb |
Numeric value. If |
step.down |
Boolean value. Default to |
max.step |
Numeric value. Default to 10. Maximum number of steps for the step down approach, so useful when |
... |
Further arguments |
by default returns a list with the following objects:
lower bound for the number of true discoveries in the set selected
selected variables
If complete = TRUE
the raw pvalues
and cv
critical vector are also returned.
Angela Andreella
For the general framework of All-Resolutions Inference see:
Goeman, Jelle J., and Aldo Solari. "Multiple testing for exploratory research." Statistical Science 26.4 (2011): 584-597.
For permutation-based All-Resolutions Inference see:
Andreella, A., Hemerik, J., Finos, L., Weeda, W., & Goeman, J. (2023). Permutation-based true discovery proportions for functional magnetic resonance imaging cluster analysis. Statistics in Medicine, 42(14), 2311-2340.
The type of tests implemented: signTest
permTest
.
datas <- simulateData(pi0 = 0.8, m = 1000, n = 30, power = 0.9, rho = 0,seed = 123) out <- pARI(X = datas, ix = c(1:200),test.type = "one_sample") out
datas <- simulateData(pi0 = 0.8, m = 1000, n = 30, power = 0.9, rho = 0,seed = 123) out <- pARI(X = datas, ix = c(1:200),test.type = "one_sample") out
The main function for All-Resolutions Inference (ARI) method based on the critical vector constructed
using the -values permutation distribution. The function computes simultaneous lower bounds for the number of true discoveries
for each set of hypotheses specified in
ix
controlling family-wise error rate at level alpha
.
pARIbrain(copes, thr=NULL, mask=NULL, alpha=.05, clusters = NULL, alternative = "two.sided", summary_stat=c("max", "center-of-mass"), silent=FALSE, family = "simes", delta = 0, B = 1000, rand = FALSE, iterative = FALSE, approx = TRUE, ncomb = 100, step.down = FALSE, max.step = 10, ...)
pARIbrain(copes, thr=NULL, mask=NULL, alpha=.05, clusters = NULL, alternative = "two.sided", summary_stat=c("max", "center-of-mass"), silent=FALSE, family = "simes", delta = 0, B = 1000, rand = FALSE, iterative = FALSE, approx = TRUE, ncomb = 100, step.down = FALSE, max.step = 10, ...)
copes |
List of NIfTI file. The list of copes, i.e., contrasts maps, one for each subject used to compute the statistical tests. |
thr |
Numeric value. Threshold used to construct the cluster map. Default to |
mask |
NIfTI file or character string. 3D array of logical values (i.e. |
alpha |
Numeric value in '[0,1]'. |
clusters |
NIfTI file or character string. 3D array of cluster ids (0 when voxel does not belong to any cluster) or a (character) NIfTI file name.
If |
alternative |
Character string. It refers to the alternative hypothesis, must be one of |
summary_stat |
Character string. Choose among |
silent |
Boolean value. Default to |
family |
String character. Name of the family confidence envelope to compute the critical vector
from |
delta |
Numeric value. |
B |
Numeric value. Number of permutations, default to 1000. |
rand |
Boolean value. Default to |
iterative |
Boolean value. If |
approx |
Boolean value. Default to |
ncomb |
Numeric value. If |
step.down |
Boolean value. Default to |
max.step |
Numeric value. Default to 10. Maximum number of steps for the step down approach, so useful when |
... |
further arguments. See |
A list with elements:
Data.frame containing the size, the number of false null hypotheses, the number of true null hypotheses, the lower bound for the true discovery proportion, and other statistics for each cluster.
Matrix describing the clusters analyzed.
Angela Andreella
For the general framework of All-Resolutions Inference see:
Goeman, Jelle J., and Aldo Solari. "Multiple testing for exploratory research." Statistical Science 26.4 (2011): 584-597.
For All-Resolutions Inference for functional Magnetic Resonance Imaging data see:
Rosenblatt, Jonathan D., et al. "All-resolutions inference for brain imaging." Neuroimage 181 (2018): 786-796.
For permutation-based All-Resolutions Inference see:
Andreella, A., Hemerik, J., Finos, L., Weeda, W., & Goeman, J. (2023). Permutation-based true discovery proportions for functional magnetic resonance imaging cluster analysis. Statistics in Medicine, 42(14), 2311-2340.
signTest
, lambdaOpt
, criticalVector
## Not run: library(remotes) install_github("angeella/fMRIdata") library(fMRIdata) data(Auditory_clusterTH3_2) data(Auditory_copes) data(Auditory_mask) auditory_out <- pARIbrain(copes = Auditory_copes, clusters = Auditory_clusterTH3_2, mask = Auditory_mask, alpha = 0.05, silent = TRUE) auditory_out$out ## End(Not run)
## Not run: library(remotes) install_github("angeella/fMRIdata") library(fMRIdata) data(Auditory_clusterTH3_2) data(Auditory_copes) data(Auditory_mask) auditory_out <- pARIbrain(copes = Auditory_copes, clusters = Auditory_clusterTH3_2, mask = Auditory_mask, alpha = 0.05, silent = TRUE) auditory_out$out ## End(Not run)
This function computes the lower bound for the number of true discoveries within each cluster (pathways) of Gene Expression Data.
pARIgene(X= NULL, pathways, alpha = 0.05, family = "simes", delta = 0, B = 1000, test.type = "one_sample", complete = FALSE, iterative = FALSE, approx = TRUE, ncomb = 100, step.down = FALSE, max.step = 10, ...)
pARIgene(X= NULL, pathways, alpha = 0.05, family = "simes", delta = 0, B = 1000, test.type = "one_sample", complete = FALSE, iterative = FALSE, approx = TRUE, ncomb = 100, step.down = FALSE, max.step = 10, ...)
X |
Data matrix where rows represent the |
pathways |
List of pathways where names indicates the name of the pathway. |
alpha |
Numeric value in '[0,1]'. |
family |
String character. Name of the family confidence envelope to compute the critical vector
from |
delta |
Numeric value. |
B |
Numeric value. Number of permutations, default to 1000. |
test.type |
Character string. Choose a type of tests among |
complete |
Boolean value. If |
iterative |
Boolean value. If |
approx |
Boolean value. Default to |
ncomb |
Numeric value. If |
step.down |
Boolean value. Default to |
max.step |
Numeric value. Default to 10. Maximum number of steps for the step down approach, so useful when |
... |
Further arguments |
by default returns a list with the following objects:
lower bound for the number of true discoveries in the set selected
selected variables
If complete = TRUE
the raw pvalues
and cv
critical vector are also returned.
Angela Andreella
For the general framework of All-Resolutions Inference see:
Goeman, Jelle J., and Aldo Solari. "Multiple testing for exploratory research. " Statistical Science 26.4 (2011): 584-597.
For permutation-based All-Resolutions Inference see:
Andreella, A., Hemerik, J., Finos, L., Weeda, W., & Goeman, J. (2023). Permutation-based true discovery proportions for functional magnetic resonance imaging cluster analysis. Statistics in Medicine, 42(14), 2311-2340.
The type of tests implemented: signTest
permTest
.
Performs permutation-based two-sample t-tests.
permTest(X, B = 1000, alternative = "two.sided", seed = NULL, mask = NULL, rand = FALSE, label = NULL)
permTest(X, B = 1000, alternative = "two.sided", seed = NULL, mask = NULL, rand = FALSE, label = NULL)
X |
Data matrix where rows represent the |
B |
Numeric value. Number of permutations, default to 1000. |
alternative |
Character string. It refers to the alternative hypothesis, must be one of |
seed |
Integer value. If you want to specify the seed. Default to to |
mask |
NIfTI file or character string. 3D array of logical values (i.e. |
rand |
Boolean value. Default to |
label |
Numeric/character vector. Labels of the observations, if |
Returns a list with the following objects:
Vector with length equals . Observed two-samples t-tests, one for each
variable
Matrix with dimensions . Test statistics under the null hypothesis
Vector with length equals . Observed
-values, one for each
variable
Matrix with dimensions .
-values under the null hypothesis
Angela Andreella
X <- matrix(rnorm(100*20), ncol=20) X[,1:10] <- X[,1:10] + rnorm(100*10, mean = 5) out <- permTest(X = X, alternative = "two.sided", label = c(rep(1,10),rep(0,10)))
X <- matrix(rnorm(100*20), ncol=20) X[,1:10] <- X[,1:10] + rnorm(100*10, mean = 5) out <- permTest(X = X, alternative = "two.sided", label = c(rep(1,10),rep(0,10)))
-values distributionCreate a plot of permutation-based -values with corresponding specified critical vectors.
plotNullDistribution(P=NULL,family="simes",alpha = 0.05, path = getwd(), name = "plot", delta = 0, copes=NULL,mask=NULL, alternative = "two.sided", rand = FALSE, B = 1000)
plotNullDistribution(P=NULL,family="simes",alpha = 0.05, path = getwd(), name = "plot", delta = 0, copes=NULL,mask=NULL, alternative = "two.sided", rand = FALSE, B = 1000)
P |
Matrix of |
family |
String character. Name of the family confidence envelope to compute the critical vector
from |
alpha |
Numeric value in '[0,1]'. |
path |
Character string. Path to save the plot. The path does not must end with |
name |
Character string. The name of file that will be used to save the plot. Default to "plot". |
delta |
Numeric value. |
copes |
List of NIfTI file. The list of copes, i.e., contrasts maps, one for each subject used to compute the statistical tests. |
mask |
NIfTI file or character string. 3D array of logical values (i.e. |
alternative |
Character string. It refers to the alternative hypothesis, must be one of |
rand |
Boolean value. Default to |
B |
Numeric value. Number of permutations, default to 1000. |
Save a plot in path
with name specified in name
describing the -values null distribution with critical value curve and observed
-values in red.
Angela Andreella
Andreella, A., Hemerik, J., Finos, L., Weeda, W., & Goeman, J. (2023). Permutation-based true discovery proportions for functional magnetic resonance imaging cluster analysis. Statistics in Medicine, 42(14), 2311-2340.
## Not run: db <- simulateData(pi0 = 0.8, m = 100, n = 20, rho = 0) out <- signTest(X = db) pv <- cbind(out$pv, out$pv_H0) plotNullDistribution(P = pv) ## End(Not run)
## Not run: db <- simulateData(pi0 = 0.8, m = 100, n = 20, rho = 0) out <- signTest(X = db) pv <- cbind(out$pv, out$pv_H0) plotNullDistribution(P = pv) ## End(Not run)
Performs sign-flipped one-sample t-tests.
signTest(X, B = 1000, alternative = "two.sided", seed = NULL, mask = NULL, rand = FALSE)
signTest(X, B = 1000, alternative = "two.sided", seed = NULL, mask = NULL, rand = FALSE)
X |
Data matrix where rows represent the |
B |
Numeric value. Number of permutations, default to 1000. |
alternative |
Character string. It refers to the alternative hypothesis, must be one of |
seed |
Integer value. If you want to specify the seed. Default to to |
mask |
NIfTI file or character string. 3D array of logical values (i.e. |
rand |
Boolean value. Default to |
Returns a list with the following objects:
Vector with length equals . Observed two-samples t-tests, one for each
variable
Matrix with dimensions . Test statistics under the null hypothesis
Vector with length equals . Observed
-values, one for each
variable
Matrix with dimensions .
-values under the null hypothesis
Angela Andreella
X <- matrix(rnorm(100*20), ncol=20) out <- signTest(X = X, alternative = "two.sided")
X <- matrix(rnorm(100*20), ncol=20) out <- signTest(X = X, alternative = "two.sided")
Simulate normal distributed data.
simulateData(pi0,m,n, rho, seed = NULL, power = 0.8, alpha = 0.05)
simulateData(pi0,m,n, rho, seed = NULL, power = 0.8, alpha = 0.05)
pi0 |
Numeric value in '[0,1]'. Proportion of true null hypothesis. |
m |
Numeric value. Number of variables. |
n |
Numeric value. Number of observations. |
rho |
Numeric value in '[0,1]'. Level of equi-correlation between pairs of variables. |
seed |
Integer value. If you want to specify the seed. Default to to |
power |
Numeric value in '[0,1]'. Level of power. Default to 0.8. |
alpha |
Numeric value in '[0,1]'. |
Returns a matrix with dimensions .
Angela Andreella
Simulate normal distributed data with spatial correlation structure
theta
() describes how rapidly the correlation declines with respect to the distance between two voxels.
The three-dimensional coordinates of the voxels are defined as all combinations
of vector
, then
where
is the matrix containing the
euclidean distances between the three-dimensional coordinates' voxels.
So,
must be an integer value.
simulateSpatialData(pi0,m,n, theta, seed = NULL, power = 0.8, alpha = 0.05)
simulateSpatialData(pi0,m,n, theta, seed = NULL, power = 0.8, alpha = 0.05)
pi0 |
Numeric value in '[0,1]'. Proportion of true null hypothesis. |
m |
Numeric value. Number of variables. |
n |
Numeric value. Number of observations. |
theta |
Numeric value in '[0,1]'. Level of correlation between pairs of variables. See details |
seed |
Integer value. If you want to specify the seed. Default to to |
power |
Numeric value in '[0,1]'. Level of power. Default to 0.8. |
alpha |
Numeric value in '[0,1]'. |
Returns a matrix with dimensions .
Angela Andreella
Creates the statistical parametric mapping in NIfTI format.
Statmap(copes, alternative = "two.sided", path = getwd(), name = "map", Pmap = FALSE, mask = NULL)
Statmap(copes, alternative = "two.sided", path = getwd(), name = "map", Pmap = FALSE, mask = NULL)
copes |
List of NIfTI file. The list of copes, i.e., contrasts maps, one for each subject used to compute the statistical tests. |
alternative |
Character string. It refers to the alternative hypothesis, must be one of |
path |
Character string. Path to save the plot. The path does not must end with |
name |
Character string. The name of file that will be used to save the plot. Default to "map". |
Pmap |
Boolean value. If |
mask |
NIfTI file or character string. 3D array of logical values (i.e. |
Save the Statistical Parametric Mapping Nifti file in path
with name specified in name
.
Angela Andreella
## Not run: library(fMRIdata) data(Auditory_copes) data(Auditory_mask) Statmap(copes = Auditory_copes, mask = Auditory_mask) ## End(Not run)
## Not run: library(fMRIdata) data(Auditory_copes) data(Auditory_mask) Statmap(copes = Auditory_copes, mask = Auditory_mask) ## End(Not run)