find_critical_value function

Find Critical Value

Find Critical Value

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.

find_critical_value(ecdf_func, alpha)

Arguments

  • ecdf_func: An ECDF function representing the distribution of a random variable.
  • alpha: A numeric value specifying the significance level.

Returns

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

Examples

data <- rnorm(100) ecdf_data <- ecdf(data) critical_val <- find_critical_value(ecdf_data, 0.05)
  • Maintainer: Jaime Pizarroso Gonzalo
  • License: GPL (>= 2)
  • Last published: 2024-05-11