two2one: Convert two-sided p-values to one-sided

View source: R/two2one.R

two2oneR Documentation

Convert two-sided p-values to one-sided

Description

Convert two-sided p-values to one-sided\loadmathjax

Usage

two2one(p, two = NULL, invert = NULL)

Arguments

p

A vector of p-values

two

A logical vector defining which \mjseqnp-values are two-sided and to be converted

invert

A logical vector defining which \mjseqnp-values are to be inverted

Details

The \mjseqnp-values supplied to the other functions should be one-sided and all in the same direction. This convenience function will convert two-sided to one-sided and invert as necessary. By default it is assumed that all \mjseqnp-values are two-sided and the function converts them all to one-sided. Use invert to specify if some of the tests resulted in outcomes in the other direction. So for example a value of 0.05 will be converted to 0.025 unless invert is TRUE in which case it is converted to 0.975.

Value

A vector of one-sided \mjseqnp-values all in the correct direction

Author(s)

Michael Dewey

Examples

data(dat.metap)
rosenthal <- dat.metap$rosenthal
twop <- with(rosenthal, (pt(t, df)))
two2one(twop, two = rep(FALSE, 5), invert = rep(TRUE, 5)) # restore to one-sided

metap documentation built on Oct. 9, 2023, 5:10 p.m.