Skip to content

Instantly share code, notes, and snippets.

@schlichtanders
Created September 1, 2021 11:49
Show Gist options
  • Save schlichtanders/176c2248c5e81f47d45946793e596939 to your computer and use it in GitHub Desktop.
Save schlichtanders/176c2248c5e81f47d45946793e596939 to your computer and use it in GitHub Desktop.
Beispiel Vergleich von Rürupp vs Private Rentenversicherung
### A Pluto.jl notebook ###
# v0.15.1
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local el = $(esc(element))
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : missing
el
end
end
# ╔═╡ a60e7bde-87bb-4fc8-a483-0b2f9b3ccd32
using Pkg; Pkg.add(["PlutoUI", "Plots", "PlotlyJS"])
# ╔═╡ 371239b4-ea10-4838-9418-603268788487
using PlutoUI; using Plots; plotlyjs();
# ╔═╡ 154a4358-b119-47f3-a378-dc4eff5edd9e
md"""
# Dependencies
"""
# ╔═╡ b31d04cd-36fb-4513-a6ed-15eed3e978e9
md"""
# Parameters
"""
# ╔═╡ 71eb8688-90a4-49d8-be38-16959e0923c4
input_spitzensteuersatz = @bind input_spitzensteuersatz Slider(0.38:0.01:0.42, default = 0.42, show_value = true)
# ╔═╡ a7d801a7-2860-4166-9f1e-1425fd6f5c48
output_spitzensteuersatz = @bind output_spitzensteuersatz Slider(0.2:0.01:0.42, default = 0.35, show_value = true)
# ╔═╡ 01a8ddd0-8f5e-4196-a44d-af9898b5ae76
input_investition = @bind input_investition Slider(10_000:10_000:100_000, default = 100_000, show_value = true)
# ╔═╡ 92b370a2-9cfc-46d2-9ec9-48dea99f5c12
rendite_jährlich = @bind rendite_jährlich Slider(0.03 : 0.01 : 0.07, default = 0.05, show_value = true)
# ╔═╡ 254a58b8-ab80-4548-8dac-d1c03f9143d3
zeitraum_jahre = @bind zeitraum_jahre Slider(20:5:40, default = 30, show_value = true)
# ╔═╡ 4d7cf360-75d6-45be-8ae3-639172e6f8cf
rente_ertragsanteil = @bind rente_ertragsanteil Slider(0.12:0.01:0.18, default = 0.17, show_value = true)
# ╔═╡ 101f6e75-38c5-4071-91b3-b4ea8d6e9b81
rente_gesamtanteil = @bind rente_gesamtanteil Slider(0.5:0.1:1.0, default = 1.0, show_value = true)
# ╔═╡ 09eeaaa0-a7b4-4965-af3b-0e510c003552
md"""
# Vergleich
"""
# ╔═╡ cff4e476-5b74-4eed-bea9-19a1e00ca9f1
md"""
# Rürupp
"""
# ╔═╡ c64d5784-b406-46a8-b0f8-d289a41ed726
run_investment(input, pa, years) = input * (1+pa)^years
# ╔═╡ ef0092b8-6576-43a2-a670-366875f6d09b
rürupp_input = input_investition + input_investition * input_spitzensteuersatz
# ╔═╡ 08c8e427-3890-4b9b-9101-f00312f117ad
rürupp_output = run_investment(rürupp_input, rendite_jährlich, zeitraum_jahre)
# ╔═╡ a29ddaeb-c705-4c41-97ce-bad23844a1a7
rürupp_ergebnis = rürupp_output * rente_gesamtanteil * (1 - output_spitzensteuersatz)
# ╔═╡ 3734b9bb-7c73-4ced-bc47-70df8276eb98
md"""
# Private
"""
# ╔═╡ 159a8c99-cc29-4c5c-af86-3baa2e87f17f
private_input = input_investition
# ╔═╡ 2f7277f7-6a13-4ee6-9ba2-5371f6e590a7
private_output = run_investment(private_input, rendite_jährlich, zeitraum_jahre)
# ╔═╡ 3d102d53-61e8-4856-831e-03b2e77e4bb4
private_ergebnis = private_output * rente_gesamtanteil * (1 - rente_ertragsanteil * output_spitzensteuersatz)
# ╔═╡ 2a1a7fc8-86bd-430b-83f7-38d8870eefb0
private_ergebnis - rürupp_ergebnis
# ╔═╡ a1008702-47f5-42cd-baa2-d1b03d02a93f
(private_ergebnis - rürupp_ergebnis) / rürupp_ergebnis
# ╔═╡ 4abba217-610b-46fa-864f-4bc8d3235014
begin
x = ["Rürupp", "Private", "Gewinn Private"]
y = [rürupp_ergebnis, private_ergebnis, private_ergebnis - rürupp_ergebnis]
bar(x, y, group = x, legend = false, fillcolors = [
y[3] < 0 ? :green : :red,
y[3] > 0 ? :green : :red,
:blue])
end
# ╔═╡ Cell order:
# ╟─154a4358-b119-47f3-a378-dc4eff5edd9e
# ╠═a60e7bde-87bb-4fc8-a483-0b2f9b3ccd32
# ╠═371239b4-ea10-4838-9418-603268788487
# ╟─b31d04cd-36fb-4513-a6ed-15eed3e978e9
# ╟─71eb8688-90a4-49d8-be38-16959e0923c4
# ╟─a7d801a7-2860-4166-9f1e-1425fd6f5c48
# ╟─01a8ddd0-8f5e-4196-a44d-af9898b5ae76
# ╟─92b370a2-9cfc-46d2-9ec9-48dea99f5c12
# ╟─254a58b8-ab80-4548-8dac-d1c03f9143d3
# ╟─4d7cf360-75d6-45be-8ae3-639172e6f8cf
# ╟─101f6e75-38c5-4071-91b3-b4ea8d6e9b81
# ╟─09eeaaa0-a7b4-4965-af3b-0e510c003552
# ╠═2a1a7fc8-86bd-430b-83f7-38d8870eefb0
# ╠═a1008702-47f5-42cd-baa2-d1b03d02a93f
# ╠═4abba217-610b-46fa-864f-4bc8d3235014
# ╟─cff4e476-5b74-4eed-bea9-19a1e00ca9f1
# ╠═c64d5784-b406-46a8-b0f8-d289a41ed726
# ╠═ef0092b8-6576-43a2-a670-366875f6d09b
# ╠═08c8e427-3890-4b9b-9101-f00312f117ad
# ╠═a29ddaeb-c705-4c41-97ce-bad23844a1a7
# ╟─3734b9bb-7c73-4ced-bc47-70df8276eb98
# ╠═159a8c99-cc29-4c5c-af86-3baa2e87f17f
# ╠═2f7277f7-6a13-4ee6-9ba2-5371f6e590a7
# ╠═3d102d53-61e8-4856-831e-03b2e77e4bb4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment