function(data_sec_agg_r,
billionaires_ca_inctax,
ftb_b4a) {
bci <- billionaires_ca_inctax
cell <- function(addr) xls_cell(bci, addr)
agg <- .bci_make_agg(data_sec_agg_r)
ftb <- .bci_make_ftb(ftb_b4a)
# ---- Memo 1 + D99 correction --------------------------------------------
m1 <- .bci_memo1(bci)
# D99 = (Memo 2 implied fed-tax rate) / (Memo 1 fed-tax rate, 2018-2020 avg)
B96 <- cell("B96"); B98 <- cell("B98")
D99 <- (B98 / B96) / mean(m1$fed_tax_per_agi[1:3])
# ---- Method I year panel (rows 6..55) -----------------------------------
yrs <- 2018:2026
pan_cols <- c("B","C","D","E","F","G","H","I","J")
# Block A: CA billionaires (rows 8-10).
n_ca_b <- xls_cells_row(bci, pan_cols, 8)
total_w_ca <- c(NA_real_, agg("C"), NA_real_)
avg_w_ca <- total_w_ca / n_ca_b
# Block B: aggregate CA income tax stats (rows 13-21).
stats <- .bci_aggregate_stats(bci, ftb)
# Block C: top-bracket Pareto projection (rows 26-44).
pct_overshoot_yr <- unname(m1$pct_overshoot[c("2018","2019","2020","2021","2022","2023")])
brk <- .bci_top_brackets(bci, ftb, n_ca_b, pct_overshoot_yr)
# Rows 46-47: literal correction factors.
inc_top_w_rel <- c(rep(cell("B46"), 6), NA_real_, NA_real_, NA_real_)
corr_passthru <- c(rep(D99, 6), NA_real_, NA_real_, NA_real_)
# Row 49 (CA inctax paid by CA Forbes billionaires) -- MAIN OUTPUT.
# B-G49: row44 * row46 * row47; H49, I49 = row50 * row15 (computed below).
ca_inctax_ca_b <- rep(NA_real_, 9)
ca_inctax_ca_b[1:6] <- brk$proj_tax_top_corr * inc_top_w_rel[1:6] * corr_passthru[1:6]
# Row 50 = row 49 / row 18. H50 = AVG(B50:G50); I50 = E50 (2021).
pct_ca_inctax_by_b <- numeric(9)
pct_ca_inctax_by_b[1:6] <- ca_inctax_ca_b[1:6] / stats$ca_inctax_total_full[1:6]
pct_ca_inctax_by_b[7] <- mean(pct_ca_inctax_by_b[1:6])
pct_ca_inctax_by_b[8] <- pct_ca_inctax_by_b[4]
pct_ca_inctax_by_b[9] <- NA_real_
ca_inctax_ca_b[7] <- pct_ca_inctax_by_b[7] * stats$H15
ca_inctax_ca_b[8] <- pct_ca_inctax_by_b[8] * stats$I15
# Row 51 = row 49 / row 10. Row 53 from data_sec_agg!S. Row 54 = D/C share.
# Row 55 = row 53 / row 49.
ca_inctax_b_per_w <- ca_inctax_ca_b / total_w_ca
ca_inctax_public_b <- c(NA_real_, agg("S"), NA_real_)
public_share_b <- c(NA_real_, agg("D") / agg("C"), NA_real_)
ca_inctax_public_per_b_b <- ca_inctax_public_b / ca_inctax_ca_b
method1 <- tibble::tibble(
year = yrs,
n_ca_billionaires = n_ca_b,
avg_wealth_ca_b = avg_w_ca,
total_wealth_ca_b = total_w_ca,
n_returns_ca = stats$n_returns_ca,
ca_agi_b = stats$ca_agi_b,
ca_inctax_residents_b = stats$ca_inctax_resid_b,
ca_inctax_passthrough_b = stats$ca_inctax_part16,
ca_inctax_partyear_nonres_b = stats$ca_inctax_part17,
ca_inctax_total_b = stats$ca_inctax_total_full,
ca_inctax_fy_b = stats$ca_inctax_fy_b,
fy_to_cy_adjustment = stats$fy_to_cy_adj,
n_returns_10m = c(brk$n_ret_10m, NA_real_, NA_real_, NA_real_),
ca_agi_10m_b = c(brk$agi_10m_b, NA_real_, NA_real_, NA_real_),
ca_taxable_10m_b = c(brk$taxable_10m_b, NA_real_, NA_real_, NA_real_),
ca_tax_10m_b = c(brk$tax_10m_b, NA_real_, NA_real_, NA_real_),
ca_tax_rate_10m = c(brk$tax_rate_10m, NA_real_, NA_real_, NA_real_),
pareto_b_10m_bracket = c(brk$pareto_b_10m, NA_real_, NA_real_, NA_real_),
n_returns_5m = c(brk$n_ret_5m, NA_real_, NA_real_, NA_real_),
ca_agi_5m_b = c(brk$agi_5m_b, NA_real_, NA_real_, NA_real_),
ca_taxable_5m_b = c(brk$taxable_5m_b, NA_real_, NA_real_, NA_real_),
ca_tax_5m_b = c(brk$tax_5m_b, NA_real_, NA_real_, NA_real_),
ca_tax_rate_5m = c(brk$tax_rate_5m, NA_real_, NA_real_, NA_real_),
pareto_b_5m_bracket = c(brk$pareto_b_5m, NA_real_, NA_real_, NA_real_),
proj_cutoff_top_pre_m = c(brk$proj_cutoff_top, NA_real_, NA_real_, NA_real_),
proj_agi_top_pre_b = c(brk$proj_agi_top, NA_real_, NA_real_, NA_real_),
proj_tax_top_pre_b = c(brk$proj_tax_top, NA_real_, NA_real_, NA_real_),
proj_cutoff_top_5m_m = c(brk$proj_cutoff_top_5m, NA_real_, NA_real_, NA_real_),
proj_agi_top_5m_b = c(brk$proj_agi_top_5m, NA_real_, NA_real_, NA_real_),
proj_agi_top_corr_b = c(brk$proj_agi_top_corr, NA_real_, NA_real_, NA_real_),
proj_tax_top_corr_b = c(brk$proj_tax_top_corr, NA_real_, NA_real_, NA_real_),
income_top_wealth_relative = inc_top_w_rel,
correction_passthrough = corr_passthru,
ca_inctax_ca_billionaires_b = ca_inctax_ca_b,
pct_ca_inctax_by_billionaires = pct_ca_inctax_by_b,
ca_inctax_per_wealth = ca_inctax_b_per_w,
ca_inctax_public_assets_b = ca_inctax_public_b,
public_assets_share = public_share_b,
ca_inctax_public_share_of_total = ca_inctax_public_per_b_b
)
robustness <- .bci_robustness(bci, D99, ca_inctax_ca_b,
brk$tax_5m_b, brk$agi_5m_b)
all_taxes <- .bci_all_taxes(
yrs = yrs,
proj_agi_top_corr = brk$proj_agi_top_corr,
inc_top_w_rel = inc_top_w_rel,
ca_inctax_ca_b = ca_inctax_ca_b,
m1_fed_tax_per_agi = m1$fed_tax_per_agi,
D99 = D99,
agg = agg,
public_share_b = public_share_b,
total_w_ca = total_w_ca
)
list(
method1 = method1,
memo1 = m1$memo1,
robustness = robustness,
all_taxes = all_taxes
)
}
# Read-only display. Edit R/compute_billionaires_ca_inctax.R:555-672.