generated at
図:NISAの税金-確定拠出年金の税金
NISAの税額-確定拠出年金の税額
年率成長:5%/6%
py
import matplotlib.pyplot as plt import numpy as np annual_income = 5000000 annual_social_fee = 750000 # 社会保険料 annual_basic_deduction = 480000 # 基礎控除 years_of_service = 30 # 勤続年数 years_of_investment = 30 # 今から定年までの期間 inital_CDC_value = 0 # 現時点での確定拠出年金の運用額 initial_iDeCo_value = 0 # 現時点でのiDeCoの運用額 annual_growth_rate = 5 # % initial_DC_value = inital_CDC_value + initial_iDeCo_value annual_taxable_income = annual_income - annual_social_fee - annual_basic_deduction # Tax calculation functions def calculate_progressive_tax(income): tax = 0 lower_limit = 0 tax_brackets = [ (1950000, 0.15), (3300000, 0.20), (6950000, 0.30), (9000000, 0.33), (18000000, 0.43), (40000000, 0.5), (99999999999, 0.55) ] for upper_limit, rate in tax_brackets: if income > upper_limit: tax += (upper_limit - lower_limit) * rate else: tax += (income - lower_limit) * rate break lower_limit = upper_limit return tax def get_japan_tax_rate(income): if income <= 1949000: return 0.15 elif 1950000 <= income <= 3299000: return 0.2 elif 3300000 <= income <= 6949000: return 0.3 elif 6950000 <= income <= 8999000: return 0.33 elif 9000000 <= income <= 17999000: return 0.43 elif 18000000 <= income <= 39999000: return 0.5 else: # income >= 40000000 return 0.55 # 退職所得控除 def calculate_retirement_deduction(years): if years <= 20: return 400000 * years else: return 8000000 + 700000 * (years - 20) # 退職金にかかる税金 def calculate_retirement_tax(retirement_pay, years): return calculate_progressive_tax((retirement_pay - calculate_retirement_deduction(years)) / 2) # Function to calculate the total value of investments def calculate_total_value(monthly_fee, annual_growth_rate, years_of_service): asset_from_now_growth = (monthly_fee * ((1 + (annual_growth_rate / 12 / 100)) ** (years_of_investment * 12) - 1)) / (annual_growth_rate / 12 / 100); # 現在の運用資産の成長 #current_asset_growth = initial_DC_value * ((1+annual_growth_rate) ** years_of_investment) return asset_from_now_growth #+ current_asset_growth # Function to calculate tax benefit from iDeCo def calculate_ideco_benefit(monthly_ideco_fee, annual_growth_rate, years_of_service): annual_ideco_fee = monthly_ideco_fee * 12 post_investment_value = calculate_total_value(monthly_ideco_fee, annual_growth_rate, years_of_service) ideco_total_tax = calculate_retirement_tax(post_investment_value, years_of_service) nisa_total_tax = (annual_ideco_fee * years_of_service) * get_japan_tax_rate(annual_taxable_income) return nisa_total_tax - ideco_total_tax # Generate graph monthly_ideco_fees = np.linspace(5000, 55000, 100) # Range of monthly iDeCo fees to explore benefits = [calculate_ideco_benefit(fee, annual_growth_rate, years_of_service) for fee in monthly_ideco_fees] plt.figure(figsize=(10, 6)) plt.plot(monthly_ideco_fees, benefits) plt.xlabel('Monthly iDeCo Fee (Yen)') plt.ylabel('Tax Benefit A-B (Yen)') plt.title('Tax Benefit of iDeCo Depending on Monthly Fee') plt.grid(True) plt.show()