Skip to content

Instantly share code, notes, and snippets.

@patperu
Created July 25, 2012 08:13
Show Gist options
  • Save patperu/3175027 to your computer and use it in GitHub Desktop.
Save patperu/3175027 to your computer and use it in GitHub Desktop.
Multiple Deprivation Measure
# Journal of the Statistical and Social Inquiry Society of Ireland
# Vol. XXXI
# DEVELOPING DEPRIVATION MEASURES FOR NORTHERN IRELAND*
# MICHAEL NOBLE, MYFANWY LLOYD GEMMA WRIGHT CHRIS DIBBEN GEORGE SMITH
# University of Oxford
# (read before the Society, 27 September 2001)
# page 21
# https://www.dropbox.com/sh/y5jk16lvgpojphf/gFB3Sqp49b
set.seed(345)
ScaleRange <- function(x) {
(x - min(x, na.rm=TRUE)) / diff(range(x, na.rm=TRUE)) }
ExpTrans <- function(r) { -23*log(1-r*(1-exp(-100/23))) }
nwards <- 566 # 566 wards
vmin <- 0
vmax <- 32
x <- data.frame(val = runif(nwards, vmin, vmax) )
x <- within(x, {
x_rank <- ScaleRange(rank(val))
x_exp <- ExpTrans(x_rank)
})
x[order(x$val), ]
plot(sort(x$x_exp))
lines(sort(x$x_rank)*100)
abline(h=50)
sum(x$x_exp > 50) # [1] 58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment