1 Setup and Load Packages

library(tidyverse)
library(lubridate)
library(kableExtra)
library(pander)

# Set pander options for clean text tables
panderOptions('table.split.table', Inf)  # Don't split wide tables
panderOptions('table.style', 'simple')   # Simple style like Stata output

2 Directory Setup

3 Helper Functions

4 Period Definitions

# ==============================================================================
# PERIOD DEFINITIONS
# ==============================================================================

periods <- tribble(
  ~period_num, ~period_name, ~start_date, ~end_date, ~description,
  0, "Pre-BTFP",   "2023-03-01", "2023-03-10", "DW only available",
  1, "Acute",      "2023-03-13", "2023-05-01", "Peak crisis phase",
  2, "Post-Acute", "2023-05-02", "2023-10-31", "Stabilization",
  3, "Arbitrage",  "2023-11-01", "2024-01-24", "BTFP rate < IORB",
  4, "Wind-down",  "2024-01-25", "2024-03-11", "BTFP closing announced"
) %>% 
  mutate(across(c(start_date, end_date), as.Date))

# Key dates
BTFP_LAUNCH <- as.Date("2023-03-12")
BTFP_CLOSE <- as.Date("2024-03-11")
DW_DATA_END <- as.Date("2023-12-31")
BASELINE_DATE <- "2022Q4"

# Display periods
periods %>%
  kable(col.names = c("Period", "Name", "Start", "End", "Description"),
        caption = "Analysis Period Definitions") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), full_width = FALSE)
Analysis Period Definitions
Period Name Start End Description
0 Pre-BTFP 2023-03-01 2023-03-10 DW only available
1 Acute 2023-03-13 2023-05-01 Peak crisis phase
2 Post-Acute 2023-05-02 2023-10-31 Stabilization
3 Arbitrage 2023-11-01 2024-01-24 BTFP rate < IORB
4 Wind-down 2024-01-25 2024-03-11 BTFP closing announced

5 Load Data

6 Define Exclusions

7 Prepare Baseline Data (2022Q4)

8 Identify FHLB Borrowers (Q1 2023)

9 Table Functions

10 Table 1: March 10, 2023 - DW Borrowers vs Non-Borrowers

# ==============================================================================
# TABLE 1: March 10, 2023 Only - DW Borrowers vs Non-Borrowers
# ==============================================================================

dw_mar10 <- dw_loans_raw %>%
  filter(dw_loan_date == as.Date("2023-03-10")) %>%
  distinct(rssd_id) %>%
  pull(rssd_id)

table1_data <- baseline_q %>%
  mutate(
    borrower_type = if_else(idrssd %in% dw_mar10, "DW Borrower", "Non-Borrower")
  )

table1 <- create_summary_table_v2(table1_data, "borrower_type", 
                                   group_levels = c("DW Borrower", "Non-Borrower"))

# Display
table1 %>%
  select(-Row_Type) %>%
  kable(caption = "Table 1: Pre-Crisis Bank Characteristics - DW Borrowers vs Non-Borrowers (March 10, 2023)") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), full_width = FALSE)
Table 1: Pre-Crisis Bank Characteristics - DW Borrowers vs Non-Borrowers (March 10, 2023)
Variable DW Borrower Non-Borrower
N 49 4647
Book Equity Ratio 8.17 (8.45) 10.90 (9.01)
49 4647
MTM Loss (HTM) 0.22 (0.00) 0.20 (0.00)
49 4629
MTM Loss (Total) 5.70 (5.66) 5.47 (5.26)
49 4629
Adjusted Equity 2.48 (2.44) 5.26 (3.82)
49 4629
Uninsured Leverage 418.36 (352.70) 330.72 (249.57)
49 4647
MTM Insolvent 24.49 (0.00) 18.41 (0.00)
12 852
Run Risk (Median Cutoff) 38.78 (0.00) 23.26 (0.00)
19 1079
Run Risk (Q75 Cutoff) 8.16 (0.00) 4.18 (0.00)
4 194
IDCR Insolvent (s=0.5) 2.04 (0.00) 4.41 (0.00)
1 202
IDCR Insolvent (s=1.0) 32.65 (0.00) 27.99 (0.00)
16 1283
Capital Insolvent (s=0.5) 4.08 (0.00) 2.31 (0.00)
2 107
Capital Insolvent (s=1.0) 16.33 (0.00) 7.63 (0.00)
8 353
# Export (silently)
invisible(export_table(
  table1, 
  "table1_dw_mar10",
  caption = "Pre-Crisis Bank Characteristics: DW Borrowers vs Non-Borrowers (March 10, 2023)",
  label = "tab:dw_mar10",
  note = "Bank characteristics from 2022Q4 Call Reports. Values shown as Mean (Median) with N observations below. Continuous variables in percentage points. Dummy variables show proportion (\\%) with value = 1. DW borrowers identified as banks with Discount Window loans on March 10, 2023 only. Sample excludes G-SIBs and failed banks."
))

