Redistricting is problem with many, many dimensions. This vignette introduces some useful measures related to redistricting, but with smaller categories. See the vignette “Using `redistmetrics`

” for the bare-bones of the package.

We first load the `redistmetrics`

package and data from New Hampshire. For any function, the `shp`

argument can be swapped out for your data, `rvote`

and `dvote`

for any two party votes, `pop_black`

for any group population, `pop`

for the total population, and the `plans`

argument can be swapped out for your redistricting plans (be it a single plan, a matrix of plans, or a `redist_plans`

object).

```
library(redistmetrics)
data(nh)
```

This is a measure which offers a balance between competitiveness across the state and competitiveness within individual districts.

Formally, this can be written as:

\[\textrm{Talismanic Competitiveness} = T_p (1 + \alpha T_e)\beta\]

where

\[ T_p = \frac{1}{n_d} * \sum_{k=1}^{n_\textrm{dists}} \big|\frac12 - \textrm{voteshare}_D\big|\] \[ T_e = |\frac{n_\textrm{dists} - Seats_D}{n_\textrm{dists}}-\frac12| \]

Talismanic Compactness can be computed with

```
compet_talisman(plans = nh$r_2020, shp = nh, rvote = nrv, dvote = ndv)
#> [1] 0.04955851 0.04955851
```

where `nrv`

and `ndv`

are averages of votes. (In general, you want to compute these scores over many elections and average them.)

Dissimilarity describes how similar the demographic proportions in districts are to the total state population’s demographics.

Formally, this can be written as:

\[ \textrm{Dissimilarity} = \sum_{i = 1}^{n_\textrm{dists}} \frac{(t_d |g_d - G|)}{2T*G(1 - G)}\]

for a group population proportion in district \(d\), \(g_d\), total population in district \(d\), \(t_d\), a group population proportion in a state \(G\), and total population in the state \(T\).

Dissimilarity can be computed with:

```
seg_dissim(plans = nh$r_2020, shp = nh, group_pop = pop_black, total_pop = pop)
#> [1] 0.0273714 0.0273714
```

We compute incumbent pairings as the number of incumbents who are placed into a district with other incumbents beyond those allowed. Formally, this is:

\[\textrm{Inc. Pairs} = \sum_{d = 1}^{\textrm{ndists}}\max(0, ~n^{(d)}_{inc} - 1)\]

We do not have incumbent data included for New Hampshire. As such, we create fake incumbent data.

```
<- rep(FALSE, nrow(nh))
fake_inc c(1, 2)] <- TRUE fake_inc[
```

This would indicate that there are only incumbents in the first two rows of the data.

Incumbent pairings can be computed with:

```
inc_pairs(plans = nh$r_2020, shp = nh, inc = fake_inc)
#> [1] 1 1
```