Learn R Programming

ppiStats (version 1.38.0)

twPERM: A function to compute a permutation test on a two way table.h

Description

This function takes the entries of a two-way table and creates two binary logical vectors upon which it computes a permutation test to check for independence.

Usage

twowayPERM( v1, v2, NPERM, stat, seed = 123) makeBinVect(n11, n12, n21, n22)

Arguments

v1
A logical vector.
v2
A logical vector the same length as v1.
NPERM
A positive integer. The number of tests to be conducted.
stat
A statistical function passed into to test the permutation on two vectors.
seed
A positive integer. To set the seed for the random number generator.
n11
A postive integer. The value of (1,1) in the two way table.
n12
A postive integer. The value of (1,2) in the two way table.
n21
A postive integer. The value of (2,1) in the two way table.
n22
A postive integer. The value of (2,2) in the two way table.

Value

A numeric vector containing the p-values for the test that the permutation of the vector v1 is independent from v2.

Examples

Run this code
x <- makeBinVect(13, 17, 23, 71)

Run the code above in your browser using DataLab