LaTeX table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table1_dw_mar10.tex HTML table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table1_dw_mar10.html CSV table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table1_dw_mar10.csv

11 Table 2: March 10-13, 2023 - DW Borrowers vs Non-Borrowers

# ==============================================================================
# TABLE 2: March 10-13, 2023 - DW Borrowers vs Non-Borrowers
# ==============================================================================

dw_mar10_13 <- dw_loans_raw %>%
  filter(dw_loan_date >= as.Date("2023-03-10") & dw_loan_date <= as.Date("2023-03-13")) %>%
  distinct(rssd_id) %>%
  pull(rssd_id)

table2_data <- baseline_q %>%
  mutate(
    borrower_type = if_else(idrssd %in% dw_mar10_13, "DW Borrower", "Non-Borrower")
  )

table2 <- create_summary_table_v2(table2_data, "borrower_type",
                                   group_levels = c("DW Borrower", "Non-Borrower"))

# Display
table2 %>%
  select(-Row_Type) %>%
  kable(caption = "Table 2: Pre-Crisis Bank Characteristics - DW Borrowers vs Non-Borrowers (March 10-13, 2023)") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), full_width = FALSE)
Table 2: Pre-Crisis Bank Characteristics - DW Borrowers vs Non-Borrowers (March 10-13, 2023)
Variable DW Borrower Non-Borrower
N 93 4603
Book Equity Ratio 8.65 (8.46) 10.91 (9.01)
93 4603
MTM Loss (HTM) 0.24 (0.00) 0.20 (0.00)
93 4585
MTM Loss (Total) 5.50 (5.59) 5.47 (5.26)
93 4585
Adjusted Equity 3.15 (2.72) 5.28 (3.83)
93 4585
Uninsured Leverage 435.81 (382.71) 329.53 (247.81)
93 4603
MTM Insolvent 20.43 (0.00) 18.43 (0.00)
19 845
Run Risk (Median Cutoff) 43.01 (0.00) 23.03 (0.00)
40 1058
Run Risk (Q75 Cutoff) 11.83 (0.00) 4.07 (0.00)
11 187
IDCR Insolvent (s=0.5) 5.38 (0.00) 4.36 (0.00)
5 198
IDCR Insolvent (s=1.0) 33.33 (0.00) 27.94 (0.00)
31 1268
Capital Insolvent (s=0.5) 5.38 (0.00) 2.27 (0.00)
5 104
Capital Insolvent (s=1.0) 16.13 (0.00) 7.55 (0.00)
15 346
# Export (silently)
invisible(export_table(
  table2, 
  "table2_dw_mar10_13",
  caption = "Pre-Crisis Bank Characteristics: DW Borrowers vs Non-Borrowers (March 10--13, 2023)",
  label = "tab:dw_mar10_13",
  note = "Bank characteristics from 2022Q4 Call Reports. Values shown as Mean (Median) with N observations below. DW borrowers identified as banks with Discount Window loans between March 10--13, 2023. Sample excludes G-SIBs and failed banks."
))

LaTeX table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table2_dw_mar10_13.tex HTML table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table2_dw_mar10_13.html CSV table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table2_dw_mar10_13.csv

12 Table 3: March 9-14, 2023 - DW Borrowers vs Non-Borrowers

# ==============================================================================
# TABLE 3: March 9-14, 2023 - DW Borrowers vs Non-Borrowers
# ==============================================================================

