paretoTail(x, k = NULL, x0 = NULL, method = "thetaPDC",
groups = NULL, w = NULL, alpha = 0.01, ...)
thetaPDC
(the default). See
x
(e.g., households). If
supplied, each group of observations is expected to have
the same value in x
(e.g., household income).
Only the values of every firstalpha
quantile of the fitted Pareto
distribution will be flagged as outliers for further
treatment with reweightOut
or
"paretoTail"
with the following
components:groups
is not NULL
, this
gives the groups with values larger than the threshold
(scale parameter), otherwise the indices of observations
in the upper tail.alpha
used for
flagging outliers.groups
is not NULL
, this
gives the groups that are flagged as outliers, otherwise
the indices of the flagged observations.k
and x0
of course correspond
with each other. If k
is supplied, the threshold
x0
is estimated with the $n - k$ largest value
in x
, where $n$ is the number of observations.
On the other hand, if the threshold x0
is
supplied, k
is given by the number of observations
in x
larger than x0
. Therefore, either
k
or x0
needs to be supplied. If both are
supplied, only k
is used. The function supplied to method
should take a
numeric vector (the observations) as its first argument.
If k
is supplied, it will be passed on (in this
case, the function is required to have an argument called
k
). Similarly, if the threshold x0
is
supplied, it will be passed on (in this case, the
function is required to have an argument called
x0
). As above, only k
is passed on if both
are supplied. If the function specified by method
can handle sample weights, the corresponding argument
should be called w
. Additional arguments are
passed via the ...
reweightOut
, shrinkOut
,
replaceOut
, replaceTail
,
fitPareto
thetaPDC
, thetaWML
,
thetaHill
, thetaISE
,
thetaLS
, thetaMoment
,
thetaQQ
, thetaTM
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)
# calibration of outliers
w <- reweightOut(fit, calibVars(eusilc$db040))
gini(eusilc$eqIncome, w)
# winsorization of outliers
eqIncome <- shrinkOut(fit)
gini(eqIncome, weights = eusilc$rb050)
# 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