Setup and Introduction

library("ggplot2")
library("jtools")
library("kableExtra")
bl_funding <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2025/2025-07-15/bl_funding.csv')

This week’s Tidy Tuesday dataset deals with the topic of funding for the British Library, which is the national library of the UK. The British Library has faced significant fluctuations in funding over the years, and I would like to investigate some possible causes for these fluctuations.

Step 1: Visualize Funding Changes Over Time

ggplot(bl_funding, aes(x=year))+
  ylab("millions of pounds")+
  geom_line(aes(y=nominal_gbp_millions, color="0. Total"))+
  geom_line(aes(y=gia_gbp_millions, color="1. GIA"))+
  geom_line(aes(y=voluntary_gbp_millions, color="3. Voluntary"))+
  geom_line(aes(y=investment_gbp_millions, color="4. Investment"))+
  geom_line(aes(y=services_gbp_millions, color="2. Services"))+
  geom_line(aes(y=other_gbp_millions, color="5. Other"))+
  scale_color_manual(labels=c("Total", "GIA", "Services", "Voluntary", "Investment", "Other"), values=c("black","purple","orange","#8EA604","#D16666","#63ADF2"))+ 
  labs(color="Funding Source")+theme_minimal()+
  ggtitle("Changes in British Library Funding from 1998 to 2023")

The plot of funding over time provides a few key insights into this topic. First, it is immediately clear that the largest source of funding for the British Library is Grants In Aid (GIA), which is the official term for the core funding from the UK government. Second, fluctuations in total funding for the library appear to closely mirror fluctuations in GIA. In other words, changes in funding for the library can most likely be explained by changes in GIA.

Based on my work so far, I propose two possible hypotheses to explain changes in British Library funding.

Hypothesis 1: Changes in British Library funding reflect changes in the priorities of the political party in power in the UK.

Hypothesis 2: Changes in British Library funding reflect changes in the overall economic health of the UK.

In order to investigate these two hypotheses, I must supplement the data provided for Tidy Tuesday with some additional information about the parties in power and the economic situation between 1998 and 2023.

Step 2: Add Info about Political Parties and Visualize

# source = Wikipedia
prime_minister <- c(rep("Rishi Sunak",2), rep("Boris Johnson",3), rep("Theresa May",3), rep("David Cameron",6), rep("Gordon Brown",3), rep("Tony Blair",9))
pm_party <- c(rep("Conservative",14), rep("Labour",12))
bl_funding <- cbind(bl_funding, prime_minister, pm_party)
head(bl_funding[,c("year","prime_minister","pm_party")])
##   year prime_minister     pm_party
## 1 2023    Rishi Sunak Conservative
## 2 2022    Rishi Sunak Conservative
## 3 2021  Boris Johnson Conservative
## 4 2020  Boris Johnson Conservative
## 5 2019  Boris Johnson Conservative
## 6 2018    Theresa May Conservative

I’ve pulled information about the parties in power (and associated Prime Ministers) from Wikipedia and added it to the dataset.

ggplot(bl_funding, aes(x=year))+
  ylab("millions of pounds")+
        geom_rect(aes(xmin=1998, xmax=2010, 
                      ymin=-Inf, ymax=Inf, fill="Labour"),
                  color="#fa968e", alpha=0.02)+
        geom_rect(aes(xmin=2010, xmax=2023, 
                      ymin=-Inf, ymax=Inf, fill="Conservative"),
                  color="#9da1f0", alpha=0.02)+
  scale_fill_manual(values=c("#9da1f0","#fa968e"))+
  geom_line(aes(y=nominal_gbp_millions, color="black"))+
  geom_line(aes(y=gia_gbp_millions, color="purple"))+
  scale_color_manual(labels=c("Total", "GIA"), values=c("black","purple"))+
  labs(color="Funding Source", fill="Ruling Party")+theme_minimal()+
  ggtitle("Changes in British Library Funding Overlaid on Ruling Party")

Under Labour rule in the early 2000s, we see a period of increasing funding for the British Library. This changes pretty notably when the Conservative party takes power in 2010. However, the Conservative record on funding is a bit more ambiguous. Though there are initial decreases in funding, around 2018 there is a new period of increasing funding.

Without further knowledge of the nuances of UK politics, this suggests that political party priorities are not entirely responsible for changes in British Library funding.

Let’s explore Hypothesis 2 to see if economic indicators provide a more straightforward explanation for funding fluctuations.

Step 3: Add Info about Economic Health and Visualize

# source = World Bank
gdp_trillions <- c(1.65, 1.69, 1.67, 1.65, 1.79, 2.05, 2.42, 2.54, 2.71, 3.09, 2.93, 2.41, 2.49, 2.66, 2.71, 2.78, 3.06, 2.93, 2.69, 2.68, 2.87, 2.85, 2.7, 3.14, 3.11, 3.37)
unemployment <- c(6.2, 6, 5.6, 4.7, 5, 4.8, 4.6, 4.9, 5.5, 5.4, 5.7, 7.7, 8, 8.2, 8.3, 7.8, 6.4, 5.6, 4.9, 4.5, 4.1, 3.7, 4.5, 4.9, 3.8, 4)
inflation <- c(1.8, 1.8, 1.2, 1.5, 1.5, 1.4, 1.4, 2.1, 2.5, 2.4, 3.5, 2, 2.5, 3.9, 2.6, 2.3, 1.5, 0.4, 1, 2.6, 2.3, 1.7, 1, 2.5, 7.9, 6.8)
bl_funding <- cbind(bl_funding, gdp_trillions, unemployment, inflation)