dw_mar9_14 <- dw_loans_raw %>%
  filter(dw_loan_date >= as.Date("2023-03-09") & dw_loan_date <= as.Date("2023-03-14")) %>%
  distinct(rssd_id) %>%
  pull(rssd_id)

table3_data <- baseline_q %>%
  mutate(
    borrower_type = if_else(idrssd %in% dw_mar9_14, "DW Borrower", "Non-Borrower")
  )

table3 <- create_summary_table_v2(table3_data, "borrower_type",
                                   group_levels = c("DW Borrower", "Non-Borrower"))

# Display
table3 %>%
  select(-Row_Type) %>%
  kable(caption = "Table 3: Pre-Crisis Bank Characteristics - DW Borrowers vs Non-Borrowers (March 9-14, 2023)") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), full_width = FALSE)
Table 3: Pre-Crisis Bank Characteristics - DW Borrowers vs Non-Borrowers (March 9-14, 2023)
Variable DW Borrower Non-Borrower
N 129 4567
Book Equity Ratio 9.03 (8.68) 10.92 (9.01)
129 4567
MTM Loss (HTM) 0.19 (0.00) 0.20 (0.00)
129 4549
MTM Loss (Total) 5.55 (5.59) 5.47 (5.26)
129 4549
Adjusted Equity 3.48 (2.86) 5.29 (3.83)
129 4549
Uninsured Leverage 411.08 (352.70) 329.39 (247.44)
129 4567
MTM Insolvent 20.93 (0.00) 18.40 (0.00)
27 837
Run Risk (Median Cutoff) 40.31 (0.00) 22.94 (0.00)
52 1046
Run Risk (Q75 Cutoff) 10.85 (0.00) 4.04 (0.00)
14 184
IDCR Insolvent (s=0.5) 5.43 (0.00) 4.35 (0.00)
7 196
IDCR Insolvent (s=1.0) 34.88 (0.00) 27.85 (0.00)
45 1254
Capital Insolvent (s=0.5) 4.65 (0.00) 2.26 (0.00)
6 103
Capital Insolvent (s=1.0) 15.50 (0.00) 7.50 (0.00)
20 341
# Export (silently)
invisible(export_table(
  table3, 
  "table3_dw_mar9_14",
  caption = "Pre-Crisis Bank Characteristics: DW Borrowers vs Non-Borrowers (March 9--14, 2023)",
  label = "tab:dw_mar9_14",
  note = "Bank characteristics from 2022Q4 Call Reports. Values shown as Mean (Median) with N observations below. DW borrowers identified as banks with Discount Window loans between March 9--14, 2023. Sample excludes G-SIBs and failed banks."
))

LaTeX table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table3_dw_mar9_14.tex HTML table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table3_dw_mar9_14.html CSV table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table3_dw_mar9_14.csv

13 Table 4: Acute Period - BTFP, DW, Both, Non-Borrowers

# ==============================================================================
# TABLE 4: Acute Period (March 13 - May 1, 2023)
# ==============================================================================

acute_start <- as.Date("2023-03-13")
acute_end <- as.Date("2023-05-01")

btfp_acute <- btfp_loans_raw %>%
  filter(btfp_loan_date >= acute_start & btfp_loan_date <= acute_end) %>%
  distinct(rssd_id) %>%
  pull(rssd_id)

dw_acute <- dw_loans_raw %>%
  filter(dw_loan_date >= acute_start & dw_loan_date <= acute_end) %>%
  distinct(rssd_id) %>%
  pull(rssd_id)

table4_data <- baseline_q %>%
  mutate(
    btfp_user = idrssd %in% btfp_acute,
    dw_user = idrssd %in% dw_acute,
    borrower_type = case_when(
      btfp_user & dw_user ~ "Both",
      btfp_user & !dw_user ~ "BTFP Only",
      !btfp_user & dw_user ~ "DW Only",
      TRUE ~ "Non-Borrower"
    )
  )

table4 <- create_summary_table_v2(table4_data, "borrower_type",
                                   group_levels = c("BTFP Only", "DW Only", "Both", "Non-Borrower"))

