Skip to contents

Helper to estimate quantile functions from data for NORTA

Usage

quantile_functions_from_data(
  data,
  method_density = "linear",
  n_density = 200,
  method_quantile = "constant",
  probs_quantile = seq(0, 1, 0.01),
  n_small = 10,
  use_quantile = c(),
  ...
)

quantile_function_from_density(
  x,
  method_density = "linear",
  n_density = 200,
  ...
)

quantile_function_from_quantiles(
  x,
  method_quantile = "constant",
  probs_quantile = seq(0, 1, 0.01)
)

Arguments

data

A matrix or data.frame for which quantile function should be estimated.

method_density

Interpolation method used for density based quantile functions, passed to stats::approxfun. See Details.

n_density

Number of points at which the density is estimated for density bsed quantile, functions, passed to stats::density.

method_quantile

Interpolation method used for quantile based quantile functions, passed to stats::approxfun. See Details.

probs_quantile

Specification of quantiles to be estimated from data for quantile based quantile functions, passed to stats::quantile. See Details.

n_small

An integer giving the number of distinct values below which quantile functions are estimated using quantile_function_from_quantiles() (more suited for categorical data), rather than quantile_function_from_density().

use_quantile

A vector of names indicating columns for which the quantile function should be estimated using quantile_function_from_quantiles(). Overrides n_small.

...

Passed to quantile_function_from_density().

x

Single vector representing variable input to quantile_function_from_density() or quantile_function_from_quantiles().

Value

A named list of functions with length ncol(data) giving the quantile functions of the input data. Each entry is a function returned from stats::approxfun.

Details

The NORTA approach requires the specification of the marginals by quantile functions. This helper estimates those given a dataset automatically and non-parametrically. There are two ways implemented to estimate quantile functions from data.

  1. Estimate the quantile function by interpolating the observed quantiles from the data. This is most useful for categorical data, when the interpolation is using a step-function (default). Implemented in quantile_function_from_quantiles().

  2. Estimate the quantile function via the the empirical cumulative density function derived from the density of the data. Since the density is only estimated at specific points, any values in between are interpolated linearly (default, other options are possible). This is most useful for continuous data. Implemented in quantile_function_from_density().

See also