londonmayor: Individual and aggregate data for the 2016 London Mayoral...

londonmayorR Documentation

Individual and aggregate data for the 2016 London Mayoral election

Description

A dataset containing individual post-election responses from the British Election Study, auxiliary vote shares from 2012 mayoral election, and aggregate counts from the 2016 election.

Usage

londonmayor

Format

A data frame with 1924 rows and 35 variables:

ONSCode

Geographic identifier from the Office for National Statistics

Ward

Name of the borough

ageGroup

Respondent age group

education

Respondent's highest level of educational qualifications

ethnicity

Respondent ethnicity

gender

Respondent gender

vi

Respondent recalled vote, including non-voters

days_after_elex

Fieldwork date minus date of election

ConPct, ConPct_mean, ConPct_sd, ConPct_sc

Boris Johnson vote share in borough in 2012, together with global mean and SD, and scaled version

LabPct

Ken Livingstone vote share in borough in 2012...

LDemPct

Brian Paddick vote share in borough in 2012...

GreenPct

Jenny Jones vote share in borough in 2012...

OtherPct

Combined share of Siobhan Benita (Ind), Lawrence Webb (UKIP) and Carlos Cortiglia (BNP) vote share in borough in 2012...

Con_counts_2016

Borough count of votes won by Zac Goldsmith

Lab_counts_2016

Borough count of votes won by Sadiq Khan

Green_counts_2016

Borough count of votes won by Sian Berry

LDem_counts_2016

Borough count of votes won by Caroline Pidgeon

UKIP_counts_2016

Borough count of votes won by Peter Whittle

Other_counts_2016

Borough count of votes won by seven other candidates

DNV_counts_2016

Borough population over 16 less total votes cast

Source

Individual data from the British Election Study. Results from 2012 and 2016 elections from https://data.london.gov.uk/

Examples

data("londonmayor")
data("londonps")

f <- vi ~ ageGroup + education + ethnicity + gender | LabPct_sc + LDemPct_sc + GreenPct_sc + OtherPct_sc

aux <- unique(londonmayor[,c("ONSCode", "LabPct_sc", "LDemPct_sc", "GreenPct_sc",
"OtherPct_sc")])
res <- unique(londonmayor[,c("ONSCode", "Con_counts_2016", "Lab_counts_2016", "Green_counts_2016",
"LDem_counts_2016", "UKIP_counts_2016", "Other_counts_2016", "DNV_counts_2016")])

## Make sure column names of results data frame match unique values of vi
names(res) <- c("ONSCode", "Con", "Lab", "Green",
"LDem", "UKIP", "Other", "DNV")
#' ## Computationally intensive bit
## Not run: 
mod <- hrr(f, data = londonmayor, ps = londonps, aux = aux,
    res = res, areavar = "ONSCode", weightvar = "count",
    testing = FALSE, adjust = FALSE, overdispersed = TRUE,
    iter = 320, chains = 4, cores = 4)

## End(Not run)


chrishanretty/hrr documentation built on Oct. 23, 2024, 9:23 p.m.