Skip to main content

Rf_qchisq

Function Rf_qchisq 

Source
pub unsafe fn Rf_qchisq(p: f64, df: f64, lower_tail: c_int, log_p: c_int) -> f64
Expand description

Chi-squared quantile function: qchisq(p, df, lower.tail = lower_tail, log.p = log_p) (central only; stats::qchisq with ncp calls a different routine).

Rf_qchisq from Rmath.h (the qchisq macro resolves to it). It is R’s gamma quantile with shape df / 2 and scale 2. The flags have the same meaning as for Rf_qnorm5.

§R conditions

A p outside the probability range or a negative df returns NaN without a warning (nmath does not report domain errors). The gamma quantile iterates, and nmath reports non-convergence or precision loss in it (and in the gamma distribution function it calls) through R’s warning(); under options(warn = 2) that warning becomes an R error, which longjmps. Call this where such a longjmp is caught: a #[miniextendr] function body, or with_r_unwind_protect. #[r_ffi_checked] gives thread routing and checking only, not an unwind guard. Checked wrapper for Rf_qchisq. Calls Rf_qchisq_unchecked and routes through with_r_thread. Generated from source location line 1779, column 12. Generated from source file miniextendr-api/src/sys.rs.