# Display
table4 %>%
  select(-Row_Type) %>%
  kable(caption = "Table 4: Pre-Crisis Bank Characteristics by Borrower Type (Acute Period: March 13 - May 1, 2023)") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), full_width = FALSE)
Table 4: Pre-Crisis Bank Characteristics by Borrower Type (Acute Period: March 13 - May 1, 2023)
Variable BTFP Only DW Only Both Non-Borrower
N 382 316 96 3902
Book Equity Ratio 8.19 (8.06) 9.15 (8.90) 8.09 (8.17) 11.34 (9.14)
382 316 96 3902
MTM Loss (HTM) 0.23 (0.00) 0.22 (0.00) 0.32 (0.00) 0.20 (0.00)
382 316 96 3884
MTM Loss (Total) 6.18 (6.13) 5.69 (5.64) 5.98 (5.79) 5.37 (5.14)
382 316 96 3884
Adjusted Equity 2.01 (2.03) 3.47 (3.06) 2.11 (2.61) 5.77 (4.10)
382 316 96 3884
Uninsured Leverage 396.32 (323.88) 383.68 (293.78) 575.26 (372.85) 315.09 (235.29)
382 316 96 3902
MTM Insolvent 30.10 (0.00) 18.67 (0.00) 22.92 (0.00) 17.20 (0.00)
115 59 22 668
Run Risk (Median Cutoff) 39.79 (0.00) 33.86 (0.00) 48.96 (0.00) 20.34 (0.00)
152 107 47 792
Run Risk (Q75 Cutoff) 7.85 (0.00) 6.33 (0.00) 12.50 (0.00) 3.49 (0.00)
30 20 12 136
IDCR Insolvent (s=0.5) 3.40 (0.00) 7.28 (0.00) 3.12 (0.00) 4.27 (0.00)
13 23 3 164
IDCR Insolvent (s=1.0) 28.27 (0.00) 32.91 (0.00) 25.00 (0.00) 27.70 (0.00)
108 104 24 1063
Capital Insolvent (s=0.5) 1.57 (0.00) 4.11 (0.00) 7.29 (0.00) 2.14 (0.00)
6 13 7 83
Capital Insolvent (s=1.0) 9.69 (0.00) 12.03 (0.00) 12.50 (0.00) 7.05 (0.00)
37 38 12 274
# Export (silently)
invisible(export_table(
  table4, 
  "table4_acute_period",
  caption = "Pre-Crisis Bank Characteristics by Borrower Type: Acute Crisis Period",
  label = "tab:acute_period",
  note = "Bank characteristics from 2022Q4 Call Reports. Acute crisis period: March 13 -- May 1, 2023. Banks classified by facility usage during this period. Sample excludes G-SIBs and failed banks."
))

LaTeX table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table4_acute_period.tex HTML table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table4_acute_period.html CSV table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table4_acute_period.csv

14 Table 5: Q1 2023 - All Facilities

# ==============================================================================
# TABLE 5: Q1 2023 (Jan 1 - Mar 31) - BTFP, DW, FHLB, Combinations
# ==============================================================================

q1_start <- as.Date("2023-01-01")
q1_end <- as.Date("2023-03-31")

btfp_q1 <- btfp_loans_raw %>%
  filter(btfp_loan_date >= q1_start & btfp_loan_date <= q1_end) %>%
  distinct(rssd_id) %>%
  pull(rssd_id)

dw_q1 <- dw_loans_raw %>%
  filter(dw_loan_date >= q1_start & dw_loan_date <= q1_end) %>%
  distinct(rssd_id) %>%
  pull(rssd_id)

table5_data <- baseline_q %>%
  mutate(
    btfp_user = idrssd %in% btfp_q1,
    dw_user = idrssd %in% dw_q1,
    fhlb_user = idrssd %in% fhlb_borrowers,
    borrower_type = case_when(
      btfp_user & dw_user & fhlb_user ~ "All Three",
      btfp_user & dw_user & !fhlb_user ~ "BTFP+DW",
      btfp_user & !dw_user & fhlb_user ~ "BTFP+FHLB",
      !btfp_user & dw_user & fhlb_user ~ "DW+FHLB",
      btfp_user & !dw_user & !fhlb_user ~ "BTFP Only",
      !btfp_user & dw_user & !fhlb_user ~ "DW Only",
      !btfp_user & !dw_user & fhlb_user ~ "FHLB Only",
      TRUE ~ "Non-Borrower"
    )
  )

