Learn R Programming

Rariant (version 1.8.3)

propTests: Testing Functions

Description

Vectorized implementation of testing functions

Usage

scoreTest(x1, n1, x2, n2)
  
nmTest(x1, n1, x2, n2, delta = 0)

feTest(x1, n1, x2, n2, ...)

Arguments

x1
Mismatch counts in the test sample.
n1
Sequencing depth (total counts) in the test sample.
x2
Mismatch counts in the control sample.
n2
Sequencing depth (total counts) in the control sample.
delta
Difference to test against (default: 0).
...
Additional arguments.

Value

  • A data frame with columns

    • dhat
    {Estimate for the difference of rates 'p1' and 'p2'.}

  • p1, p2Estimates for the mismatches rates for each sample.
  • tvalT-value
  • pvalP-value

Details

These functions implement a vectorized version of the two-sided (a) Score test and (b) Miettinen-Nurminen test for the difference between to Binomial proportions.

Usage of the score test is discouraged in the settings considered here, since it is ill-defined for positions with no mismatches.

References

Miettinen, Olli, and Markku Nurminen. Comparative Analysis of Two Rates. Statistics in Medicine 4, no. 2 (1985): 213–226. doi:10.1002/sim.4780040211.

See Also

VariantTools package

Examples

Run this code
## Generate sample data
counts = data.frame(x1 = 1:5, n1 = 30, x2 = 0:4, n2 = 30)

## Score test
stat_st = with(counts, scoreTest(x1, n1, x2, n2))

## NM test
stat_nm = with(counts, nmTest(x1, n1, x2, n2))

## Fisher test
stat_fet = with(counts, feTest(x1, n1, x2, n2))

print(stat_st)

print(stat_nm)

print(stat_fet)

Run the code above in your browser using DataLab