Skip to contents

Each neighbourhood reports the share p of residents with a trait and the share q with an outcome. The rate of the outcome among trait holders, \(r = P(y \mid x)\), is identified from the two marginals only up to \([\max(0, (p+q-1)/p),\ \min(1, q/p)]\), both ends attainable (Research.P12.dd_bounds, Cells.ends_attained). The rate among the others follows from \(q = p r + (1-p) r'\) (dd_complement), and the city-wide rate, a population-weighted mean of the neighbourhood rates, inherits the weighted mean of the intervals (dd_aggregate_bounds). An ecological regression that reports a single number for \(r\) is choosing a point inside these intervals by assumption, not by data.

Usage

morie_ecological_bounds(p, q, weights = NULL)

Arguments

p

Trait share per neighbourhood, in (0, 1).

q

Outcome share per neighbourhood, in [0, 1].

weights

Population per neighbourhood (positive); equal by default.

Value

A list with neighbourhoods (a data frame with p, q, lower, upper, width, point_identified, complement_lower, complement_upper), aggregate (lower, upper, width, the city-wide rate among trait holders) and theorems.

Examples

morie_ecological_bounds(p = c(0.2, 0.5, 0.8), q = c(0.1, 0.3, 0.6), weights = c(1000, 2000, 500))
#> $neighbourhoods
#>     p   q lower upper width point_identified complement_lower complement_upper
#> 1 0.2 0.1   0.0  0.50  0.50            FALSE                0            0.125
#> 2 0.5 0.3   0.0  0.60  0.60            FALSE                0            0.600
#> 3 0.8 0.6   0.5  0.75  0.25            FALSE                0            1.000
#> 
#> $aggregate
#> lower upper width 
#> 0.125 0.625 0.500 
#> 
#> $theorems
#> [1] "Research.P12.pq_ge"               "Research.P12.dd_bounds"          
#> [3] "Research.P12.Cells.ends_attained" "Research.P12.dd_complement"      
#> [5] "Research.P12.dd_aggregate_bounds"
#>