table5 <- create_summary_table_v2(table5_data, "borrower_type",
                                   group_levels = c("BTFP Only", "DW Only", "FHLB Only", 
                                                    "BTFP+DW", "BTFP+FHLB", "DW+FHLB", 
                                                    "All Three", "Non-Borrower"))

# Display
table5 %>%
  select(-Row_Type) %>%
  kable(caption = "Table 5: Pre-Crisis Bank Characteristics by Borrower Type (Q1 2023: Jan 1 - Mar 31)") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), full_width = FALSE) %>%
  scroll_box(width = "100%")
Table 5: Pre-Crisis Bank Characteristics by Borrower Type (Q1 2023: Jan 1 - Mar 31)
Variable BTFP Only DW Only FHLB Only BTFP+DW BTFP+FHLB DW+FHLB All Three Non-Borrower
N 167 286 772 45 51 106 27 3242
Book Equity Ratio 8.13 (7.92) 9.27 (8.77) 9.80 (9.32) 7.37 (7.39) 8.90 (8.67) 8.99 (8.83) 9.13 (8.88) 11.56 (9.02)
167 286 772 45 51 106 27 3242
MTM Loss (HTM) 0.22 (0.00) 0.27 (0.00) 0.17 (0.00) 0.32 (0.00) 0.14 (0.00) 0.21 (0.00) 0.34 (0.00) 0.20 (0.00)
167 286 772 45 51 106 27 3224
MTM Loss (Total) 6.07 (6.03) 5.47 (5.40) 5.96 (5.70) 6.18 (5.83) 6.19 (6.17) 5.85 (5.96) 5.98 (5.68) 5.28 (5.08)
167 286 772 45 51 106 27 3224
Adjusted Equity 2.06 (2.05) 3.80 (3.06) 3.84 (3.66) 1.19 (1.86) 2.71 (2.90) 3.14 (3.05) 3.15 (3.04) 6.05 (4.08)
167 286 772 45 51 106 27 3224
Uninsured Leverage 379.88 (330.91) 424.90 (290.72) 332.00 (236.69) 614.35 (388.70) 364.65 (330.89) 341.05 (316.04) 454.96 (316.34) 315.06 (238.34)
167 286 772 45 51 106 27 3242
MTM Insolvent 31.14 (0.00) 18.18 (0.00) 18.01 (0.00) 31.11 (0.00) 21.57 (0.00) 18.87 (0.00) 29.63 (0.00) 17.62 (0.00)
52 52 139 14 11 20 8 568
Run Risk (Median Cutoff) 38.92 (0.00) 29.37 (0.00) 24.87 (0.00) 55.56 (100.00) 49.02 (0.00) 33.96 (0.00) 40.74 (0.00) 20.41 (0.00)
65 84 192 25 25 36 11 660
Run Risk (Q75 Cutoff) 9.58 (0.00) 8.04 (0.00) 4.27 (0.00) 6.67 (0.00) 5.88 (0.00) 5.66 (0.00) 11.11 (0.00) 3.43 (0.00)
16 23 33 3 3 6 3 111
IDCR Insolvent (s=0.5) 3.59 (0.00) 5.24 (0.00) 5.70 (0.00) 2.22 (0.00) 3.92 (0.00) 6.60 (0.00) 7.41 (0.00) 3.96 (0.00)
6 15 44 1 2 7 2 126
IDCR Insolvent (s=1.0) 27.54 (0.00) 28.67 (0.00) 28.76 (0.00) 20.00 (0.00) 21.57 (0.00) 29.25 (0.00) 29.63 (0.00) 28.01 (0.00)
46 82 222 9 11 31 8 890
Capital Insolvent (s=0.5) 1.80 (0.00) 3.15 (0.00) 3.11 (0.00) 2.22 (0.00) 1.96 (0.00) 2.83 (0.00) 14.81 (0.00) 1.99 (0.00)
3 9 24 1 1 3 4 64
Capital Insolvent (s=1.0) 11.38 (0.00) 10.14 (0.00) 9.46 (0.00) 4.44 (0.00) 11.76 (0.00) 14.15 (0.00) 18.52 (0.00) 6.58 (0.00)
19 29 73 2 6 15 5 212
# Export (silently)
invisible(export_table(
  table5, 
  "table5_q1_2023",
  caption = "Pre-Crisis Bank Characteristics by Borrower Type: Q1 2023",
  label = "tab:q1_2023",
  note = "Bank characteristics from 2022Q4 Call Reports. Q1 2023: January 1 -- March 31, 2023. FHLB borrowers identified as banks with increased FHLB advances in 2023Q1 vs 2022Q4. Sample excludes G-SIBs and failed banks."
))

