-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path03-Calculating-SIMD.Rmd
More file actions
executable file
·50 lines (38 loc) · 1.52 KB
/
03-Calculating-SIMD.Rmd
File metadata and controls
executable file
·50 lines (38 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Calculating SIMD {#simd}
For the final calculation of the SIMD ranks we follow a few simple steps, see the script `scripts/calculations/openSIMD.R`:
- load packages and data
- inverse domain rankings
- exponentially transform the inversed domain rankings
- combine transformed domain scores
- rank final SIMD scores
First, we load the packages and data from the previous domain rank calculations.
```{r}
library(dplyr)
source("../openSIMD_analysis/scripts/utils/helpers.R")
domains <- read.csv("../openSIMD_analysis/results/domain_ranks.csv")
```
Then we invert the domain rankings (so that 1 = least deprived) and exponentially transform them, using [`expoTransform`](#expoTransform). This step spreads out the scores at the deprived end of each domain, so that where an area is deprived in one domain, this deprivation won't be cancelled out by a lack of deprivation in another domain.
```{r}
invRank <- function(v) rank(-v)
exponential_domains <- domains %>%
mutate_at(vars(-data_zone), funs(invRank)) %>%
mutate_at(vars(-data_zone), funs(expoTransform))
```
We then combine the domain ranks using fixed weightings.
```{r}
with(exponential_domains, {
simd_score <<-
.28 * income +
.28 * employment +
.14 * health +
.14 * education +
.09 * access +
.05 * crime +
.02 * housing
})
```
Finally, we rank the final SIMD score to get the SIMD rankings (1 = most deprived).
```{r}
simd_rank <- rank(-simd_score)
```
SIMD and domain ranks are saved in `results/domain_ranks.csv` and `results/openSIMD_ranks.csv`.