getPval: Calculating p-values for discrete data

Description Usage Arguments Value Author(s) References Examples

View source: R/Pval.R

Description

The function for calculating the original available p-values and all attaianble p-values for the corresponding hypothesis.

Usage

1
getPval(raw.data, test.type, alternative)

Arguments

raw.data

original data set with count number for treatment group and study group. The data set type could be matrix or data.frame.

test.type

there are two discrete test available now, must be one of "FET" for Fisher's Exact Test and "BET" for Binomial Exact Test.

alternative

indicates the alternative hypothesis and must be one of "two.sided", "greater" or "less".

Value

A numeric vector of the adjusted p-values (of the same length as p).

Author(s)

Yalin Zhu

References

Zhu, Y., & Guo, W. (2017). Familywise error rate controlling procedures for discrete data arXiv preprint arXiv:1711.08147.

Clopper, C. J. & Pearson, E. S. (1934). The use of confidence or fiducial limits illustrated in the case of the binomial. Biometrika, 26: 404-413.

Fisher, R. A. (1922). On the Interpretation of χ^2 from Contingency Tables, and the Calculation of P. Journal of the Royal Statistical Society, 85: 87-94.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 ## Using Fisher's Exact Test to get the avaiable and attainablep-values
 # import raw data set as data.frame type
 df <-  data.frame(X1=c(4, 2, 2, 13, 6, 8, 4, 0, 1), N1 = rep(148, 9),
 	X2 = c(0, 0, 1, 3, 2, 1, 2, 2, 2), N2 = rep(132, 9))
 # obtain the avaiable p-values and attainable p-values using two-sided Fisher's Exact Test
 getPval(raw.data=df, test.type = "FET",alternative = "two.sided")
 # store the avaiable p-values
p <- getPval(raw.data=df, test.type = "FET",alternative = "two.sided")[[1]]; p
 # store the attainable p-values
p.set <- getPval(raw.data=df, test.type = "FET",alternative = "two.sided")[[2]]; p.set

allenzhuaz/MHTdiscrete documentation built on July 12, 2019, 2:27 p.m.