calc_delta_funs: Calculate delta function(s)

View source: R/core_stats.R

calc_delta_funsR Documentation

Calculate delta function(s)

Description

Given a dataset providing the quantiles (calc_quantiles), calculates delta function(s) for the character vectors minuends and subtrahends

Usage

calc_delta_funs(
  quantiles_dat,
  minuends = NULL,
  subtrahends = NULL,
  dvs = NULL,
  b_coding
)

Arguments

quantiles_dat

a data.frame of quantiles (calc_quantiles)

minuends, subtrahends

character vectors (with equal length), specifying the conditions to use for the delta function: minuend - subtrahend

dvs

character, indicating which quantile columns to use. Default is "Quant_<u_label>". If multiple dvs are provided, then minuends and subtrahends must have the same length, and matching occurs pairwise. In this case, if only one minuend/subtrahend is specified, minuend and subtrahend are recycled to the necessary length.

b_coding

a b_coding object, necessary to build default dvs

Details

Takes the quantile data_frame, stats::reshape it to wide, and then access the relevant dv columns, together with minuends and subtrahends to calculate the delta functions.

Value

a data.frame with columns "Source", "Prob", the "Quant_<u_label>", "Quant_<l_label". May have the following additional columns:

  • if only one dv: as many Delta_<minuend_subtrahend> and Avg_<minuends_subtrahends> as minuends and subtrahends.

  • if more than one dv: as many Delta_<u/l-label><minuend_subtrahend> and Avg<u/l-label>_<minuends_subtrahends> as minuends and subtrahends.

The data.frame is of type c("delta_funs", "sum_dist", "stats_dm", "data.frame")

See Also

new_stats_dm()


dRiftDM documentation built on April 3, 2025, 7:48 p.m.