Learn R Programming

tbea (version 1.6.1)

quantile_conflation: quantile_conflation: Calculate the quantile for a given probabiliy under a conflated distribution

Description

quantile_conflation: Calculate the quantile for a given probabiliy under a conflated distribution

Usage

quantile_conflation(p, data, output = c("quantile", "optim"))

Value

Either a vector of length one withe the quantile value, or a list as returned by optim.

Arguments

p

A float with the desired probability for which the quantile is to be calculated.

data

A data frame which results from calling `conflate`.

output

One of two values, either "quantile" or "optim". The former returns only the optimised quantile value, whereas the latter returns the complete output from `optim`. Useful for checking whether optimisation converged.

Examples

Run this code
# \donttest{
conflated = density(rnorm(1000000, 0, 1))[c("x", "y")]
quantile_conflation(0.5, conflated, output = "quantile")
quantile_conflation(0.5, conflated, output = "opt")
quantile_conflation(0.025, conflated, "quan")
quantile_conflation(0.975, conflated, "q")
# }

Run the code above in your browser using DataLab