Compute the statistics necessary for producing box-and-whisker plots of continuous or semi-continuous variables, taking into account sample weights.
spBwplotStats(x, weights = NULL, coef = 1.5, zeros = TRUE, do.out = TRUE)
A list of class "spBwplotStats"
with the following
components:
A vector of length 5 containing the (weighted) statistics for the construction of a box plot.
if weights
is NULL
, the number of non-missing and, if zeros
is
TRUE
, non-zero data points. Otherwise the sum of the weights of the
corresponding points.
if zeros
is TRUE
and
weights
is NULL
, the number of zeros. If zeros
is
TRUE
and weights
is not NULL
, the sum of the weights of
the zeros. If zeros
is not TRUE
, this is NULL
.
if do.out
, the values of any data points that lie beyond
the extremes of the whiskers.
a numeric vector.
an optional numeric vector containing sample weights.
a numeric value that determines the extension of the whiskers.
a logical indicating whether the variable specified by
additional
is semi-continuous, i.e., contains a considerable amount
of zeros. If TRUE
, the (weighted) box plot statistics are computed
for the non-zero data points only and the number of zeros is returned, too.
a logical indicating whether data points that lie beyond the extremes of the whiskers should be returned.
Stefan Kraft and Andreas Alfons
The function quantileWt
is used for the computation of
(weighted) quantiles. The median is computed together with the first and
the third quartile, which form the box. If range
is positive, the
whiskers extend to the most extreme data points that have a distance to the
box of no more than coef
times the interquartile range. For
coef = 0
, the whiskers mark the minimum and the maximum of the
sample, whereas a negative value causes an error.
spBwplot
, for producing (weighted) box plots of
continuous or semi-continuous variables.
quantileWt
for the computation of (weighted) sample quantiles.
boxplot.stats
for the unweighted statistics for box
plots (not considering semi-continuous variables).
data(eusilcS)
## semi-continuous variable
spBwplotStats(eusilcS$netIncome,
weights=eusilcS$rb050, do.out = FALSE)
Run the code above in your browser using DataLab