stat_to_pvalue: Convert statistics to p-values

Description Usage Arguments Details Author(s)

View source: R/distanceFunctions.R

Description

Convert raw statistics to p-values based on fractional ranks. Options are available for one- and two-tailed tests (see details).

Usage

1
2
3
stat_to_pvalue(dfv, column.nums = 1:ncol(dfv), subset = 1:nrow(dfv),
  two.tailed = rep(TRUE, length(column.nums)), right.tailed = rep(FALSE,
  length(column.nums)))

Arguments

dfv

a data frame containing observations in rows and statistics in columns.

column.nums

indexes the columns of the data frame that will be used to calculate p-values (all other columns are ignored).

subset

index the rows of the data frame that are known contain values from the null distribution. Use all rows if no such information is available.

two.tailed

a boolean vector with one entry for each chosen column, where TRUE indicates that the column should be converted to p-values based on a two-tailed test.

right.tailed

a boolean vector with one entry for each chosen column, where TRUE indicates that the column should be converted to p-values based on a right-tailed test (see details).

Details

Selected columns in the input data frame are first converted to fractional ranks between 0 and 1 (inclusive). These values are then transformed based on whether a left-tailed, right-tailed or two-tailed p-value is desired (see details). Final values are then transformed again to occupy the range 0-1 exclusive (i.e. between 1/(n+1) and n/(n+1)). If the subset argument is used then ranks are calculated against the chosen subset only, which will lead to several observations having the same p-value.

Each chosen column in the input data frame can be designated as left-tailed, right-tailed or two-tailed independently. The argument two.tailed is a boolean vector where TRUE indicates that the values should be converted to p-values based on a two-tailed test. The argument right.tailed is a boolean vector of the same length as two.tailed, where entries only apply if the corresponding entry of two.tailed is FALSE. For example, the input two.tailed=c(TRUE,FALSE), right.tailed=c(FALSE,FALSE) would produce a two-tailed p-value in the first variable and a left-tailed p-value in the second variable.

Author(s)

Robert Verity r.verity@imperial.ac.uk


NESCent/MINOTAUR documentation built on May 7, 2019, 6:01 p.m.