—- 📦 The `BSBT`

R package allows you to fit the Bayesian Spatial Bradley–Terry model to comparative judgement data sets. The package estimates the quality of each area in the data set based on the observed comparisons. The package includes functions to construct the prior distribution covariance matrix from a network or set of coordinates. The package also contains functions to run a number of different MCMC algorithms to estimate the level of deprivation in each area in the data set. Also included is a comparative judgement data set on deprivation in Dar es Salaam, Tanzania.

You can install `BSBT`

by calling the following commands:

```
install.packages('devtools')
devtools::install_github("rowlandseymour/BSBT", dependencies = TRUE)
# devtools::install_github("rowlandseymour/BSBT") #for a quicker install
```

The first step is to create a network from the set of areas. Here’s an example of a network made from Local Authority Areas in the England: There are two ways to do this in `BSBT`

. The first is to construct an adjacency matrix, which describes which areas are neighbours. This can then be fed into `constrained_adjacent_covariance_function`

. The second way is to use coordinates which can be used with`constrained_covariance_matrix`

. This uses the Euclidean distance metric.

The `BSBT`

package uses MCMC the estimate the model parameters. The MCMC can be run by calling the `run_mcmc`

function. This make take some time, up to a few hours, depending on how many areas there are in the model. Here are the results of the method applied to a comparative judgement data set in Tanzania:

In the package, there is a comparative judgement data set collected in Dar es Salaam, Tanzania. It includes over 75,000 comparisons, where citizens where are to compare subwards in the city based on deprivation. Also included are shapefiles for the 452 subwards. These can be accessed by calling `data(dar.comparisons, package = "BSBT")`

and `data(dar.shapefiles, package = "BSBT")`

.

There is also code for simulating comparative judgement data given the underlying levels of deprivation. More information can be found by calling `?BSBT::simulate_contests`

R. G. Seymour, D. Sirl, S. Preston, I. L. Dryden, M. J. A. Ellis, B. Perrat, & J. Goulding. (2020). The Bayesian Spatial Bradley–Terry Model: Urban Deprivation Modeling in Tanzania. arXiv:2010.14128.

This work is supported by the Engineering and Physical Sciences Research Council [grant number EP/T003928/1] and the Big East African Data Science research group at the University of Nottingham.

The comparative judgement dataset was collected by Madeleine Ellis, James Goulding, Bertrand Perrat, Gavin Smith and Gregor Engelmann. We gratefully acknowledge the Rights Lab at the University of Nottingham for supporting funding for the comprehensive ground truth survey. We also acknowledge Humanitarian Street Mapping Team (HOT) for providing a team of experts in data collection to facilitate the surveys. This fieldwork was also supported by the EPSRC Horizon Centre for Doctoral Training - My Life in Data (EP/L015463/1) and by EPSRC grant Neodemographics (EP/L021080/1).