iqf: Function factory for creating an inverse quantile function

View source: R/iqf.R

iqfR Documentation

Function factory for creating an inverse quantile function

Description

Function factory for creating an inverse quantile function

Usage

iqf(QFUN)

Arguments

QFUN

bare name of the quantile function to be inverted. Assumes that the first argument in the quantile function is p for probability.

Value

function. Approximated CDF for a given quantile function. The inverse function will have the following additional arguments, passed to stats::uniroot() lower=0, upper=1, tol=1e-6, silent=TRUE, trace=0. The resulting inverse quantile function is fully vectorized with regards to all of its arguments (shorter vectors are recycled).

Examples

qmyfun <- function(p, b, k){b*(log(p/(1-p))+k*p)}
pmyfun <- iqf(qmyfun)
x <- qmyfun(1:9/10, 2, 3)
pmyfun(x, 2, 3)

dmi3kno/qpd documentation built on Sept. 29, 2024, 6:39 p.m.