LaTeX table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table5_q1_2023.tex HTML table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table5_q1_2023.html CSV table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table5_q1_2023.csv

15 Table 6: Arbitrage Period - BTFP, DW, Both, Non-Borrowers

# ==============================================================================
# TABLE 6: Arbitrage Period (Nov 1, 2023 - Jan 24, 2024)
# ==============================================================================

arb_start <- as.Date("2023-11-01")
arb_end <- as.Date("2024-01-24")

btfp_arb <- btfp_loans_raw %>%
  filter(btfp_loan_date >= arb_start & btfp_loan_date <= arb_end) %>%
  distinct(rssd_id) %>%
  pull(rssd_id)

# Note: DW data ends 2023-12-31, so only partial coverage
dw_arb <- dw_loans_raw %>%
  filter(dw_loan_date >= arb_start & dw_loan_date <= min(arb_end, DW_DATA_END)) %>%
  distinct(rssd_id) %>%
  pull(rssd_id)

table6_data <- baseline_q %>%
  mutate(
    btfp_user = idrssd %in% btfp_arb,
    dw_user = idrssd %in% dw_arb,
    borrower_type = case_when(
      btfp_user & dw_user ~ "Both",
      btfp_user & !dw_user ~ "BTFP Only",
      !btfp_user & dw_user ~ "DW Only",
      TRUE ~ "Non-Borrower"
    )
  )

table6 <- create_summary_table_v2(table6_data, "borrower_type",
                                   group_levels = c("BTFP Only", "DW Only", "Both", "Non-Borrower"))

# Display
table6 %>%
  select(-Row_Type) %>%
  kable(caption = "Table 6: Pre-Crisis Bank Characteristics by Borrower Type (Arbitrage Period: Nov 1, 2023 - Jan 24, 2024)") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), full_width = FALSE)
Table 6: Pre-Crisis Bank Characteristics by Borrower Type (Arbitrage Period: Nov 1, 2023 - Jan 24, 2024)
Variable BTFP Only DW Only Both Non-Borrower
N 644 323 145 3584
Book Equity Ratio 8.57 (8.31) 9.55 (9.27) 8.15 (8.08) 11.51 (9.18)
644 323 145 3584
MTM Loss (HTM) 0.25 (0.00) 0.16 (0.00) 0.21 (0.00) 0.20 (0.00)
644 323 145 3566
MTM Loss (Total) 6.20 (5.96) 5.24 (5.09) 6.12 (6.12) 5.33 (5.12)
644 323 145 3566
Adjusted Equity 2.37 (2.28) 4.31 (4.14) 2.03 (1.93) 5.97 (4.15)
644 323 145 3566
Uninsured Leverage 414.69 (305.51) 361.76 (280.41) 535.11 (321.47) 305.76 (232.24)
644 323 145 3584
MTM Insolvent 27.33 (0.00) 14.55 (0.00) 31.72 (0.00) 16.69 (0.00)
176 47 46 595
Run Risk (Median Cutoff) 36.34 (0.00) 24.77 (0.00) 35.17 (0.00) 20.50 (0.00)
234 80 51 733
Run Risk (Q75 Cutoff) 7.14 (0.00) 4.95 (0.00) 11.03 (0.00) 3.35 (0.00)
46 16 16 120
IDCR Insolvent (s=0.5) 4.66 (0.00) 4.02 (0.00) 3.45 (0.00) 4.40 (0.00)
30 13 5 155
IDCR Insolvent (s=1.0) 31.99 (0.00) 29.72 (0.00) 32.41 (0.00) 26.99 (0.00)
206 96 47 950
Capital Insolvent (s=0.5) 1.86 (0.00) 4.64 (0.00) 6.21 (0.00) 2.05 (0.00)
12 15 9 73
Capital Insolvent (s=1.0) 8.85 (0.00) 11.15 (0.00) 13.79 (0.00) 6.95 (0.00)
57 36 20 248
# Export (silently)
invisible(export_table(
  table6, 
  "table6_arbitrage_period",
  caption = "Pre-Crisis Bank Characteristics by Borrower Type: Arbitrage Period",
  label = "tab:arbitrage_period",
  note = "Bank characteristics from 2022Q4 Call Reports. Arbitrage period: November 1, 2023 -- January 24, 2024 (BTFP rate below IORB). Note: DW data available only through December 31, 2023. Sample excludes G-SIBs and failed banks."
))

