Type: | Package |
Title: | Permutation Conditional Random Tests |
Version: | 0.1.2 |
Date: | 2025-01-08 |
Description: | It provides functions to perform permutation conditional random one-sample and two-samples t-tests in a multivariate framework. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Imports: | Rcpp (≥ 1.0.3), matrixStats, stats |
LinkingTo: | Rcpp, RcppArmadillo |
RoxygenNote: | 7.1.1 |
Encoding: | UTF-8 |
Language: | en-US |
NeedsCompilation: | yes |
Packaged: | 2025-01-08 14:47:54 UTC; Andreella |
Author: | Angela Andreella |
Maintainer: | Angela Andreella <angela.andreella@unitn.it> |
Repository: | CRAN |
Date/Publication: | 2025-01-09 07:50:03 UTC |
pecora-package
Description
The library is devoted to permutation-based inferential methods.
The pecora (permutation conditional random) package provides functions to perform the one-sample and two-samples t-tests using permutations/sign-flipping.
The tests comprised are: the one and two samples t-tests.
Author(s)
Angela Andreella.
Maintainer: Angela Andreella. <angela.andreella@unipd.it>
References
For the general framework of univariate and multivariate permutation tests see: Pesarin, F. (2001) Multivariate Permutation Tests with Applications in Biostatistics. Wiley, New York.
Examples
X <- matrix(rnorm(100*20), nrow=20)
out <- oneSample(X = X)
pv <- t2p(Test = out, alternative = "two.sided")
X <- matrix(rnorm(100*20), nrow=20)
rownames(X) <- c(rep(0, 10), rep(1,10))
out<- twoSamples(X = X)
pv <- t2p(Test = out, alternative = "two.sided")
Permutatation-based one sample t-test
Description
Performs sign-flipped one-sample t-tests.
Usage
oneSample(X, B = 1000, seed = 1234, permReturn = TRUE)
Arguments
X |
data matrix where columns represent the |
B |
numeric value, number of permutations to be performed, including the identity. Default is 1000. |
seed |
numeric value, specify seed. Default is 1234. |
permReturn |
logical value, |
Value
Returns an object matrix:
- tv
Matrix with dimensions
m x B
of permuted one-sample t-tests. The first column is the observed one-sample t-tests.
if permReturn = TRUE
otherwise returns:
- tv
Vector of
m
observed one-sample t-tests
Author(s)
Angela Andreella
Examples
X <- matrix(rnorm(100*20), nrow=20)
out <- oneSample(X = X)
From t-tests to p-values
Description
Use permutation distribution of a test statistic to get p-values.
Usage
t2p(Test, alternative = "two.sided", rankBased = TRUE, permReturn = TRUE, df = Inf)
Arguments
Test |
can be a matrix or a vector.
In the first case the columns represent the B permutations and rows the m tests statistic.
The observed test statistic is in the first column
and the permutation distribution in the remaining columns.
In the second case, it is a vector of length |
alternative |
character string referring to the alternative hypothesis ( |
rankBased |
logical value, |
permReturn |
logical value, |
df |
numerical value. Degrees of freedom ( |
Value
Returns an object matrix:
- pv
Matrix with dimensions
m x B
of permuted one-sample p-values. The first column is the p-values for the observed one-sample t-tests.
if permReturn = TRUE
otherwise returns:
- pv
Vector of
m
p-values for the observed one-sample t-tests
Author(s)
Angela Andreella
Examples
X <- matrix(rnorm(100*20), nrow=20)
out <- oneSample(X = X)
pv <- t2p(Test = out)
Permutatation-based two sample t-test
Description
Performs two-sample t-tests by permutations.
Usage
twoSamples(X, B = 1000, seed = 1234,
permReturn = TRUE, label = NULL)
Arguments
X |
data matrix where columns represent the |
B |
numeric value, number of permutations to be performed, including the identity. Default is 1000. |
seed |
numeric value, specify seed. Default is 1234. |
permReturn |
logical value, |
label |
by default |
Value
Returns a matrix objects:
- Test
Matrix with dimensions
m x B
of permuted two-samples t-tests. The first column is the observed one-sample t-tests.
if permReturn = TRUE
otherwise returns:
- Test
Vector of
m
observed two-samples t-tests
Author(s)
Angela Andreella
Examples
X <- matrix(rnorm(100*20), nrow=20)
rownames(X) <- c(rep(0, 10), rep(1,10))
out<- twoSamples(X = X)