inequality: Inequality analysis

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/inequality.R

Description

Inequality analysis

Usage

1
inequality(data, nplayers)

Arguments

data

numeric vector containing the achievements (e.g. scored points) of the players whose inequality has to be analyzed.

nplayers

integer, number of players to include in the analysis (ranked in nondecreasing order according to the values in data).

Value

A list with the following elements: Lorenz (cumulative distributions used to plot the Lorenz curve) and Gini (Gini coefficient).

Author(s)

Marco Sandri, Paola Zuccolotto, Marica Manisera (basketballanalyzer.help@unibs.it)

References

P. Zuccolotto and M. Manisera (2020) Basketball Data Science: With Applications in R. CRC Press.

See Also

plot.inequality

Examples

1
2
3
4
Pbox.BN <- subset(Pbox, Team=="Brooklyn Nets")
out <- inequality(Pbox.BN$PTS, nplayers=8)
print(out)
plot(out)

Example output

Loading required package: ggplot2
Registered S3 method overwritten by 'GGally':
  method from   
  +.gg   ggplot2

If you want to reproduce the figures contained in the book of
Zuccolotto and Manisera (2020) and
if the version of your R machine is >= 3.6.0, you need to type
RNGkind(sample.kind = "Rounding")
at the beginning of your working session
$Gini
[1] 9.59

$Lorenz
      F          Q
1 0.000 0.00000000
2 0.125 0.08433908
3 0.250 0.19109195
4 0.375 0.31264368
5 0.500 0.43591954
6 0.625 0.57183908
7 0.750 0.71307471
8 0.875 0.85531609
9 1.000 1.00000000

attr(,"class")
[1] "inequality" "list"      

BasketballAnalyzeR documentation built on July 2, 2020, 2:14 a.m.