I’ve pulled information about GDP, unemployment, and inflation from the World Bank Website and added it to the dataset.

# re-scale the data so that vars are comparable
# turn everything into percent change
bl_funding$percent_change_funding <- NA
bl_funding$percent_change_gdp <- NA
bl_funding$percent_change_unemployment <- NA
bl_funding$percent_change_inflation <- NA
for(row in 2:nrow(bl_funding)){
  # funding
  bl_funding$percent_change_funding[row] <- 100 * (bl_funding$nominal_gbp_millions[row+1]-bl_funding$nominal_gbp_millions[row]) / bl_funding$nominal_gbp_millions[row]
  # gdp
  bl_funding$percent_change_gdp[row] <- 100 * (bl_funding$gdp_trillions[row+1]-bl_funding$gdp_trillions[row]) / bl_funding$gdp_trillions[row]
  # unemployment
  bl_funding$percent_change_unemployment[row] <- 100 * (bl_funding$unemployment[row+1]-bl_funding$unemployment[row]) / bl_funding$unemployment[row]
  # inflation
  bl_funding$percent_change_inflation[row] <- 100 * (bl_funding$inflation[row+1]-bl_funding$inflation[row]) / bl_funding$inflation[row]
}

Because the British Library funding is measured in millions of pounds, while GDP is measured in trillions of dollars and unemployment and inflation are measured as percentages, I have re-scaled all these variables, converting them to a “percent change” scale instead. That way all four variables will plot more easily onto the same y-axis.

ggplot(bl_funding, aes(x=year))+
  ylab("percent change")+
  geom_line(aes(y=percent_change_funding, color="BL Funding"))+
  geom_line(aes(y=percent_change_gdp, color="GDP"))+
  geom_line(aes(y=percent_change_unemployment, color="Unemployment"))+
  #geom_line(aes(y=percent_change_inflation, color="Inflation"))+
  scale_color_manual(labels=c("BL Funding", "GDP", "Unemployment"), values=c("black","orange","purple"))+
  labs(color="Variable")+theme_minimal()+
  ggtitle("Economic Health and British Library Funding Compared")

Though the visualization is quite noisy, there does appear to be some alignment between British Library funding and two of the three economic indicators: GDP and unemployment. I have removed inflation from the plot because it showed little to no correlation with the other variables and skewed the plot significantly.

To obtain a more precise estimate of the impact of my three variables of interest (political party in power, GDP, and unemployment) on British Library funding, I will conclude my running a regression.

Step 4: Test Hypotheses

# create lagged econ indicators
bl_funding$lagged_gdp_trillions <- c(bl_funding$gdp_trillions[2:nrow(bl_funding)], NA)
bl_funding$lagged_unemployment <- c(bl_funding$unemployment[2:nrow(bl_funding)], NA)
head(bl_funding[,c("year","gdp_trillions","lagged_gdp_trillions","unemployment","lagged_unemployment")])
##   year gdp_trillions lagged_gdp_trillions unemployment lagged_unemployment
## 1 2023          1.65                 1.69          6.2                 6.0
## 2 2022          1.69                 1.67          6.0                 5.6
## 3 2021          1.67                 1.65          5.6                 4.7
## 4 2020          1.65                 1.79          4.7                 5.0
## 5 2019          1.79                 2.05          5.0                 4.8
## 6 2018          2.05                 2.42          4.8                 4.6

Before running my regression, I have created lagged versions of the GDP variable and unemployment variable. This is to account for the fact that funding changes likely occur after changes in economic health. There is typically a lag as governments adjust to new information about the economy. For example, the government in 2007 must rely on economic indicators from 2006. Therefore lagged variables will allow me to more accurately model the impact of the economy on funding for the library.

# linear model
funding_model <- lm(nominal_gbp_millions ~ lagged_gdp_trillions + lagged_unemployment + pm_party, data=bl_funding)
jtools::summ(funding_model)
Observations 25 (1 missing obs. deleted)
Dependent variable nominal_gbp_millions
Type OLS linear regression
F(3,21) 9.31
0.57
Adj. R² 0.51
Est. S.E. t val. p
(Intercept) 147.50 13.37 11.03 0.00
lagged_gdp_trillions -21.81 4.96 -4.40 0.00
lagged_unemployment 5.51 1.47 3.74 0.00
pm_partyLabour 18.59 5.15 3.61 0.00
Standard errors: OLS

The linear regression indicates that all three variables of interest have a statistically significant relationship with funding for the British Library. Interestingly, the health of the economy appears to be inversely related with British Library funding; higher GDP and lower unemployment are associated with decreased funding for the British Library. It is not immediately clear to me why this would be the case, but perhaps during stronger economic periods Parliament is able to justify decreases in government funding by arguing that the library can rely on other sources of funding. The political party variable is more readily interpretable with the Labour party clearly associated with increased funding for the library.

Conclusion

My proposed hypotheses proved fruitful for understanding changes in British Library funding over time. It is clear that political party priorities do affect funding, with the Labour party more willing to fund the library. Additionally, the health of the economy has a notable impact, though it is the opposite of what I might have guessed. Further investigation of more micro-level economic indicators or of Parliamentary debate regarding British Library funding might help reveal the mechanisms behind this inverse relationship.