-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rachel_4_19_Presentation.R
550 lines (456 loc) · 23.9 KB
/
Rachel_4_19_Presentation.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
### Materials for Rachel Weber's 4/19/24 Slide Deck ###
### MVH 4-12-24 ###
# Load packages and data
library(tidyverse)
options(scipen = 999)
# Trends in Incentivized FMV as a percent of the base over time
## Data prep
muni_MC <- read_csv("./Output/ptaxsim_muni_class_summaries_2006-2022.csv") %>%
select(year, clean_name, class, av)
class_dict <- read_csv("./Necessary_Files/class_dict_expanded.csv") %>%
select(class = class_code, class_1dig, assess_ratio, incent_prop, Alea_cat, major_class_code)
muni_MC <- muni_MC %>%
left_join(class_dict, by = c("class")) %>%
filter(class !=0) # drop exempt property types with 0 taxable value
#class_8_munis <- read_csv("./Necessary_Files/datarequests_Class8Munis.csv")
class_8_munis <- read_csv("./Output/datarequests_Class8Munis.csv")
# changed from as.list to as.character
class_8_munis <- as.character(class_8_munis$clean_name)
# class 8 munis - at the year-class level
class_8_df <- # left_join(muni_MC, class_dict, by = "class") %>%
muni_MC %>%
filter(clean_name %in% class_8_munis) %>%
filter(av != 0) %>%
mutate(FMV = av/assess_ratio) %>%
group_by(year) %>%
mutate(year_tb_tot = sum(FMV)) %>% # tax base for all class 8 munis together, per year
ungroup() %>%
filter(Alea_cat %in% c("Industrial", "Commercial")) %>% ## drops all non-industrial and non-commercial classes to calculate the rest of the totals
group_by(year) %>%
mutate(year_ind_comm_FMV = sum(FMV)) %>% # total commercial and industrial FMV for all class 8 munis together, per year
ungroup() %>%
group_by(year, clean_name) %>%
mutate(muni_year_ind_comm_FMV = sum(FMV)) %>% # calculates total FMV in each munis each year
ungroup() %>%
group_by(year, Alea_cat) %>%
mutate(cat_year_FMV = sum(FMV)) %>% # calculates FMV within each commercial vs industrial category for each year
ungroup() %>%
## Do you want class_1dig or major_class_code? Does it matter?
## probably not if I already had joined in the commecial and industrial codes to the class level data...
group_by(year, clean_name, class_1dig) %>% # total fmv in class 5, 6, 7, and 8 per muni
mutate(year_muni_class_FMV = sum(FMV))
## Added this for cook level totals:
class_8_df_outofCook <-
muni_MC %>%
# filter(clean_name %in% class_8_munis) %>% ## keep all munis, use for cook county totals.
filter(av != 0) %>%
mutate(FMV = av/assess_ratio) %>%
group_by(year) %>%
mutate(year_tb_tot = sum(FMV)) %>% # tax base for all class 8 munis together, per year
ungroup() %>%
filter(Alea_cat %in% c("Industrial", "Commercial")) %>% ## drops all non-industrial and non-commercial classes to calculate the rest of the totals
group_by(year) %>%
mutate(year_ind_comm_FMV = sum(FMV)) %>% # total commercial and industrial FMV for all class 8 munis together, per year
ungroup() %>%
group_by(year, clean_name) %>%
mutate(muni_year_ind_comm_FMV = sum(FMV)) %>% # calculates total FMV in each munis each year
ungroup() %>%
group_by(year, Alea_cat) %>%
mutate(cat_year_FMV = sum(FMV)) %>% # calculates FMV within each commercial vs industrial category for each year
ungroup() %>%
## Do you want class_1dig or major_class_code? Does it matter?
## probably not if I already had joined in the commecial and industrial codes to the class level data...
group_by(year, clean_name, class_1dig) %>% # total fmv in class 5, 6, 7, and 8 per muni
mutate(year_muni_class_FMV = sum(FMV))
class(class_8_df$class_1dig) ## moved this lower because it didn't exist yet when you ran it
# Class 8 Munis
## Incentive types over time (line graph and line-area graph)
# ggplot() +
# geom_line(data = class_8_df %>%
# summarize(ind_comm_perc = year_ind_comm_FMV/year_tb_tot), aes(x = year, y = ind_comm_perc)) +#, color = "Ind. & Comm. FMV") +
# geom_line(data = class_8_df %>%
# filter(incent_prop == "Incentive") %>%
# group_by(year) %>%
# summarise(incent_perc = sum(FMV)/year_tb_tot),
# aes(x = year, y = incent_perc)#,
# #color = "Incent. Class FMV"
# ) +
# geom_line(data = class_8_df %>%
# filter(class_1dig == 8)) + # was missing a + sign here
# theme_classic() +
# scale_x_continuous(breaks = seq(2006, 2022, by = 3)) +
# scale_y_continuous(labels = scales::percent_format(), limits = c(0, 0.45), breaks = seq(0, 0.5, by = 0.05))
## Class 8 Townships Graph -------------------
## Alea Version:
ggplot() +
geom_line(data = class_8_df %>%
group_by(year) %>%
summarize(ind_comm_perc = mean(year_ind_comm_FMV/year_tb_tot)),
aes(x = year, y = ind_comm_perc, color = "Commercial+Industrial"), lwd = 1) +
# industrial fmv
geom_line(data = class_8_df %>%
filter(Alea_cat == "Industrial") %>%
group_by(year) %>%
# needed na.rm=TRUE, otherwise it didn't work. perc_industrial was not being calculated without it.
summarize(perc_industrial = sum(FMV/year_tb_tot, na.rm=TRUE)), ## added this part
aes(x = year, y = perc_industrial, color = "Industrial"), lwd = 1) +
# commercial fmv
geom_line(data = class_8_df %>%
filter(Alea_cat == "Commercial") %>%
group_by(year) %>%
summarize(perc_commercial = sum(FMV/year_tb_tot, na.rm=TRUE)), ## added this part
aes(x = year, y = perc_commercial, color = "Commercial"), lwd = 1) +
geom_line(data = class_8_df %>%
filter(incent_prop == "Incentive") %>%
group_by(year) %>%
summarise(incent_perc = sum(FMV)/year_tb_tot),
aes(x = year, y = incent_perc, color = "Incentive Classes"), lwd = 1 ) +
geom_line(data = class_8_df %>% # threw error here, missing x and y in aes()
filter(class_1dig == 8) %>%
group_by(year) %>%
summarize(perc_8 = sum(FMV/year_tb_tot)), ## added this part
aes(x = year, y = perc_8, color = "Class 8"), lwd = 1) + # was missing a + sign here
theme_classic() +
scale_x_continuous(name = "", breaks = seq(2006, 2022, by = 3), limits = c(2006, 2022), expand = c(0,0)) +
scale_y_continuous(name = "Percent of FMV", labels = scales::percent_format(), limits = c(0, 0.20),
breaks = seq(0, 0.5, by = 0.05), expand = c(0,0)) +
scale_color_manual(name = "", values = c("Commercial+Industrial" = "black", "Industrial" = "gray70", "Commercial" = "gray50", "Incentive Classes" = "orange", "Class 8" = "red" )) +
theme(legend.position = "bottom") +
labs(title = "Property in the Class 8 Townships") +
guides(color = guide_legend(nrow=2, byrow = TRUE))
## Percentage out of Cook County ---------------------
## Alea Version for Cook Level:
ggplot() +
# Commercial + Industrial FMV in cook
geom_line(data = class_8_df_outofCook %>%
group_by(year) %>% #didn't group by year before?
summarize(ind_comm_perc = mean(year_ind_comm_FMV/year_tb_tot)),
aes(x = year, y = ind_comm_perc, color = "Commercial+Industrial"), lwd = 1) +
# incentive class properties in cook
geom_line(data = class_8_df_outofCook %>%
filter(incent_prop == "Incentive") %>%
group_by(year) %>%
summarise(incent_perc = sum(FMV/year_tb_tot)),
aes(x = year, y = incent_perc, color = "Incentive Classes"), lwd = 1 ) +
# FMV with class 8 property class in cook county
geom_line(data = class_8_df_outofCook %>% # threw error here, missing x and y in aes()
filter(class_1dig == 8) %>%
group_by(year) %>%
summarize(perc_8 = sum(FMV/year_tb_tot)), ## added this part
aes(x = year, y = perc_8, color = "Class 8"), lwd = 1) + # was missing a + sign here
# industrial fmv in cook county
geom_line(data = class_8_df_outofCook %>% # threw error here, missing x and y in aes()
filter(Alea_cat == "Industrial") %>%
group_by(year) %>%
# needed na.rm=TRUE, otherwise it didn't work. perc_industrial was not being calculated without it.
summarize(perc_industrial = sum(FMV/year_tb_tot, na.rm=TRUE)), ## added this part
aes(x = year, y = perc_industrial, color = "Industrial"), lwd = 1) +
# commercial fmv in cook county
geom_line(data = class_8_df_outofCook %>% # threw error here, missing x and y in aes()
filter(Alea_cat == "Commercial") %>%
group_by(year) %>%
summarize(perc_commercial = sum(FMV/year_tb_tot, na.rm=TRUE)), ## added this part
aes(x = year, y = perc_commercial, color = "Commercial"), lwd = 1) +
# make it pretty:
theme_classic() +
scale_x_continuous(name = "", breaks = seq(2006, 2022, by = 3), limits = c(2006, 2022), expand = c(0,0)) +
scale_y_continuous(name = "Percent of County FMV", labels = scales::percent_format(), limits = c(0, 0.20),
breaks = seq(0, 0.5, by = 0.05), expand = c(0,0)) +
scale_color_manual(name = "", values = c("Commercial+Industrial" = "black", "Industrial" = "gray80", "Commercial" = "gray40", "Incentive Classes" = "orange", "Class 8" = "red")) +
theme(legend.position = "bottom") +
labs(title= "Cook County Commercial & Industrial FMV") + guides(color = guide_legend(nrow=2, byrow = TRUE))
## Newest Addition for April 30th Presentation --------------------
ggplot() +
# incentive class properties in cook
geom_line(data = class_8_df_outofCook %>%
filter(incent_prop == "Incentive") %>%
group_by(year) %>%
summarise(incent_perc = sum(FMV/year_ind_comm_FMV)),
aes(x = year, y = incent_perc, color = "Incentive Classes"), lwd = 1 ) +
# FMV with class 8 property class in cook county
geom_line(data = class_8_df_outofCook %>%
filter(class_1dig == 8) %>%
group_by(year) %>%
summarize(perc_8 = sum(FMV/year_ind_comm_FMV)),
aes(x = year, y = perc_8, color = "Class 8"), lwd = 1) +
# make it pretty:
theme_classic() +
scale_x_continuous(name = "", breaks = seq(2006, 2022, by = 3), limits = c(2006, 2022), expand = c(0,0)) +
scale_y_continuous(name = "Percent of Com+Ind FMV", labels = scales::percent_format(), limits = c(0, 0.25),
breaks = seq(0, 0.5, by = 0.05), expand = c(0,0)) +
scale_color_manual(name = "", values = c("Industrial" = "gray80", "Commercial" = "gray40", "Incentive Classes" = "orange", "Class 8" = "red")) +
theme(legend.position = "bottom") +
labs(title= "Cook County", subtitle = "Share of Commercial & Industrial FMV with Incentive Classification") + guides(color = guide_legend(nrow=2, byrow = TRUE))
ggplot() +
geom_line(data = class_8_df %>%
filter(incent_prop == "Incentive") %>%
group_by(year) %>%
summarise(incent_perc = sum(FMV/year_ind_comm_FMV)),
aes(x = year, y = incent_perc, color = "All Incentive Classes"), lwd = 1 ) +
geom_line(data = class_8_df %>%
filter(class_1dig == 8) %>%
group_by(year) %>%
summarize(perc_8 = sum(FMV/year_ind_comm_FMV)),
aes(x = year, y = perc_8, color = "Class 8"), lwd = 1) +
# make it pretty:
theme_classic() +
scale_x_continuous(name = "", breaks = seq(2006, 2022, by = 3), limits = c(2006, 2022), expand = c(0,0)) +
scale_y_continuous(name = "Percent of Com&Ind FMV", labels = scales::percent_format(), # limits = c(0, 0.25),
breaks = seq(0, 0.5, by = 0.05), expand = c(0,0)) +
scale_color_manual(name = "", values = c("Commercial+Industrial" = "black", "Industrial" = "gray80", "Commercial" = "gray40", "All Incentive Classes" = "orange", "Class 8" = "red")) +
theme(legend.position = "bottom") +
labs(title= "Class 8 Townships", subtitle = "Share of Commercial & Industrial FMV with Incentive Classification") + guides(color = guide_legend(nrow=2, byrow = TRUE))
## Other variations --------------------------
## this one doesn't work because you never pass a data frame to it..
# Linegraph
# ggplot() +
# geom_line(aes(x = year, y = total_incent_ratio, color = "Ind. & Comm. FMV"), linewidth = 1.5) +
# geom_line(aes(x = year, y = inc_ind_ratio, color = "Industrial %"), linewidth = 1.5) +
# geom_line(aes(x = year, y = inc_com_ratio, color = "Commercial %"), linewidth = 1.5) +
# geom_line(aes(x = year, y = class_8_ratio, color = "Class-8 %"), linewidth = 1.5) +
# labs(y = "percent") +
# scale_color_manual(values = c("#b2182b", "#fd8d3c", "#878787", "#000000")) +
# theme_classic() +
# scale_x_continuous(breaks = seq(2006, 2022, by = 3)) +
# scale_y_continuous(labels = scales::percent_format(), limits = c(0, 0.45), breaks = seq(0, 0.5, by = 0.05)) +
# guides(color = guide_legend(title = NULL))
plot_df <- muni_MC %>%
# left_join(muni_MC, class_dict, by = "class") %>%
mutate(FMV = av/assess_ratio) %>%
select(year, class_1dig, incent_prop, Alea_cat, FMV) %>%
filter(Alea_cat %in% c("Commercial", "Industrial")) %>%
reframe(FMV = sum(FMV, na.rm=TRUE), .by = c("year", "class_1dig", "Alea_cat", "incent_prop")) %>%
group_by(year) %>%
mutate(year_sum_FMV = sum(FMV, na.rm = TRUE)) %>%
ungroup() %>%
group_by(year, Alea_cat) %>%
mutate(cat_year_FMV = sum(FMV, na.rm=TRUE)) %>%
ungroup() %>%
# mutate(class_8 = ifelse(class_1dig == 8, 1, 0)) %>%
group_by(year #, class_8
) %>%
## changed how year_class_8_FMV was calculated. sums if class is 8, otherwise leaves it as 0
mutate(year_class_8_FMV = ifelse(class_1dig == 8, sum(FMV, na.rm=TRUE), 0)) %>%
ungroup() %>%
arrange(desc(year))
plot_df_FMV_cook <- muni_MC %>%
# left_join(muni_MC, class_dict, by = "class") %>%
mutate(FMV = av/assess_ratio) %>%
select(year, class_1dig, incent_prop, Alea_cat, FMV) %>%
filter(Alea_cat %in% c("Commercial", "Industrial")) %>%
group_by(year) %>%
summarize(year_max_tb = sum(FMV)) %>%
# select(year, year_max_tb) %>%
# distinct() %>%
arrange(year)
# is this for commercial FMV totals for county or class 8 munis?
plot_df_comm <- muni_MC %>%
filter(Alea_cat == "Commercial") %>%
mutate(FMV = av/assess_ratio) %>%
# select(year, class_1dig, incent_prop, Alea_cat, FMV) %>%
# group_by(year, class_1dig, incent_prop, FMV) %>%
reframe(year, class_1dig, incent_prop, Alea_cat, FMV,
comm_tb = sum(FMV, na.rm=TRUE), .by = year) %>%
# mutate(comm_tb = sum(FMV)) %>% # total commercial FMV each year
filter(class_1dig %in% c(7, 8)) %>%
#distinct() %>%
reframe(year, comm_tb,
comm_inc_FMV = sum(FMV, na.rm=TRUE), .by = year) %>%
# mutate(comm_inc_FMV = sum(FMV)) %>% # amount FMV incentivized each year
# ungroup() %>%
arrange(year) %>%
# select(year, comm_inc_FMV, comm_tb) %>% ### needed to select year here!!
distinct()
plot_df_ind <- muni_MC %>%
#left_join(muni_MC, class_dict, by = "class") %>%
mutate(FMV = av/assess_ratio) %>%
select(year, class_1dig, incent_prop, Alea_cat, FMV) %>%
filter(Alea_cat %in% c("Industrial")) %>%
group_by(year) %>%
mutate(ind_tb = sum(FMV)) %>%
filter(class_1dig %in% c(6, 8)) %>%
mutate(ind_inc_FMV = sum(FMV)) %>%
arrange(year) %>%
select(ind_inc_FMV, ind_tb) %>%
distinct()
plot_df_8 <- muni_MC %>%
# left_join(muni_MC, class_dict, by = "class") %>%
mutate(FMV = av/assess_ratio) %>%
select(year, class_1dig, incent_prop, Alea_cat, FMV) %>%
filter(Alea_cat %in% c("Commercial", "Industrial")) %>%
group_by(year) %>%
mutate(class_8 = ifelse(class_1dig == 8, 1, 0)) %>%
filter(class_8 == 1) %>%
group_by(year) %>%
mutate(year_class_8_FMV = sum(FMV)) %>%
arrange(year) %>%
select(year_class_8_FMV) %>%
distinct()
plot_df_final <- plot_df_FMV_cook %>% # changed initial dataframe
# plot_df_FMV %>%
left_join(plot_df_8) %>%
left_join(plot_df_comm) %>%
left_join(plot_df_ind) %>%
#mutate ratio variables
mutate(class_8_ratio = year_class_8_FMV/year_max_tb,
inc_ind_ratio = ind_inc_FMV/ind_tb,
inc_com_ratio = comm_inc_FMV/comm_tb,
total_incent_ratio =
(year_class_8_FMV + ind_inc_FMV + comm_inc_FMV)/year_max_tb)
#make line graph
plot_df_final %>%
ggplot() +
geom_line(aes(x = year, y = total_incent_ratio, color = "Ind. & Comm. FMV"), linewidth = 1.5) +
geom_line(aes(x = year, y = inc_ind_ratio, color = "Industrial %"), linewidth = 1.5) +
geom_line(aes(x = year, y = inc_com_ratio, color = "Commercial %"), linewidth = 1.5) +
geom_line(aes(x = year, y = class_8_ratio, color = "Class-8 %"), linewidth = 1.5) +
labs(y = "percent") +
scale_color_manual(values = c("#b2182b", "#fd8d3c", "#878787", "#000000")) +
theme_classic() +
theme(legend.position = "bottom") +
scale_x_continuous(breaks = seq(2006, 2022, by = 3)) +
scale_y_continuous(labels = scales::percent_format(), limits = c(0, 0.45), breaks = seq(0, 0.5, by = 0.05)) +
guides(color = guide_legend(title = NULL), color = guide_legend(nrow=2, byrow = TRUE))
#### Fixed above dataframe and line graph #######
###### Stopped HERE night of 4/19 ####
# Class 8 Muni Trends over Time
class8_df <- read_csv("./Output/class_8_ind_comm_FMV.csv")
class8_df_sums <- class8_df %>%
group_by(year, incentive, type) %>%
summarize(year, incentive, type, sum(FMV))
#make bar chart (NOT A HISTOGRAM)
## Michael version ##
# plot_df_final %>%
# ggplot() +
# geom_col(aes(x = year - 0.1, y = total_incent_ratio, fill = "Total Incentives"),# width = .1,
# position = position_dodge(width = 0.2)) +
# geom_col(aes(x = year, y = inc_ind_ratio, fill = "Industrial"),
# position = position_dodge(width = 0.2), width = .1) +
# geom_col(aes(x = year + 0.1, y = inc_com_ratio, fill = "Commercial"),
# position = position_dodge(width = 0.2), width = .1) +
# scale_fill_manual(values = c("Total" = "#fecc5c", "Industrial" = "#fd8d3c", "Commercial" = "#bd0026")) +
# theme_classic() +
# labs(x = "Year", y = "Ratio") + theme()
### Simple Version ###
plot_df_final %>%
ggplot( ) +
# this was too small to show up in the graph. It would need to become a separate graph.
geom_col(aes(x = year , y = total_incent_ratio, fill = "Total Incentives")) + # First I thought it wasn't working
# then I realized that they are graphed on top of each other. Total incentives is hidden behind
# commercial and industrial incentive bars.
# geom_col(aes(x = year, y = inc_ind_ratio, fill = "Industrial")) + # commented out to see what f irst layer looked like
# geom_col(aes(x = year, y = inc_com_ratio,fill = "Commercial")) + # commented out to see what f irst layer looked like
theme_classic() +
labs(x = "Year", y = "FMV Ratio", title = "Incentive FMV / All FMV in Cook County")
plot_df_final %>%
ggplot( ) +
# Switch order of layers to get all 3 bars to appear!
geom_col(aes(x = year, y = inc_ind_ratio, fill = "Industrial-Incentive")) +
# this was too small to show up in the graph because it was behind other layers
geom_col(aes(x = year , y = total_incent_ratio, fill = "Incentive Classes / Total FMV")) + # First I thought it wasn't working
geom_col(aes(x = year, y = inc_com_ratio, fill = "Commercial-Incentive")) +
theme_classic() +
labs(x = "Year", y = "FMV Ratio", title = "Industrial & Commercial \nFMV with Incentive Classification" )
plot_df_final %>%
ggplot(
) +
geom_col(aes(x = year, y = inc_ind_ratio,
fill = "Industrial"),
# position = position_dodge(width = 0.2), # width = .1
) +
geom_col(aes(x = year, y = inc_com_ratio,
fill = "Commercial"),
# position = position_dodge(width = 0.2), # width = .1
) +
#scale_fill_manual(values = c("Total" = "#fecc5c", "Industrial" = "#fd8d3c", "Commercial" = "#bd0026")) +
theme_classic() +
geom_line(aes(x = year , y = total_incent_ratio,
color = "Total Incentives"),# width = .1,
#position = position_dodge(width = 0.2)
) +
labs(x = "Year", y = "% of FMV")
plot_df_final %>%
ggplot() +
geom_col(aes(x = year - 0.15, y = total_incent_ratio, fill = "Total"), # width = .1,
position = position_dodge(width = 0.2)) +
geom_col(aes(x = year - 0.05, y = inc_ind_ratio, fill = "Industrial"),
position = position_dodge(width = 0.2),
# width = .1
) +
geom_col(aes(x = year + 0.05, y = inc_com_ratio, fill = "Commercial"),
position = position_dodge(width = 0.2), #width = .1
) +
geom_col(aes(x = year + 0.15, y = class_8_ratio, fill = "Class-8"),
position = position_dodge(width = 0.2),
# width = .1
) +
scale_fill_manual(values = c("Total" = "#fecc5c", "Industrial" = "#fd8d3c",
"Commercial" = "#bd0026", "Class-8" = "#000000")) +
theme_classic() +
labs(x = "Year", y = "Percent") +
theme(legend.position = "bottom") +
scale_y_continuous(labels = scales::percent_format(), limits = c(0, 0.45), breaks = seq(0, 0.45, by = 0.05)) +
scale_x_continuous(breaks = seq(2006, 2022, by = 3)) +
guides(fill = guide_legend(title = NULL))
### Switch order of columns to make them show up better. Total was behind other layer.
plot_df_final %>%
ggplot() +
geom_col(aes(x = year - 0.15, y = total_incent_ratio, fill = "Total"), # width = .1,
position = position_dodge(width = 0.2)) +
geom_col(aes(x = year - 0.05, y = inc_ind_ratio, fill = "Industrial"),
position = position_dodge(width = 0.2),
# width = .1
) +
geom_col(aes(x = year - 0.15, y = total_incent_ratio, fill = "Incentive FMV/Total FMV"), # width = .1,
position = position_dodge(width = 0.2)) +
geom_col(aes(x = year + 0.05, y = inc_com_ratio, fill = "Commercial"),
position = position_dodge(width = 0.2), #width = .1
) +
geom_col(aes(x = year + 0.15, y = class_8_ratio, fill = "Class-8"),
position = position_dodge(width = 0.2),
# width = .1
) +
scale_fill_manual(values = c("Incentive FMV/Total FMV" = "#fecc5c", "Industrial" = "#fd8d3c",
"Commercial" = "#bd0026", "Class-8" = "#000000")) +
theme_classic() +
labs(x = "Year", y = "Percent") +
theme(legend.position = "bottom",
legend.title = element_blank()) +
scale_y_continuous(labels = scales::percent_format(), limits = c(0, 0.45), breaks = seq(0, 0.45, by = 0.05)) +
scale_x_continuous(breaks = seq(2006, 2022, by = 3))
# Scatterplot
## Goal: scatterplot where change in tax rate from exemptions on x-axis and change from incentives on y-axis
## Dot size represents total tax rate change
## Another color dot will represent municipalities
## Generate data
rates <- read_csv("alt_rates.csv")
delta_rates <- rates %>%
select(clean_name, delta_exe = change_noExe, delta_inc = change_noInc, delta_both = change_neither) %>%
distinct() %>%
arrange(desc(delta_both)) %>%
mutate(top_both = ifelse(row_number() %in% 1:20, 1, 0)
) %>%
arrange(desc(delta_exe)) %>%
mutate(top_exe = ifelse(row_number() %in% 1:20, 1, 0)) %>%
arrange(desc(delta_inc)) %>%
mutate(top_inc = ifelse(row_number() %in% 1:20, 1, 0
)) %>%
mutate(key_obs = ifelse(top_exe == 1 & top_inc == 1, 1, 0)) %>%
mutate(key_obs = as.factor(key_obs))
## Create plot
delta_rates %>%
ggplot(aes(delta_exe, delta_inc)) +
geom_point(aes(size = delta_both, color = key_obs), alpha = .4) +
scale_size_continuous(guide = "none") +
scale_color_manual(guide = "none", values = c("blue", "gray9")) +
scale_x_continuous(expand = c(0,0), limits = c(0,16)) +
scale_y_continuous(expand = c(0,0), limits = c(0,18)) +
labs(
x = "Exemptions",
y = "Incentives",
caption = "Axes represent percentage point change in the composite tax rate from
removing either incentive classifications or the General Homeowner Exemption.
Removing incentive classification implies taxing all commercial and industrial
property at at 25% level of assessment instead of 10% if it receives an incentive classification."
) +
theme_classic()