getPValue: Calculate P-Value from a Sorted Distribution

View source: R/getPvalue.R

getPValueR Documentation

Calculate P-Value from a Sorted Distribution

Description

Computes the P-value for a given numeric value 'x' based on its position within a sorted distribution. This function utilizes a binary search approach for efficient computation.

Usage

getPValue(x, sorted_Distri)

Arguments

x

A numeric value for which the P-value is to be calculated.

sorted_Distri

A numeric vector representing a sorted distribution. This distribution must be sorted in ascending order.

Value

A numeric value indicating the P-value, representing the proportion of values in 'sorted_Distri' that are greater than or equal to 'x'.

Examples

x <- rnorm(1)
sorted_dist <- sort(rnorm(100))
getPValue(x, sorted_dist)


conMItion documentation built on Aug. 8, 2025, 6:25 p.m.