
```{r}
library(tidyverse)
library(arrow)
options(arrow.skip_nul = TRUE)
source("code/helpers.R")
```

We use a term frequency-inverse document frequency model to associate the top tags with each server. For the term frequency, we divide the count of the number of accounts which used the tag during the six-month period by the total number of known account-tag pairs on that server; for the inverse document frequency, we divide the total number of servers by count of servers reporting the tag. In this implimentation, we also apply filters such that tags must be used to at least five people on the server to be reported and the tag must be used by at least ten people and at least three servers in the entire known system.

```{r, fig.width=6.75}
#| label: fig-simulations-rbo
simulations <- arrow::read_ipc_file("data/scratch/simulation_rbo.feather")

simulations %>%
  group_by(servers, tags, run) %>% summarize(rbo=mean(rbo), .groups="drop") %>%
  mutate(ltags = as.integer(log2(tags))) %>%
  ggplot(aes(x = factor(ltags), y = rbo, fill = factor(ltags))) +
  geom_boxplot() +
  facet_wrap(~servers, nrow=1) +
  scale_y_continuous(limits = c(0, 1)) +
  labs(x = "Tags (log2)", y = "RBO", title = "Rank Biased Overlap with Baseline Rankings by Number of Servers") +
  theme_minimal() + theme(legend.position = "none")
```


We simulated various scenarios that limit both servers that report data and the number of tags they report. We used rank biased overlap (RBO) to then compare the outputs from these simulations to the baseline with more complete information from all tags on all servers. @fig-sulations-rbo shows how the average agreement with the baseline scales linearly with the logarithm of the tag count.