LaTeX table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table6_arbitrage_period.tex HTML table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table6_arbitrage_period.html CSV table saved: C:/Users/mferdo2/OneDrive - Louisiana State University/Finance_PhD/DW_Stigma_paper/Liquidity_project_2025/03_documentation/borrowing_stat/tables/table6_arbitrage_period.csv

16 Table 7: FHLB Borrower Characteristics

# ==============================================================================
# TABLE 7: FHLB Borrower Characteristics (Q1 2023)
# ==============================================================================

# Prepare data with FHLB variables
table7_data <- baseline_q %>%
  mutate(
    # Rename FHLB variables for clarity
    fhlb_change = change_fhlb_adv_fwd_q,
    fhlb_abnormal_5pct = abnormal_fhlb_borrowing_5pct,
    fhlb_abnormal_10pct = abnormal_fhlb_borrowing_10pct,
    # Scale total assets to billions for readability
    total_asset_bn = total_asset / 1e9,
    # Categorize by FHLB usage
    fhlb_user = idrssd %in% fhlb_borrowers,
    btfp_user = idrssd %in% btfp_q1,
    dw_user = idrssd %in% dw_q1,
    borrower_type = case_when(
      fhlb_user & btfp_user & dw_user ~ "FHLB+BTFP+DW",
      fhlb_user & btfp_user & !dw_user ~ "FHLB+BTFP",
      fhlb_user & !btfp_user & dw_user ~ "FHLB+DW",
      fhlb_user & !btfp_user & !dw_user ~ "FHLB Only",
      !fhlb_user & (btfp_user | dw_user) ~ "Fed Only",
      TRUE ~ "Non-Borrower"
    )
  )

# Define variables and labels for summary stats
fhlb_vars <- c(
  "fhlb_change", "fhlb_abnormal_5pct", "fhlb_abnormal_10pct",
  "total_asset_bn", "book_equity_to_total_asset", "mtm_loss_to_total_asset",
  "adjusted_equity", "uninsured_deposit_to_total_asset", "uninsured_leverage",
  "mtm_insolvent", "run_risk_median", "run_risk_q75"
)

fhlb_labels <- c(
  "fhlb_change", "fhlb_abnormal_5pct", "fhlb_abnormal_10pct",
  "total_asset_bn", "book_equity_ratio", "mtm_loss_ratio",
  "adjusted_equity", "uninsured_dep_ratio", "uninsured_leverage",
  "mtm_insolvent", "run_risk_median", "run_risk_q75"
)

# FHLB borrower breakdown
table7_data %>%
  count(borrower_type) %>%
  arrange(desc(n)) %>%
  pander(caption = "FHLB Borrower Breakdown")
