THIS IS A ANONYMISED PACKAGE FOR REVIEW PURPOSES ONLY
The BTUN
R package allows you to fit a spatial Bradley--Terry model to comparative judgement data sets. The aim is to estimate the deprivation levels in urban areas and find the most deprived citizens. The BTUN
model creates a network from the urban area and uses a Gaussian Process to nonparametrically model the deprivation levels.
You can install BTUN
by calling the following commands:
install.packages('devtools')
devtools::install_github("rowlandseymour/BTUN", dependencies = TRUE)
# devtools::install_github("rowlandseymour/BTUN") #for a quicker install
The first step is to create a network from the urban area.Here's an example of a network made from Local Authority Areas in the England:
There are two ways to do this in
BTUN
. The first is to construct an adjacency matrix, which describes which areas are neighbours. This can then be fed into registered_adjacent_covariance_function
. The second way is to use coordinates which can be used withregistered_covariance_matrix
. This uses the Euclidean distance metric.
The BTUN
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 subdivisions there are in the urban area. 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 = "BTUN")
and data(dar.shapefiles, package = "BTUN")
.
There is also code for simulating comparative judgement data given the underlying levels of deprivation. More information can be found by calling ?BTUN::simulate_contests
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.