Learn R Programming

MethylCapSig (version 1.0.1)

ttest: One sample and two sample $t$-test using total methylation signal per region

Description

Performs a two-sample $t$-test using the total signal observed across all variates in multivariate data.

Usage

ttest(X, Y)

Arguments

X
A matrix of dimension $n \times k$ whose rows represent the samples collected from $n$ individuals from the first group on $k$ variates.
Y
A matrix of dimension $m \times k$ whose rows correspond to samples collected from $m$ individuals from the second group on $k$ variates. Default value is NULL. If not specified, the function performs a one-sample test using X.

Value

A $2 \times 1$ vector consisting of the test statistic and the p-value.

Details

Given multivariate observations collected from two groups, a straightforward univariate test for equality of mean vectors can be constructed by converting the multivariate observations into univariate measures. ttest tests equality of means by converting the $k \times 1$ observations into sum, representing each sample by total measurement observed across the variates. Using this total measure as our observed samples, a two-sample $t$-test is performed. If both groups contain all zero observations, ($\sum_{i,j} X_{i,j}^2 = 0$ and $\sum_{i,j} Y_{i,j}^2 = 0$), then the test statistic is set equal to 0 and a p-value of 1 is returned.

Examples

Run this code
data(diffMethylData)
ttest(diffMethylData$region1.x, diffMethylData$region1.y)
# ttest(diffMethylData$region2.x, diffMethylData$region2.y)

Run the code above in your browser using DataLab