-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincentive_report_appendices.qmd
1295 lines (995 loc) · 51 KB
/
incentive_report_appendices.qmd
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
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Supporting Content for Cook County C&I Report"
format:
html:
code-fold: true
toc: true
toc-location: left
tbl-cap-location: margin
fig-cap-location: margin
df-print: paged
---
# Data Preparation
```{r setup, warning = FALSE, output = FALSE}
library(tidyverse)
library(DT) # for interactive html tables on website
library(flextable) # best for exporting to word or PDF files.
library(sf) # for amazon maps
library(ptaxsim)
ptaxsim_db_conn <- DBI::dbConnect(RSQLite::SQLite(), "./ptaxsim.db/ptaxsim-2023.0.0.db")
knitr::opts_chunk$set(warning = FALSE, message = FALSE)
set_flextable_defaults(theme_fun = theme_vanilla,
padding = 2,
line_spacing = 1,
big.mark = ",",
)
options(DT.options = list())
FitFlextableToPage <- function(ft, pgwidth = 6){
ft_out <- ft %>% autofit()
ft_out <- width(ft_out, width = dim(ft_out)$widths*pgwidth /(flextable_dim(ft_out)$widths))
return(ft_out)
}
```
```{r}
# all pins for 2022
ptax_pins <- read_csv("Output/Dont_Upload/0_joined_PIN_data_2022.csv") %>%
mutate(class = as.numeric(class)) %>% # Allows for joining later
select(-c(propclass_1dig:av.y))
# Workaround for identifying more project IDs.
# Used Appeal ID to create unique identifier to group PINs.
bor <- read_csv("Output/borappeals.csv") %>%
mutate(project_appellant = paste(project_id, sep = "-", appellant))
# modelsummary::datasummary_skim(bor)
```
```{r}
# Cleaned PIN-Project list after cleaning the commercial valuatoin dataset found online.
# Another temporary work-around until we (maybe) have full keypin list:
proj_xwalk <- read_csv("Output/all_keypins.csv")
# all commercial valuation properties but made with not-quite-clean data from commercial valuation dataset on Cook County Data Portal (which was made from combining the Methodology worksheets)
# Values are also only the FIRST PASS assessments and do not include appeals or changes in values
# Join project IDs to PINs:
ptax_pins <- ptax_pins %>% left_join(proj_xwalk)
# create tc_muninames from helper file:
source("scripts/helper_tc_muninames_2022.R")
tc_muninames <- tc_muninames %>% select(-year)
# add muni names by joining tax code info:
ptax_pins <- ptax_pins %>%
mutate(tax_code_num = as.character(tax_code_num)) %>%
left_join(tc_muninames)
# original class_dict variables already in 0_joined data
# but I do want the new-ish variables I created to be brought in:
class_dict <- read_csv("./Necessary_Files/class_dict_expanded.csv") %>%
select(class_code, comparable_props, Alea_cat, incent_prop)
cross_county_lines <- c("030440000", "030585000", "030890000", "030320000", "031280000",
"030080000", "030560000", "031120000", "030280000", "030340000",
"030150000","030050000", "030180000","030500000", "031210000")
ptax_pins <- ptax_pins %>%
left_join(class_dict, by = c("class" = "class_code")) %>%
mutate(clean_name = ifelse(is.na(clean_name), "Unincorporated", clean_name)) %>%
filter(!agency_num %in% cross_county_lines)
# BOR data source shortfall: We only have the data if they appeal!
bor_pins <- bor %>%
group_by(pin) %>%
arrange(desc(tax_year)) %>%
summarize(pin = first(pin), # grabs first occurrence of unique PIN
class_bor = list(unique(class)),
appellant = first(appellant),
project_id = first(project_id),
timesappealed = n() ) %>%
mutate(proj_appellant = paste(project_id, "-", appellant))
ptax_pins <- ptax_pins %>% left_join(bor_pins, by = "pin")
# now do it the other way and compare
ptax_pins <- ptax_pins %>%
mutate( both_ids = project_id,
both_ids = ifelse(is.na(both_ids), keypin, both_ids),
both_ids = ifelse(is.na(both_ids) & between(class, 300, 899), pin, both_ids))
ptax_pins2 <- ptax_pins
```
# Map Amazon PINs
BOR Appeals data: Amazon Appeal Id's
3718744 - AMAZON.COM SERVICES LL & 1311866 - AMAZON.COM SERVICES LL
```{r}
amazon <- bor %>% filter(project_id == 3718744 | project_id == 1311866) %>%
filter(tax_year >=2022)
amazon_pins <- read_csv("./Output/comm_ind_PINs_2006to2022_timeseries.csv") %>%
mutate(class = as.numeric(class),
pin10 = str_sub(pin, 1, 10),
block7 = str_sub(pin, 1, 7)) %>%
filter(pin %in% amazon$pin) %>%
left_join(amazon, by = "pin")
amazon <- unique(substr(amazon_pins$pin, 1, 10))
geo_years <- c(2022)
amazon_geo <- lookup_pin10_geometry(year = geo_years, pin10 = amazon) %>%
st_as_sf(wkt = "geometry", crs = 4326) %>% select(-year)
library(ggspatial)
amazon_geo2 <- amazon_pins %>%
group_by(year, pin10) %>%
mutate(major_class_type = first(major_class_type)) %>%
filter(year %in% c(2006, 2015, 2021, 2022)) %>%
# filter(!block7 %in% c("2815117", "2817402" )) %>%
left_join(amazon_geo) %>%
select(pin10, year, major_class_type, major_class_code, majorclass, geometry) %>% ungroup()
```
```{r}
#| layout-ncol: 2
#colors <- scale_fill_manual(values = c("#FED789FF", "#023743FF", "#72874EFF", "#476F84FF", "#A4BED5FF", "#453947FF") )
#classes <- scale_shape_manual(values = c("0", "1", "2", "5A", "5B", "8") )
amazon_geo2 %>%
filter(year== 2006) %>%
ggplot() +
geom_sf(
data = amazon_geo$geometry,
aes(fill = amazon_geo2$major_class_code[amazon_geo2$year == 2006]),
alpha = 0.5,
linewidth = 0.1
) +
theme_void() +
theme(
legend.title = element_blank(), #element_text(size = 14),
legend.text = element_text(size = 10),
legend.key.size = unit(18, "points"),
legend.position = "bottom"
) + scale_fill_manual(values = c("0" = "#FED789FF", "1"= "#023743FF", "2" = "#72874EFF", "5A" = "#476F84FF", "5B" = "#A4BED5FF", "8" = "#453947FF"))
amazon_geo2 %>%
filter(year== 2015) %>%
ggplot() +
geom_sf(
data = amazon_geo$geometry,
aes(fill = amazon_geo2$major_class_code[amazon_geo2$year == 2015]),
alpha = 0.5,
linewidth = 0.1
) +
theme_void() +
theme(
legend.title = element_blank(), #element_text(size = 14),
legend.text = element_text(size = 10),
legend.key.size = unit(18, "points"),
legend.position = "bottom"
) + scale_fill_manual(values = c("0" = "#FED789FF", "1"= "#023743FF", "2" = "#72874EFF", "5A" = "#476F84FF", "5B" = "#A4BED5FF", "8" = "#453947FF"))
amazon_geo2 %>%
filter(year== 2021) %>%
ggplot() +
geom_sf(
data = amazon_geo$geometry,
aes(fill = amazon_geo2$major_class_code[amazon_geo2$year == 2021]),
alpha = 0.5,
linewidth = 0.1
) +
theme_void() +
theme(
legend.title = element_blank(), #element_text(size = 14),
legend.text = element_text(size = 10),
legend.key.size = unit(18, "points"),
legend.position = "bottom"
) + scale_fill_manual(values = c("0" = "#FED789FF", "1"= "#023743FF", "2" = "#72874EFF", "5A" = "#476F84FF", "5B" = "#A4BED5FF", "8" = "#453947FF"))
amazon_geo2 %>%
filter(year== 2022) %>%
ggplot() +
geom_sf(
data = amazon_geo$geometry,
aes(fill = amazon_geo2$major_class_code[amazon_geo2$year == 2022]),
alpha = 0.5,
linewidth = 0.1
) +
theme_void() +
theme(
legend.title = element_blank(), #element_text(size = 14),
legend.text = element_text(size = 10),
legend.key.size = unit(18, "points"),
legend.position = "bottom"
) + scale_fill_manual(values = c("0" = "#FED789FF", "1"= "#023743FF", "2" = "#72874EFF", "5A" = "#476F84FF", "5B" = "#A4BED5FF", "8" = "#453947FF"))
```
<!--- Don't use tax_amount_exe for calculations below because it is the "naive" calculation of the current tax rate * exempt eav discussed in the exemptions research. --->
```{r}
eq2022 <- 2.9237 #example of eq factor proliferation
incentive_majorclasses <- c("6", "7A", "7B", "8A", "8B")
commercial_classes <- c(401:435, 490, 491, 492, 496:499,
500:535,590, 591, 592, 597:599,
700:799,
800:835, 891, 892, 897, 899)
industrial_classes <- c(480:489,493,
550:589, 593,
600:699,
850:890, 893
)
ptax_pins <- ptax_pins %>%
mutate(class_1dig = str_sub(class, 1,1),
class_group = case_when(
(class_1dig == 5 & class %in% commercial_classes) ~ "5A",
(class_1dig == 5 & class %in% industrial_classes) ~ "5B",
class_1dig == 7 & class < 742 ~ "7A",
class_1dig == 7 & class >= 742 ~ "7B",
(class_1dig == 8 & class %in% commercial_classes ) ~ "8A",
(class_1dig == 8 & class %in% industrial_classes ) ~ "8B",
TRUE ~ as.character(class_1dig))) %>%
mutate(
# taxing district revenue = taxable eav * tax rate so rearrange the formula:
taxed_eav = final_tax_to_dist / tax_code_rate*100,
total_value_eav = (final_tax_to_dist + final_tax_to_tif)/ tax_code_rate * 100 + all_exemptions + abatements,
exempt_eav_inTIF = ifelse(in_tif == 1, all_exemptions, 0),
exempt_eav = all_exemptions + abatements,
taxed_av = taxed_eav / eq2022, # current value that taxing agencies can tax for their levies
## taxable AV = equalized assessed value net TIF increments, gross exemptions.
## Used for calculating untaxable value further below
# taxable_av = (final_tax_to_dist / tax_code_rate *100 + all_exemptions + abatements)/ eq2022,
# taxable_eav_fromincents = ifelse(class >=600 & class < 900, taxable_av * eq2022, 0),
## untaxable value = exempt EAV from abatements and exemptions + TIF increment
untaxable_value_eav = all_exemptions + abatements +
## TIF increment EAV above frozen EAV, which becomes TIF revenue
(final_tax_to_tif / tax_code_rate*100) +
## difference between 25% and reduced level of assessment for incentive class properties. Excludes TIF increment when calculating the difference!
ifelse(between(class, 600, 899),
(taxed_av/loa*0.25 - taxed_av)*eq2022, 0),
untaxable_incent_eav = ifelse(between(class, 600, 899),
(taxed_av/loa*0.25 - taxed_av)*eq2022, 0),
# manually adjust untaxable value of class 239 properties
untaxable_value_eav = ifelse(class == 239,
equalized_av-taxed_eav, untaxable_value_eav),
untaxable_value_av = untaxable_value_eav / eq2022,
untaxable_value_fmv = untaxable_value_av / loa,
exempt_fmv = exempt_eav / eq2022 / loa,
fmv_inTIF = ifelse(in_tif==1, av/loa, 0),
fmv_tif_increment = ifelse(final_tax_to_tif > 0,
((final_tax_to_tif / (tax_code_rate/100)) / eq2022 ) / loa, 0),
fmv_incents_inTIF = ifelse(between(class, 600, 899) & in_tif == 1,
fmv, 0),
fmv_incents_tif_increment = ifelse(between(class, 600, 899) & final_tax_to_tif > 0 ,
((final_tax_to_tif / (tax_code_rate/100)) / eq2022 ) / loa, 0),
naive_rev_forgone = untaxable_incent_eav * tax_code_rate/100) %>%
select(tax_code, class, pin, fmv,
untaxable_value_fmv, fmv_inTIF, fmv_tif_increment, fmv, total_billed, final_tax_to_dist, final_tax_to_tif, tax_code_rate, eav, equalized_av, av, everything())
ptax_pins2 <- ptax_pins
```
# Cook County Total Value
```{r}
#| label: tbl-cooktotals
#| tbl-cap: "**FMV of PINs in Cook County** Taxed FMV represents the property value that was actually taxed by local taxing jurisdictions(equal to the amount levied) but converted to FMV. We use the the portion of an individuals tax bill that does NOT go to a TIF to calculate the composite levy for taxing jursidictions."
cook_sums <- read_csv("./Output/ptaxsim_cook_level_2006to2023.csv")
cook_sums %>%
select(Year = year, cty_PC, cty_fmv, cty_fmv_taxed, cty_pct_fmv_taxed) %>%
mutate(cty_pct_fmv_untaxable = scales::percent(1 - cty_pct_fmv_taxed, accuracy = 0.01),
Year = as.character(Year)) %>%
flextable() %>%
align(align = "right") %>%
set_header_labels(cty_PC = 'PINs', cty_projects = "Project IDs",
cty_fmv = 'Total FMV',
cty_fmv_taxed = 'Taxed FMV',
cty_pct_fmv_untaxable = 'Cty Value\nnot Taxed (%)',
cty_pct_fmv_taxed = 'Cty FMV Value\nTaxed (%)'
) %>% FitFlextableToPage()
```
```{r}
#| label: tbl-cooktotals-incentives
#| tbl-cap: "**Fair market value of Incentive PINs in Cook County that is not taxed** Over $20 billion FMV has an incentive classification, but because of the reduced level of assessment (25% to 10%), only 8% billion of it is taxable."
cook_sums %>%
mutate(Year = as.character(year),
cty_pct_fmv_untaxable = scales::percent(cty_pct_fmv_untaxable, accuracy = 0.01)) %>%
select(Year,
cty_fmv_untaxable_value, cty_fmv, cty_pct_fmv_untaxable#, cty_pct_fmv_taxed
) %>%
flextable() %>%
align(align = "right") %>%
set_header_labels(#cty_PC = 'PINs',
#cty_projects = "Project IDs",
cty_fmv = 'Total FMV',
cty_fmv_taxed = 'Total Taxed FMV',
cty_fmv_untaxable_value = 'FMV not Taxed\ Because of\nIncentives',
cty_pct_fmv_untaxable = 'Cty Value not Taxed\n(%) Because of\nIncentives'
# cty_pct_fmv_taxed = 'Cty FMV Value\nTaxed (%)'
) %>% FitFlextableToPage()
```
```{r eval=FALSE}
table_cook <- ptax_pins %>%
summarize(
cty_PC = n(),
cty_PC_industrial = sum(ifelse(class %in% industrial_classes, 1, 0), na.rm = TRUE),
cty_PC_commercial = sum(ifelse(class %in% commercial_classes, 1, 0), na.rm = TRUE),
cty_PC_com_incent = sum(ifelse(class %in% commercial_classes & incent_prop == "Incentive", 1, 0), na.rm = TRUE),
cty_PC_com_incent_inTIF = sum(ifelse(class %in% commercial_classes & incent_prop == "Incentive" & in_tif == 1, 1, 0), na.rm = TRUE),
cty_PC_ind_incent = sum(ifelse(class %in% industrial_classes & incent_prop == "Incentive", 1, 0), na.rm = TRUE),
cty_PC_ind_incent_inTIF = sum(ifelse(class %in% industrial_classes & incent_prop == "Incentive" & in_tif == 1, 1, 0), na.rm = TRUE),
cty_PC_incent = sum(ifelse(incent_prop == "Incentive", 1, 0)),
cty_PC_comandind = sum(ifelse((class %in% commercial_classes | class %in% industrial_classes), 1, 0)),
cty_PC_comandind_inTIF = sum(ifelse((class %in% commercial_classes | class %in% industrial_classes) & in_tif == 1, 1, 0)),
cty_PC_incent_inTIF = sum(ifelse(between(class, 600, 900) & in_tif == 1, 1, 0)),
cty_projects = n_distinct(both_ids), # mostly for industrial and commercial properties. Purposely not assigning keypins to residential properties.
cty_fmv_incentive = sum(ifelse(between(class, 600, 900), fmv, 0), na.rm = TRUE),
cty_fmv_incent_inTIF = sum(ifelse(between(class, 600, 900) & in_tif == 1, fmv, 0), na.rm = TRUE),
cty_fmv_inTIF = sum(fmv_inTIF, na.rm=TRUE),
cty_fmv_incents_tif_increment = sum(fmv_incents_tif_increment, na.rm=TRUE),
cty_fmv_tif_increment = sum(fmv_tif_increment, na.rm=TRUE),
cty_fmv_untaxable_value = sum(untaxable_value_fmv , na.rm=TRUE),
cty_fmv = sum(fmv, na.rm=TRUE),
cty_fmv_exemptions = sum(all_exemptions/eq2022/loa, na.rm=TRUE),
cty_fmv_abatements = sum((abatements/eq2022)/loa, na.rm=TRUE),
cty_fmv_residential = sum(ifelse(class %in% c(200:399), fmv, 0), na.rm = TRUE),
cty_fmv_industrial = sum(ifelse(class %in% industrial_classes, fmv, 0), na.rm = TRUE),
cty_fmv_indwithincent = sum(ifelse(class %in% industrial_classes & incent_prop == "Incentive", fmv, 0), na.rm = TRUE),
cty_fmv_ind_incent_inTIF= sum(ifelse(class %in% industrial_classes & incent_prop == "Incentive" & in_tif == 1, fmv, 0), na.rm = TRUE),
cty_fmv_commercial = sum(ifelse(class %in% commercial_classes, fmv, 0), na.rm = TRUE),
cty_fmv_comwithincent = sum(ifelse(class %in% commercial_classes & incent_prop == "Incentive", fmv, 0), na.rm = TRUE),
cty_fmv_com_incent_inTIF= sum(ifelse(class %in% commercial_classes & incent_prop == "Incentive" & in_tif == 1, fmv, 0), na.rm = TRUE),
cty_fmv_comandind = sum(ifelse(class %in% c(commercial_classes, industrial_classes) , fmv, 0), na.rm = TRUE),
cty_levy = sum(final_tax_to_dist),
cty_current_rate_avg = mean(tax_code_rate),
cty_avg_C2_bill_noexe = mean(ifelse(between(class,200,299) & all_exemptions == 0, (final_tax_to_dist+ final_tax_to_tif), NA), na.rm=TRUE),
cty_avg_C2_bill_withexe = mean(ifelse(between(class,200,299) & all_exemptions > 0, (final_tax_to_dist+ final_tax_to_tif), NA), na.rm=TRUE),
cty_av_taxed = sum(taxed_av, na.rm = TRUE),
cty_untaxable_value_av = sum(untaxable_value_av, na.rm=TRUE),
cty_av = sum(av),
cty_zero_bill = sum(zero_bill, na.rm=TRUE),
) %>%
mutate(
cty_taxable_value_fmv = cty_fmv - cty_fmv_untaxable_value,
cty_pct_fmv_untaxable = cty_fmv_untaxable_value / cty_fmv,
# cty_pct_fmv_taxed = cty_fmv_taxed / cty_fmv,
cty_pct_fmv_incentinTIF = cty_fmv_incent_inTIF / cty_fmv_incentive,
cty_pct_fmv_incents_tif_increment = cty_fmv_incents_tif_increment / cty_fmv_incentive,
cty_pct_av_taxed = cty_av_taxed / cty_av,
cty_pct_av_untaxable = cty_untaxable_value_av/cty_av,
cty_pct_incent_oftotalPC = cty_PC_incent / cty_PC, # incentive pins / all PINs
cty_pct_incent_ofcomPC = cty_PC_com_incent / cty_PC_commercial, # incentive pins / commercial PINs
cty_pct_incent_ofindPC = cty_PC_ind_incent / cty_PC_industrial, # incentive pins / commercial PINs
cty_pct_PC_incent_inTIF = cty_PC_incent_inTIF / cty_PC_incent # count of incentive classes in TIFs / count of incentive Class PINs
) %>% mutate(cty_pct_fmv_both_incent = cty_fmv_comwithincent / cty_fmv_comandind,
cty_pct_PC_both_incent = cty_PC_incent / cty_PC_comandind,
cty_pct_PC_both_incent_inTIF = cty_PC_incent_inTIF / cty_PC_incent,
cty_pct_fmv_both_incent_inTIF = cty_fmv_incent_inTIF / cty_fmv_incentive,
)
table_cook %>%
select(cty_PC, cty_fmv_untaxable_value, cty_fmv, cty_pct_fmv_untaxable) %>%
mutate(cty_pct_fmv_untaxable = scales::percent(cty_pct_fmv_untaxable, accuracy = 0.01)) %>%
flextable() %>%
align(align = "right") %>%
set_header_labels(cty_PC = 'PINs', cty_projects = "Project IDs",
cty_fmv = 'Total FMV',
cty_fmv_taxed = 'Taxed FMV', cty_fmv_untaxable_value = 'FMV not Taxed\nfor Levy',
cty_pct_fmv_untaxable = 'Value not Taxed (%)'
) %>% FitFlextableToPage()
```
```{r add-variable-labels, eval=FALSE, include =FALSE}
library(labelled)
table_cook <- table_cook %>%
set_variable_labels(
cty_PC = 'PINs',
cty_projects = "Project IDs",
cty_fmv = 'Total FMV',
cty_fmv_taxed = 'Taxed FMV', cty_fmv_untaxable_value = 'FMV not Taxed\nfor Levy',
cty_pct_fmv_untaxable = 'Value not Taxed (%)',
cty_fmv_comandind = 'Com. & Ind. FMV',
# cty_fmv = 'Total FMV in Cook',
cty_pct_fmv_both_incent = '% of Com. & Ind. FMV w/ Incent.',
cty_pct_fmv_incentinTIF = '% of Com. & Ind. FMV w/ Incent. in TIF',
cty_pct_fmv_incents_tif_increment = '% of Com. & Ind. FMV in TIF Increment',
cty_PC_comandind = 'PIN Count',
cty_PC_incent_inTIF = "Incent. PINs in TIF",
cty_pct_PC_both_incent = '% of Com. & Ind. PINs w/ Incent.',
cty_pct_PC_both_incent_inTIF = '% of Incent. PINs in TIF'
)
```
# Municipality Level Stats
*Ignore stats for these Municipalities. Simple rounding errors may cause bizarre results for rate changes & other calculations. These municipalities are dropped from summary tables in this website but are included in exported files.*
- Frankfort has 1 PIN in Cook County
- East Dundee has 2
- Homer Glen has 3
- University Park has 4
- Oak Brook, Deer Park, Deerfield, & Bensenville each have less than 75 PINs in Cook County, IL
```{r}
# created in ptax_pull_loop_cty_muni_MC_summaries.R script.
muni_sums <- read_csv("./Output/ptaxsim_muni_level_2006to2023.csv")
```
```{r eval = FALSE}
munilevel <- ptax_pins %>%
group_by(clean_name) %>%
filter(clean_name != "Unincorporated") %>%
summarize(
muni_exempt_PC = sum(ifelse(class == 0 | class == "EX" | class == "RR", 1, 0), na.rm=TRUE),
muni_PC_total = n(),
muni_PC_residential = sum(ifelse(class %in% c(200:399), 1, 0), na.rm = TRUE),
muni_PC_industrial = sum(ifelse(class %in% industrial_classes, 1, 0), na.rm = TRUE),
muni_PC_commercial = sum(ifelse(class %in% commercial_classes, 1, 0), na.rm = TRUE),
muni_PC_inTIF = sum(in_tif),
muni_PC_withincents = sum(ifelse(between(class, 600, 900), 1, 0), na.rm = TRUE),
muni_PC_incents_inTIFs = sum(ifelse(between(class, 600, 900) & in_tif == 1, 1, 0), na.rm = TRUE),
muni_PC_claimed_exe = sum(ifelse(all_exemptions > 0, 1, 0)),
# Projects primarily apply to commercial and industrial property.
muni_projects = n_distinct(both_ids),
muni_fmv_incentive = sum(ifelse(class >=600 & class <=900, fmv, 0), na.rm = TRUE),
muni_fmv_commerc_incentive = sum(ifelse(class >=600 & class <=900 & class %in% commercial_classes, fmv, 0), na.rm = TRUE),
muni_fmv_indust_incentive = sum(ifelse(class >=600 & class <=900 & class %in% industrial_classes, fmv, 0), na.rm = TRUE),
# muni_fmv_taxed = sum(taxed_fmv, na.rm=TRUE),
muni_fmv_inTIF = sum(fmv_inTIF, na.rm=TRUE),
muni_fmv_exempt = sum(all_exemptions/eq2022/loa, na.rm=TRUE),
muni_fmv_abated = sum(abatements/eq2022/loa, na.rm = TRUE),
muni_fmv_tif_increment = sum(fmv_tif_increment, na.rm=TRUE),
muni_fmv_abates_inTIF = sum(ifelse(between(class, 600, 900) & in_tif == 1 & abatements >0 , fmv, 0), na.rm = TRUE),
muni_fmv_incents_inTIF = sum(ifelse(between(class, 600, 900) & in_tif == 1, fmv, 0), na.rm = TRUE),
muni_fmv_untaxable_value = sum(untaxable_value_fmv , na.rm=TRUE),
muni_fmv = sum(fmv, na.rm=TRUE),
muni_fmv_residential = sum(ifelse(class %in% c(200:399), fmv, 0), na.rm = TRUE),
muni_fmv_industrial = sum(ifelse(class %in% industrial_classes, fmv, 0), na.rm = TRUE),
muni_fmv_commercial = sum(ifelse(class %in% commercial_classes, fmv, 0), na.rm = TRUE),
muni_zero_bill = sum(zero_bill, na.rm=TRUE),
muni_levy = sum(final_tax_to_dist),
muni_current_rate_avg = mean(tax_code_rate),
muni_eav_taxed = sum(taxed_av*eq2022),
muni_min_TC_rate = min(tax_code_rate),
muni_max_TC_rate = max(tax_code_rate),
muni_avg_C2_bill_noexe = mean(ifelse(between(class,200,299) & all_exemptions == 0, (final_tax_to_dist + final_tax_to_tif), NA), na.rm=TRUE),
muni_avg_C2_bill_withexe = mean(ifelse(between(class,200,299) & all_exemptions > 0, (final_tax_to_dist+ final_tax_to_tif), NA), na.rm=TRUE),
muni_eav = sum(eav)) %>%
mutate(
muni_range_TC_rate = muni_max_TC_rate - muni_min_TC_rate,
muni_effective_rate = muni_levy / muni_fmv * 100,
muni_pct_eav_taxed = muni_levy / muni_eav_taxed,
# pct_fmv_taxed = muni_fmv_taxed / muni_fmv,
pct_fmv_w_incentclass = muni_fmv_incentive / muni_fmv,
pct_fmv_indust_incent = muni_fmv_indust_incentive / muni_fmv_industrial,
pct_fmv_commerc_incent = muni_fmv_commerc_incentive / muni_fmv_commercial,
pct_fmv_inTIF = muni_fmv_inTIF / muni_fmv,
pct_fmv_in_tif_increment = muni_fmv_tif_increment / muni_fmv,
pct_fmv_untaxable_value = muni_fmv_untaxable_value / muni_fmv,
pct_fmv_incents_inTIFs = muni_fmv_incents_inTIF / muni_fmv ) %>%
mutate(across(starts_with("muni_fmv_"), round, digits = 0)) %>%
mutate(across(contains(c("rate", "pct","bill")), round, digits = 3) ) %>%
ungroup() %>%
select(clean_name, everything())
```
## Intensity of Incentive Class Use
```{r}
#| label: tbl-top10incentive-munis
#| tbl-cap: "Top 10 Municipalities using Incentives in 2022"
muni_sums %>% select(year, clean_name, muni_PC_total, muni_PC_withincents, muni_fmv_incentive, muni_fmv) %>%
filter(year == 2022 ) %>%
arrange(desc(muni_fmv_incentive)) %>%
head(10) %>%
flextable() %>%
set_header_labels(clean_name = "Municipality", muni_PC_withincents = '# of Incent. PINs',
muni_fmv_incentive = "FMV from Incentive\nClass Properties"
) %>%
set_table_properties( layout = "autofit", width = .75)
```
### Share of Muni Industrial and Commercial FMV with incentive class
```{r}
table_muni_percentages <- muni_sums %>%
filter(!clean_name %in% c("Frankfort", "Homer Glen", "Oak Brook", "East Dundee", "University Park", "Bensenville", "Hinsdale", "Roselle", "Deer Park", "Deerfield"))
```
```{r delete, eval = FALSE}
no_incentives <- ptax_pins %>%
# filter(between(class, 600, 899)) %>%
group_by(clean_name) %>%
summarize(incent_pins = sum(ifelse(between(class, 600, 899), 1, 0))) %>%
filter(incent_pins == 0) %>%
distinct(clean_name)
# unincorp_areas <- muni_shp %>% filter(!MUNICIPALITY %in% munilevel$clean_name)
#anti_join(munilevel, muni_shp, by = c("clean_name" = "MUNICIPALITY"))
# unincorp_areas2 <- muni_shp %>% filter(!MUNICIPALITY %in% munilevel$shpfile_name)
```
# Shifted Tax Revenue and Tax Burden
```{r}
ccao_loa <- read_csv("./inputs/ccao_loa.csv") %>%
filter(year== 2022) %>%
select(-year)
muni_sums <- read_csv("./Output/ptaxsim_muni_level_2006to2023.csv")
muni_rate <- muni_sums %>%
filter(year == 2022) %>%
left_join(nicknames) %>%
select(clean_name, muni_current_rate_avg, muni_pct_eav_taxed,# cur_comp_muni_rate
) %>%
rename(cur_munilevel_rate = muni_current_rate_avg)
muni_rate %>% DT::datatable( rownames = FALSE)
```
## Not Taxed FMV - PIN aggregated to County Level
```{r calculate-cook-altrates-fromPINlevel}
cook_ratechange <- ptax_pins %>%
# left_join(muni_rate) %>%
filter(!clean_name %in% c("Frankfort", "Homer Glen", "Oak Brook", "East Dundee", "University Park", "Bensenville", "Hinsdale", "Roselle", "Deer Park", "Deerfield")) %>%
filter(!agency_num %in% cross_county_lines) %>%
#group_by(class_group) %>%
summarize(
mostnaive_forgone_tax_amt_exe = sum(tax_amt_exe),
## New Tax Base Calculations
new_TEAV_noIncents = sum(ifelse(class >= 600 & class < 900,
(taxed_av*eq2022/loa)*0.25, taxed_av*eq2022), na.rm=TRUE),
## NewTax Base Calculations
new_TEAV_noCommercIncents = sum(ifelse(class >= 600 & class < 900 & class %in% commercial_classes,
(taxed_av*eq2022/loa)*0.25, taxed_av*eq2022), na.rm=TRUE),
new_TEAV_noIndustIncents = sum(ifelse(class >= 600 & class < 900 & class %in% industrial_classes,
(taxed_av*eq2022/loa)*0.25, taxed_av*eq2022), na.rm=TRUE),
new_TEAV_noC6 = sum(ifelse( class >=600 & class < 700,
(taxed_av*eq2022/loa)*0.25 , taxed_av*eq2022), na.rm=TRUE),
new_TEAV_noC7 = sum(ifelse(class >=700 & class < 800,
(taxed_av*eq2022/loa)*0.25, taxed_av*eq2022), na.rm=TRUE),
new_TEAV_noC8 = sum(ifelse(class >=800 & class < 900, (taxed_av*eq2022/loa)*0.25, taxed_av*eq2022), na.rm=TRUE),
new_TEAV_vacant_props = sum(ifelse(class >=600 & class <900, # if incentive classes were assessed at 0% (aka not taxedat all) or if the building lost its value completely without the incentive classification.
0, taxed_av*eq2022), na.rm=TRUE),
new_TEAV_noExemps = sum(taxed_av*eq2022 + all_exemptions, na.rm=TRUE), # does not include abatements
new_TEAV_noAbates = sum(taxed_av*eq2022 + abatements, na.rm=TRUE), # include only abatements, not other exemption types
# TIF increment above the frozen EAV
forgone_TIF_EAV = sum(fmv_tif_increment * loa * eq2022, na.rm=TRUE),
cty_PC = n(),
# projects = n_distinct(both_ids), # mostly for industrial and commercial properties
pins_withincents = sum(ifelse(class >= 600 & class < 900, 1, 0)),
fmv_incentive = sum(ifelse(class >=600 & class <900, fmv, 0), na.rm = TRUE),
#fmv_taxed = sum(taxed_fmv, na.rm=TRUE),
fmv_incents_inTIFs = sum(ifelse(class >=600 & class <900 & final_tax_to_tif > 0, fmv, 0), na.rm = TRUE),
fmv_inTIF = sum(fmv_inTIF, na.rm=TRUE),
fmv_tif_increment = sum(fmv_tif_increment, na.rm=TRUE),
fmv_untaxable_value = sum(untaxable_value_fmv , na.rm=TRUE),
fmv_exemptions = sum(all_exemptions/eq2022/loa, na.rm=TRUE),
fmv_abatements = sum(exe_abate/eq2022/loa, na.rm=TRUE),
zero_bill = sum(zero_bill, na.rm=TRUE),
fmv_residential = sum(ifelse(class %in% c(200:399), fmv, 0), na.rm = TRUE),
fmv_C2 = sum(ifelse(class %in% c(200:299), fmv, 0), na.rm = TRUE),
fmv_industrial = sum(ifelse(class %in% industrial_classes, fmv, 0), na.rm = TRUE),
fmv_commercial = sum(ifelse(class %in% commercial_classes, fmv, 0), na.rm = TRUE),
current_rate_avg = mean(tax_code_rate),
avg_C2_bill_noexe = mean(ifelse(between(class,200,299) & all_exemptions == 0, (final_tax_to_dist + final_tax_to_tif), NA), na.rm=TRUE),
avg_C2_bill_withexe = mean(ifelse(between(class,200,299) & all_exemptions > 0, (final_tax_to_dist + final_tax_to_tif), NA), na.rm=TRUE),
av_taxed = sum(taxed_av, na.rm = TRUE),
untaxable_value_av = sum(untaxable_value_av, na.rm=TRUE),
av = sum(av),
eav_taxed = sum(taxed_av*eq2022),
eav_untaxable = sum(untaxable_value_eav, na.rm=TRUE),
eav_max = sum(fmv*loa*eq2022, na.rm=TRUE),
fmv = sum(fmv, na.rm=TRUE),
pins_in_class = n(),
all_exemptions = sum(all_exemptions), # in EAV
abatements = sum(exe_abate), # in EAV
eav_incents_inTIFs = sum(ifelse(class >=600 & class <=900 & in_tif == 1, eav, 0), na.rm = TRUE),
final_tax_to_dist = sum(final_tax_to_dist), ## Amount of Total Levy
final_tax_to_tif = sum(final_tax_to_tif),
eav = sum(eav)) %>%
mutate(
reducedEAV_comind_incents = new_TEAV_noIncents - eav_taxed,
reducedEAV_commerc_incents = new_TEAV_noCommercIncents - eav_taxed,
reducedEAV_indust_incents = new_TEAV_noIndustIncents - eav_taxed,
# Absolute maximum TEAV: No Exemptions, no abatements, no TIFS, no Incentive properties
# Commercial and industrial assessed at 25%
TEAV_max = eav_taxed + all_exemptions + abatements + forgone_TIF_EAV + reducedEAV_comind_incents,
# no exemptions or incentive classifications:
TEAV_neither = eav_taxed + all_exemptions + reducedEAV_comind_incents,
rate_noExe = final_tax_to_dist / new_TEAV_noExemps * 100,
rate_noCommercInc = final_tax_to_dist / new_TEAV_noCommercIncents * 100,
rate_noIndustInc = final_tax_to_dist / new_TEAV_noIndustIncents * 100,
rate_noAbate = final_tax_to_dist / new_TEAV_noAbates * 100,
rate_noInc = final_tax_to_dist / new_TEAV_noIncents * 100,
rate_neither = final_tax_to_dist / TEAV_neither * 100,
rate_noTIFs = final_tax_to_dist / (eav_taxed + forgone_TIF_EAV) * 100,
rate_vacant = final_tax_to_dist / new_TEAV_vacant_props* 100,
rate_lowest = final_tax_to_dist / TEAV_max * 100,
rate_current = final_tax_to_dist / eav_taxed * 100,
change_noInc = rate_current - rate_noInc,
forgonerev_noExe = rate_noExe/100 * all_exemptions,
forgonerev_noAbate = rate_noAbate/100 * (new_TEAV_noAbates - eav_taxed),
forgonerev_noIncents = rate_noInc/100 * (new_TEAV_noIncents - eav_taxed),
forgonerev_noCommercIncents = rate_noInc/100 * (new_TEAV_noCommercIncents - eav_taxed),
forgonerev_noIndustIncents = rate_noInc/100 * (new_TEAV_noIndustIncents - eav_taxed),
forgone_noExe_or_Inc = rate_neither/100 * (TEAV_neither - eav_taxed),
forgonerev_noTIFs = rate_noTIFs/100 * forgone_TIF_EAV,
forgonerev_vacant = rate_vacant/100 * (new_TEAV_vacant_props - eav_taxed),
forgonerev_maxTEAV = rate_lowest/100 * (TEAV_max - eav_taxed)
)
cook_ratechange %>%
select(rate_current, rate_noInc, change_noInc)
cook_ratechange %>%
select(reducedEAV_commerc_incents, reducedEAV_indust_incents, reducedEAV_comind_incents, all_exemptions)
```
# Slide 8 Tax Rate Calculations
```{r}
#muni_sums
#muni_cl_sums <- read_csv("./Output/ptaxsim_muni_class_summaries_2006to2023.csv")
# muni_rate_change <- muni_cl_sums |>
muni_ratechange <- ptax_pins %>%
# left_join(muni_rate) %>%
filter(!clean_name %in% c("Frankfort", "Homer Glen", "Oak Brook", "East Dundee", "University Park", "Bensenville", "Hinsdale", "Roselle", "Deer Park", "Deerfield")) %>%
filter(!agency_num %in% cross_county_lines) %>%
group_by(clean_name) %>%
summarize(
classgroup_PC = n(),
# projects = n_distinct(both_ids), # mostly for industrial and commercial properties
pins_withincents = sum(ifelse(class >= 600 & class < 900, 1,0)),
fmv_incentive = sum(ifelse(class >=600 & class <900, fmv, 0), na.rm = TRUE),
#fmv_taxed = sum(taxed_fmv, na.rm=TRUE),
fmv_incents_inTIFs = sum(ifelse(class >=600 & class <900 & final_tax_to_tif > 0, fmv, 0), na.rm = TRUE),
fmv_inTIF = sum(ifelse(final_tax_to_tif > 0, fmv, 0), na.rm=TRUE),
fmv_tif_increment = sum(fmv_tif_increment, na.rm=TRUE),
fmv_untaxable_value = sum(untaxable_value_fmv , na.rm=TRUE),
fmv_exemptions = sum(all_exemptions/eq2022/loa, na.rm=TRUE),
fmv_abatements = sum(exe_abate/eq2022/loa, na.rm=TRUE),
zero_bill = sum(zero_bill, na.rm=TRUE),
fmv_residential = sum(ifelse(class %in% c(200:399), fmv, 0), na.rm = TRUE),
fmv_C2 = sum(ifelse(class %in% c(200:299), fmv, 0), na.rm = TRUE),
fmv_industrial = sum(ifelse(class %in% industrial_classes, fmv, 0), na.rm = TRUE),
fmv_commercial = sum(ifelse(class %in% commercial_classes, fmv, 0), na.rm = TRUE),
current_rate_avg = mean(tax_code_rate),
avg_C2_bill_noexe = mean(ifelse(between(class,200,299) & all_exemptions == 0, (final_tax_to_dist + final_tax_to_tif), NA), na.rm=TRUE),
avg_C2_bill_withexe = mean(ifelse(between(class,200,299) & all_exemptions > 0, (final_tax_to_dist + final_tax_to_tif), NA), na.rm=TRUE),
av_taxed = sum(taxed_av, na.rm = TRUE),
untaxable_value_av = sum(untaxable_value_av, na.rm=TRUE),
av = sum(av),
eav_taxed = sum(taxed_av*eq2022),
eav_untaxable = sum(untaxable_value_eav, na.rm=TRUE),
eav_tif_increment = sum(final_tax_to_tif/tax_code_rate, na.rm=TRUE),
eav_max = sum(fmv*loa*eq2022, na.rm=TRUE),
fmv = sum(fmv, na.rm=TRUE),
pins_in_class = n(),
all_exemptions = sum(all_exemptions), # in EAV
abatements = sum(exe_abate), # in EAV
eav_incents_inTIFs = sum(ifelse(class >=600 & class <=900 & in_tif == 1, eav, 0), na.rm = TRUE),
final_tax_to_dist = sum(final_tax_to_dist),
final_tax_to_tif = sum(final_tax_to_tif),
eav = sum(eav),
new_TEAV_noIncents = sum(ifelse(class >=600 & class <900,
(taxed_av*eq2022/loa)*0.25, taxed_av*eq2022), na.rm=TRUE),
new_TEAV_noC6 = sum(ifelse( class >=600 & class <700,
(taxed_av*eq2022/loa)*0.25 , taxed_av*eq2022)),
new_TEAV_noC7 = sum(ifelse(class >=700 & class <800,
(taxed_av*eq2022/loa)*0.25, taxed_av*eq2022)),
new_TEAV_noC8 = sum(ifelse(class >=800 & class <900, (taxed_av*eq2022/loa)*0.25, taxed_av*eq2022)),
new_TEAV_vacant_noIncents = sum(ifelse(class >=600 & class <900,
0, taxed_av*eq2022))) %>%
mutate(
new_TEAV_noExemps = eav_taxed + all_exemptions, # does not include abatements
new_TEAV_noAbates = eav_taxed + abatements, # include only abatements, not other exemption types
# amount of EAV from taxing an additional 15% of the AV if incentive properties didn't exist
forgone_EAV_incent = #class_group %in% incentive_majorclasses,
#incent_prop == "Incentive",
new_TEAV_noIncents - eav_taxed) %>%
#cbind(table_cook) %>%
mutate(
# Absolute maximum TEAV: No Exemptions, no abatements, no TIFS, no Incentive properties
# Commercial and industrial assessed at 25%
TEAV_max = eav_taxed + all_exemptions + abatements + eav_tif_increment + forgone_EAV_incent,
# no exemptions or incentive classifications:
TEAV_neither = eav_taxed + all_exemptions + forgone_EAV_incent,
rate_noExe = final_tax_to_dist / new_TEAV_noExemps * 100,
rate_noAbate = final_tax_to_dist / new_TEAV_noAbates * 100,
rate_noInc = final_tax_to_dist / new_TEAV_noIncents * 100,
rate_neither = final_tax_to_dist / TEAV_neither * 100,
rate_noTIFs = final_tax_to_dist / (eav_taxed + eav_tif_increment) * 100,
rate_vacant = final_tax_to_dist / new_TEAV_vacant_noIncents* 100,
rate_lowest = final_tax_to_dist / TEAV_max * 100,
# rate_noC6 = levy / new_TEAV_noC6 * 100,
# rate_noC7 = levy / TEAV_noC7 * 100,
# rate_noC8 = levy / TEAV_noC8 * 100,
rate_current = final_tax_to_dist / eav_taxed * 100,
change_noInc = rate_current - rate_noInc,
change_neither = rate_current - rate_neither,
change_noTIF = rate_current - rate_noTIFs,
change_noExe = rate_current - rate_noExe,
change_vacant = rate_current - rate_vacant,
change_lowest = rate_current - rate_lowest
) %>%
mutate(across(contains("rate_"), round, digits = 2)) %>%
mutate(across(contains("change_"), round, digits = 2))
muni_ratechange %>% select(clean_name, starts_with("change_")) %>% DT::datatable(rownames = FALSE)
```
# Unbalanced Panel Data: 2006 to 2022 Growth
```{r uses-comind-file}
#ptax_pins <- read_csv("./Output/comm_ind_inmunis_timeseries_2006to2022.csv") %>%
year_count <- 17
ptax_pins <- read_csv("./Output/comm_ind_PINs_2006to2022_timeseries.csv") %>%
mutate(class = as.numeric(class)) %>%
group_by(pin) %>%
arrange(year) %>%
mutate(incent = ifelse(class >= 600 & class <= 899, 1, 0)) %>%
mutate(
gain_incent = ifelse(incent == 1 & lag(incent)==0, 1, 0),
lose_incent = ifelse(incent == 0 & lag(incent)== 1, 1,0),
never_incent = sum(incent) == 0, 1, 0,
always_incent = sum(incent)== year_count, 1, 0
) %>% ungroup()
ptax_pins %>% ungroup() %>%
group_by(year) %>%
summarize("Gains Incent" = sum(gain_incent, na.rm=TRUE),
"Loses Incent" = sum(lose_incent, na.rm=TRUE),
"Always Incent" = sum(always_incent, na.rm=TRUE),
"Never Incent" = sum(never_incent, na.rm=TRUE))
table(ptax_pins$incent_change)
table(ptax_pins$incentive_years)
table(ptax_pins$landuse_change)
ptax_pins %>% distinct(clean_name) %>% arrange(clean_name)
```
```{r}
ptax_pins %>% ungroup() %>% filter(year == 2022) %>% reframe(count = n(), .by = landuse_change)
ptax_pins %>% ungroup %>%
filter(year == 2022) %>% reframe(count = n(), .by = incent_change)
table(ptax_pins$land_use)
```
```{r}
#| label: fig-FMVgraphs
#| fig-cap: ""
ptax_pins %>% ungroup() %>%
group_by(year, incent_change) %>%
summarize(fmv = sum(fmv),
av = sum(av_clerk)) %>%
ggplot() +
geom_line(aes(x=year, y=fmv, color = incent_change))+
theme_classic() +
labs(title = "FMV Over Time",
subtitle = "Includes all years of observations for PINs that had an Incentive Class for at least 1 year", caption = "Uses com_ind_PINS... file.") + scale_y_continuous(labels = scales::dollar)
ptax_pins %>%
group_by(year, landuse_change) %>%
summarize(fmv = sum(fmv),
av = sum(av_clerk)) %>%
ggplot() +
geom_line(aes(x=year, y=fmv, color = landuse_change))+
theme_classic() +
labs(title = "FMV Over Time",
subtitle = "Includes all years of observations for PINs that had an Incentive Class for at least 1 year", caption = "Uses com_ind_PINS... file.") + scale_y_continuous(labels = scales::dollar)
ptax_pins %>%
group_by(year) %>%
summarize(fmv = sum(fmv),
av = sum(av_clerk)) %>%
ggplot() +
geom_line(aes(x=year, y=fmv#, color = Alea_cat
))+
geom_line(aes(x=year, y=av), color = "red") +
theme_classic() +
labs(title = "FMV Over Time",
subtitle = "Includes all years of obsservations for PINs that had an Incentive Class for at least 1 year", caption = "Uses com_ind_PINS... file. Red line is AV")
ptax_pins %>%
group_by(year, land_use) %>%
summarize(fmv = sum(fmv),
av = sum(av_clerk)) %>%
ggplot() +
geom_line(aes(x=year, y=fmv, color = land_use))+
theme_classic() +
labs(title = "FMV Over Time by Land Use", subtitle = "Uses com_ind_PINS... file.")
## Fixed NAs in incent_props
# ptax_pins %>% filter(is.na(incent_prop))
# 16261070080000 was class 319 in 2007 and 2008 and is currently 592.
# 13223190070000 was class 319 in 2008 and is 318 currently
# 09244100010000 doesn't exist any more
# 19271000680000 was class 180 and is now 190.
ptax_pins %>%
group_by(year, incent_prop) %>%
summarize(fmv = sum(fmv),
av_clerk = sum(av_clerk)) %>%
ggplot() +
geom_line(aes(x=year, y = fmv, color = incent_prop)) + theme_classic() +
labs(title = "FMV from Incentive and non-Incentive Class Properties", subtitle = "Uses com_ind_PINS... file.")
```
```{r}
#| label: tbl-growthcalculations5
#| tbl-cap: "**Growth from 2006 to 2022.** Removes PINs if they did not exist during all years in the data. Uses com_ind_PINS... file. Grouped by land_use, incent_prop, year. "
df_2006 <- ptax_pins %>%
group_by(pin) %>%
mutate(years_existed = n()) %>%
ungroup() %>%
filter(years_existed ==17 ) %>%
mutate(fmv = av_clerk/loa,
fmv = ifelse(is.na(fmv), 0 , fmv)) |>
arrange(year) |>
group_by(year, land_use, incent_prop) |>
summarize(pins = n(),
group_year_fmv = sum(fmv),
) |>
ungroup()|>
group_by(land_use, incent_prop) |>
mutate(
base_year_fmv = group_year_fmv[year == min(year)],
base_year_n = pins[year == min(year)],
fmv_growth = group_year_fmv/base_year_fmv,
n_growth = pins/base_year_n
) |> ungroup()
df_2006 %>%
select(year, land_use, incent_prop, pins, fmv_growth, n_growth) %>%
filter(year == 2022) %>%
select(-year)
```