Package 'pecora'

Title: Permutation Conditional Random Tests
Description: It provides functions to perform permutation conditional random one-sample and two-samples t-tests in a multivariate framework.
Authors: Angela Andreella [aut, cre] (Main author, <https://orcid.org/0000-0002-1141-3041>)
Maintainer: Angela Andreella <[email protected]>
License: GPL (>= 2)
Version: 0.1.1
Built: 2024-12-23 06:22:06 UTC
Source: CRAN

Help Index


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. <[email protected]>

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 m variables and rows the n observations.

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, TRUE to return the t-tests permutation distribution. Default is TRUE.

Value

Returns an object matrix:

tv

Matrix with dimensions mxBm 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 mm 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 mm of observed tests statistics. If rankBased = TRUE, you must provide the first option (matrix of permuted statistical tests).

alternative

character string referring to the alternative hypothesis ("greater", "lower", or "two.sided"). is "two.sided".

rankBased

logical value, TRUE to compute p-values by permutation distribution. Default @TRUE.

permReturn

logical value, TRUE to return the t-tests and p-values permutation distribution. Default @TRUE.

df

numerical value. Degrees of freedom (>0> 0, maybe non-integer). Default df = Inf

Value

Returns an object matrix:

pv

Matrix with dimensions mxBm 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 mm 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 m variables and rows the n observations. The columns' name defines the groups' label.

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, TRUE to return the t-tests and p-values permutation distribution. Default is TRUE.

label

by default label = NULL. Labels of the observations, if NULL the rows's name are considered. D

Value

Returns a matrix objects:

Test

Matrix with dimensions mxBm 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 mm 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)