Learn R Programming

NeuralSens (version 1.1.3)

find_critical_value: Find Critical Value

Description

This function finds the smallest x such that the probability of a random variable being less than or equal to x is greater than or equal to 1 - alpha. It uses the uniroot function to find where the empirical cumulative distribution function (ECDF) crosses 1 - alpha.

Usage

find_critical_value(ecdf_func, alpha)

Value

The smallest x such that P(X <= x) >= 1 - alpha.

Arguments

ecdf_func

An ECDF function representing the distribution of a random variable.

alpha

A numeric value specifying the significance level.

Examples

Run this code
data <- rnorm(100)
ecdf_data <- ecdf(data)
critical_val <- find_critical_value(ecdf_data, 0.05)

Run the code above in your browser using DataLab