Learn R Programming

laeken (version 0.3.2)

replaceTail: Replace observations under a Pareto model

Description

Replace observations under a Pareto model for the upper tail with values drawn from the fitted distribution.

Usage

replaceTail(x, ...)

## S3 method for class 'paretoTail': replaceTail(x, all = TRUE, \dots)

replaceOut(x, ...)

Arguments

x
an object of class "paretoTail" (see paretoTail).
all
a logical indicating whether all observations in the upper tail should be replaced or only those flagged as outliers.
...
additional arguments to be passed down.

Value

  • A numeric vector consisting mostly of the original values, but with observations in the upper tail replaced with values from the fitted Pareto distribution.

Details

replaceOut(x, ...) is a simple wrapper for replaceTail(x, all = FALSE, ...).

See Also

paretoTail, reweightOut, shrinkOut

Examples

Run this code
data(eusilc)


## gini coefficient without Pareto tail modeling
gini("eqIncome", weights = "rb050", data = eusilc)


## gini coefficient with Pareto tail modeling

# estimate threshold
ts <- paretoScale(eusilc$eqIncome, w = eusilc$db090, 
    groups = eusilc$db030)

# estimate shape parameter
fit <- paretoTail(eusilc$eqIncome, k = ts$k, 
    w = eusilc$db090, groups = eusilc$db030)

# replacement of outliers
eqIncome <- replaceOut(fit)
gini(eqIncome, weights = eusilc$rb050)

# replacement of whole tail
eqIncome <- replaceTail(fit)
gini(eqIncome, weights = eusilc$rb050)

Run the code above in your browser using DataLab