forked from miraisolutions/SmaRP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
global.R
129 lines (111 loc) · 4.64 KB
/
global.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
library(SmaRP)
`%>%` <- magrittr::`%>%`
# Global variables
# https://www.admin.ch/opc/de/classified-compilation/19820152/index.html#a8
MinBVG <- 24885 # Min Koordinierter Lohn (MinBVG = MaxAHV * (7 / 8))
MaxBVG <- 85320 # Max Koordinierter Lohn (MaxBVG = MaxAHV * 3)
MaxAHV <- MaxBVG / 36
MaxBVGfund <- 10 * MaxBVG
# https://www.admin.ch/opc/de/classified-compilation/19840067/index.html#a12
BVGMindestzinssatz <- 0.01
# https://www.ch.ch/en/3rd-pillar/
MaxContrTax <- 6826
# https://www.admin.ch/opc/de/classified-compilation/19820152/index.html
BVGcontributionrates <- data.frame(
lowerbound = c(18, 25, 35, 45, 55),
upperbound = c(24, 34, 44, 54, 70),
BVGcontributionrates = c(0.00, 0.07, 0.10, 0.15, 0.18)
)
# BVGcontributionrates path
BVGcontributionratesPath <- data.frame(
years = seq(BVGcontributionrates$lowerbound[1], BVGcontributionrates$upperbound[nrow(BVGcontributionrates)]),
BVGcontributionrates = rep(BVGcontributionrates$BVGcontributionrates,
times = BVGcontributionrates$upperbound - BVGcontributionrates$lowerbound + 1
)
)
Rate_group.list <- list(
"Single" = "A",
"Married" = "B",
"Married 2x Income" = "C"
)
church_tax.list <- list(
"Yes" = "A",
"None" = "B"
)
Purchase.list <- list(
"Single" = "SingleP2",
"Annual" = "AnnualP2"
)
# PLZGemeinden <- readRDS("inst/application/data/PLZGemeinden.rds")
PLZGemeinden <- readRDS(system.file("application", "data", "PLZGemeinden.rds", package = "SmaRP"))
PLZGemeinden$PLZGDENAME <- with(PLZGemeinden, paste(PLZ, GDENAME))
kantons <- unique(PLZGemeinden$Kanton)
# BundessteueTabelle <- readRDS("inst/application/data/BundessteueTabelle.rds")
# taxburden_2016.list <- readRDS("inst/application/data/taxburden.list.rds")
BundessteueTabelle <- readRDS(system.file("application", "data", "BundessteueTabelle.rds", package = "SmaRP"))
taxburden.list <- readRDS(system.file("application", "data", "taxburden_2017.list.rds", package = "SmaRP"))
# Kinderabzuge table
# https://www.estv.admin.ch/dam/estv/de/dokumente/allgemein/Dokumentation/Publikationen/steuermaeppchen/KinderabzugE_de-fr.pdf.download.pdf/KinderabzugE_de-fr.pdf
# - It's assumed that all kids live on their household, attend a public school on their village and are always 6 years old.
# - BL, VD and VS work differenly and therefore are not accurate.
KinderabzugKG <- matrix(data = 6500, nrow = length(kantons), ncol = 10) %>%
as.data.frame() %>%
magrittr::set_rownames(kantons) %>%
magrittr::set_colnames(seq(1:10))
KinderabzugKG[rownames(KinderabzugKG) == "NW", ] <- 5400
KinderabzugKG[rownames(KinderabzugKG) %in% c("SO", "AR", "GR"), ] <- 6000
KinderabzugKG[rownames(KinderabzugKG) %in% c("TG", "AG", "GL"), ] <- 7000
KinderabzugKG[rownames(KinderabzugKG) %in% c("LU", "SG"), ] <- 7200
KinderabzugKG[rownames(KinderabzugKG) == "VS", ] <- 7510
KinderabzugKG[rownames(KinderabzugKG) == "BS", ] <- 7800
KinderabzugKG[rownames(KinderabzugKG) %in% c("BE", "UR"), ] <- 8000
KinderabzugKG[rownames(KinderabzugKG) %in% c("ZH", "SZ"), ] <- 9000
KinderabzugKG[rownames(KinderabzugKG) == "GE", ] <- 9980
KinderabzugKG[rownames(KinderabzugKG) == "TI", ] <- 11000
KinderabzugKG[rownames(KinderabzugKG) == "ZG", ] <- 12000
KinderabzugKG[rownames(KinderabzugKG) == "FR", ] <- c(8500, 8500, rep(9500, 8))
KinderabzugKG[rownames(KinderabzugKG) == "AI", ] <- c(6000, 6000, rep(8000, 8))
KinderabzugKG[rownames(KinderabzugKG) == "JU", ] <- c(5300, 5300, rep(5900, 8))
# TODO: Build a table like this with accurate data (by now, taken Steuerfusse in den Kantonhauptorten)
Kirchensteuer <- unique(PLZGemeinden[, c("Kanton", "FactorKanton", "FactorGemeinde", "FactorKirche")]) %>%
dplyr::mutate(Kirchensteuer = (FactorKanton + FactorGemeinde) / (FactorKanton + FactorGemeinde + FactorKirche))
Kirchensteuer[Kirchensteuer$Kanton == "VS", "Kirchensteuer"] <- 0.97
# Abzuge
AHL <- 0.0515
ALV <- 0.011
maxALV <- 1630.2
VersicherungsL <- 1700 # übrige mit Vorsorge
VersicherungsV <- 3500 # Verheitatete mit Vorsorge
VersicherungsK <- 700
DOV <- 13400 # assumption: always max
Kinder <- 6500 #federal Abzug
Verheiratet <- 2600
BerufsauslagenTarif <- 0.03
BerufsauslagenMax <- 4000
BerufsauslagenMin <- 2000
NBU <- 0.0084
maxNBU <- 1065
# List of initial, max and min values
value <- list (
birthday = "1980-12-30",
gender = "M",
min_retirement = 55,
max_retirement = 70,
retirement_female = 64,
retirement_male = 65,
plz = with(PLZGemeinden, PLZGDENAME[match(8001, PLZ)]),
rate = "A",
min_children = 0,
max_children = 9,
church = "A",
salary = 100000,
max_salary = 1e+08,
growth_rate = 0.5,
p2 = 100000,
min_p2_interest = 100 * BVGMindestzinssatz,
p2_voluntary = 0,
p3 = 50000,
p3_annual = 5000,
p3_return = 100 * BVGMindestzinssatz,
perc_step = 0.1
)