pval_correct: Calculate p-value corrections for multiple testing

View source: R/pval_correct.R

pval_correctR Documentation

Calculate p-value corrections for multiple testing

Description

Internal function to calculate various p-value corrections for use within the spatial_power and jitter_power functions.

Usage

pval_correct(
  input,
  type = c("FDR", "Sidak", "Bonferroni"),
  alpha = 0.05,
  nbc = NULL
)

Arguments

input

An object of class 'rrs' from the spatial_power or jitter_power function.

type

Character string specifying which correction for multiple comparisons. Options include a False Discovery Rate p_correct = "FDR", a Sidak correction p_correct = "Sidak", and a Bonferroni correction p_correct = "Bonferroni".

alpha

Numeric. The alpha level for significance threshold (default in spatial_power and jitter_power functions is 0.05).

Details

This function provides functionality for multiple testing correction in five ways:

  1. Computes a False Discovery Rate by Benjamini and Hochberg \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/j.2517-6161.1995.tb02031.x")} (p_correct = "FDR") by: 1) sorting the p-values (p_i) of each knot in ascending order (p_1 <= p_2 <= ... <= p_m), 2) starting from p_m find the first p_i for which p_i <= (i/m) * alpha.

  2. Computes a Sidak correction \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2307/2283989")} (p_correct = "Sidak") by 1 - (1 - alpha) ^ (1 / total number of gridded knots across the estimated surface). The default in the risk function is a resolution of 128 x 128 or n = 16,384 knots and a custom resolution can be specified using the resolution argument within the risk function.

  3. Computes a Bonferroni correction (p_correct = "Bonferroni") by alpha / total number of gridded knots across the estimated surface. The default in the risk function is a resolution of 128 x 128 or n = 16,384 knots and a custom resolution can be specified using the resolution argument within the risk function.

Value

An object of class 'numeric' with the corrected alpha level.


sparrpowR documentation built on May 29, 2024, 12:02 p.m.