tableFit_nonParametric: Fits non-parametric distribution functions to binned data

Description Usage Arguments Value

View source: R/tableFit.R

Description

A wrapper function for fitting distribution functions (pdf, cdf, quantile function, and Lorenz Curve) to binned data (edged and counts) using non-parametric interpolation strategies from th binsmooth package.

Usage

1
2
3
4
5
6
7
8
9
tableFit_nonParametric(
  incomeTable,
  method = c("rsub", "spline", "step"),
  ...,
  grid_quantile = NULL,
  gini = F,
  lowerBound_integration = 0,
  upperBound_integration = 1
)

Arguments

incomeTable

A data.frame with 3 columns: N (the proportion or number of observations at the bin); lower (left endpoints of each bin); upper (right endpoints of each bin)

method

A character informing the method of non-parametric interpolation: rsub (recursive subdivision of bins), spline (cublic spline interpolation of the CDF), step (linear interpolation of the CDF)

...

Other arguments passed to 'stepbins', 'rsubbins', or 'splinebins'.

grid_quantile

A NIGrid object created by createNIGrid (package mvQuad) indicating how precise the numerical integration of the quantile function should be. The integration of the quantile function is used to generate the Lorenz Curve

gini

A logical indicating if the Gini Coefficient must be returned. Default to FALSE.

lowerBound_integration

A numerical value between 0 and 1 indicating the lower bound of integration of the Quantile Function. It if used to calculate the mean and the Gini Coefficient. Integration using the full interval from 0 to 1 bears imprecise results. Default to 0.004.

upperBound_integration

A numerical value between 0 and 1 indicating the upper bound of integration of the Quantile Function. It if used to calculate the mean and the Gini Coefficient. Integration using the full interval from 0 to 1 bears imprecise results. Default to 0.997.

Value

Returns a list with the following components

\descriptive

A tibble with four columns: distribution (the name of the interpolation method), estMean (the distribution mean), gini (the Gini Coefficient, if gini = TRUE, NA otherwise), endpoint (the right-hand endpoint of the support of the PDF) \pdf The PDF function. Takes values as input and returns probability densities. \cdf The CDF function. Takes values as input and returns cumulative probabilities. \quantile The Quantile function. Takes cumulative probabilities as input and returns quantile values as outputs. \lorenz The Lorenz Curve function. Takes cumulative probabilities as input and returns the proportion of income accumulated at the quantile.


antrologos/inequalityTools documentation built on May 23, 2021, 11:56 a.m.