Skip to contents

Splits the Gini of all places exactly into the zero share \(z\) and the Gini among places with any crime: \(G = z + (1-z)G_+\) (Research.P7.gini_zero_decomposition). Reports, next to it, the zero share a uniform Poisson null would produce at the observed mean count per place, \(e^{-\mu}\) (Research.P7.poisson_zero_prob), and the Gini the null would imply if the positive places were as concentrated as observed. The gap between the observed zero share and \(e^{-\mu}\) is the part of "concentration" that is genuinely more crime-free places than chance; the gap in \(G_+\) is concentration among places that do see crime.

Usage

morie_concentration_decompose(x)

Arguments

x

Non-negative counts per place; at least one positive.

Value

A list with n, mean_count, zero_share, gini_all, gini_positive, identity_check (gini_all - (zero_share + (1 - zero_share) * gini_positive), zero up to rounding), null_zero_share (\(e^{-\mu}\)), null_gini_same_positive (\(e^{-\mu} + (1 - e^{-\mu}) G_+\)), excess_zero_share and theorems.

Examples

set.seed(1)
x <- rpois(1000, 0.4)                       # uniform rates: any "law" here is chance
morie_concentration_decompose(x)[c("zero_share", "null_zero_share", "gini_all")]
#> $zero_share
#> [1] 0.669
#> 
#> $null_zero_share
#> [1] 0.6629869
#> 
#> $gini_all
#> [1] 0.7216375
#> 
y <- rpois(1000, rgamma(1000, 0.3, 0.3 / 0.4)) # heterogeneous rates
morie_concentration_decompose(y)[c("zero_share", "null_zero_share", "gini_positive")]
#> $zero_share
#> [1] 0.765
#> 
#> $null_zero_share
#> [1] 0.6511599
#> 
#> $gini_positive
#> [1] 0.3305659
#>