Learn R Programming

conMItion (version 0.2.1)

getPValue: 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)

Value

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

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.

Examples

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

Run the code above in your browser using DataLab