FHLB Borrower Breakdown
borrower_type n
Non-Borrower 3242
FHLB Only 772
Fed Only 498
FHLB+DW 106
FHLB+BTFP 51
FHLB+BTFP+DW 27
# Full sample summary stats
full_stats <- summary_stats(table7_data, fhlb_vars, fhlb_labels)
pander(full_stats, caption = "Full Sample Summary Statistics")
Full Sample Summary Statistics
Variable Obs Mean SD P10 P25 P50 P75 P90
fhlb_change 2469 159.1 3147 -90.08 -30.51 0 30.37 120
fhlb_abnormal_5pct 4696 0.05 0.22 0 0 0 0 0
fhlb_abnormal_10pct 4696 0.07 0.25 0 0 0 0 0
total_asset_bn 4696 0 0.02 0 0 0 0 0
book_equity_ratio 4696 10.87 10.44 5.55 7.24 9 11.18 14.95
mtm_loss_ratio 4678 5.47 4.34 2.65 3.8 5.27 6.96 8.48
adjusted_equity 4678 5.24 11.39 -1.72 0.97 3.81 6.73 10.46
uninsured_dep_ratio 4696 23.27 12.38 8.87 14.81 21.93 30.17 39.09
uninsured_leverage 4696 331.6 823.5 75.6 152.6 250.9 374.1 541.4
mtm_insolvent 4678 0.18 0.39 0 0 0 0 1
run_risk_median 4688 0.23 0.42 0 0 0 0 1
run_risk_q75 4689 0.04 0.2 0 0 0 0 0
# Summary stats by borrower type
for (btype in c("FHLB Only", "FHLB+BTFP", "FHLB+DW", "FHLB+BTFP+DW", "Fed Only", "Non-Borrower")) {
  group_data <- table7_data %>% filter(borrower_type == btype)
  if (nrow(group_data) > 0) {
    group_stats <- summary_stats(group_data, fhlb_vars, fhlb_labels)
    pander(group_stats, caption = paste0(btype, " (N = ", nrow(group_data), ")"))
  }
}

Notes: Bank characteristics from 2022Q4 Call Reports. FHLB borrowers identified as banks with increased FHLB advances in 2023Q1 vs 2022Q4. Abnormal FHLB borrowing is measured using Z-scores calculated as (current quarter change - mean) / std, where mean and standard deviation are computed from the prior 8 quarters (2021Q1-2022Q4). Abnormal FHLB (5%) indicates Z > 1.65 (top 5 percentile); Abnormal FHLB (10%) indicates Z > 1.28 (top 10 percentile). Fed Only = BTFP and/or DW but no FHLB increase. Sample excludes G-SIBs and failed banks.

17 Summary Statistics

# ==============================================================================
# SUMMARY OF BORROWER COUNTS
# ==============================================================================

summary_counts <- tribble(
  ~Table, ~Period, ~Description, ~N_Borrowers, ~N_Total,
  "Table 1", "March 10, 2023", "DW only", length(dw_mar10), nrow(baseline_q),
  "Table 2", "March 10-13, 2023", "DW only", length(dw_mar10_13), nrow(baseline_q),
  "Table 3", "March 9-14, 2023", "DW only", length(dw_mar9_14), nrow(baseline_q),
  "Table 4", "Acute (Mar 13 - May 1)", "BTFP + DW", length(union(btfp_acute, dw_acute)), nrow(baseline_q),
  "Table 5", "Q1 2023 (Jan-Mar)", "BTFP + DW + FHLB", length(union(union(btfp_q1, dw_q1), fhlb_borrowers)), nrow(baseline_q),
  "Table 6", "Arbitrage (Nov 1 - Jan 24)", "BTFP + DW", length(union(btfp_arb, dw_arb)), nrow(baseline_q),
  "Table 7", "Q1 2023", "FHLB focus", length(fhlb_borrowers), nrow(baseline_q)
)

summary_counts %>%
  kable(caption = "Summary of Borrower Counts Across Tables") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), full_width = FALSE)
Summary of Borrower Counts Across Tables
Table Period Description N_Borrowers N_Total
Table 1 March 10, 2023 DW only 52 4696
Table 2 March 10-13, 2023 DW only 98 4696
Table 3 March 9-14, 2023 DW only 137 4696
Table 4 Acute (Mar 13 - May 1) BTFP + DW 813 4696
Table 5 Q1 2023 (Jan-Mar) BTFP + DW + FHLB 1471 4696
Table 6 Arbitrage (Nov 1 - Jan 24) BTFP + DW 1132 4696
Table 7 Q1 2023 FHLB focus 956 4696
# Save summary (silently)
invisible(write_csv(summary_counts, file.path(TABLE_PATH, "summary_borrower_counts.csv")))

18 Session Info