楚新元 | All in R

Welcome to R Square

等额本金和等额本息比较分析

楚新元 / 2022-12-11


提出需求

贷款 100 万,贷款利率为 6%(年利率),贷款期限 15 年。分别计算等额本金和等额本息两种还款方式下每月偿还本金、偿还利息、偿还本息、剩余本金。并对两种还款方式进行比较分析。

加载相关R包

library(ggplot2)
library(dplyr)
library(gt)

参数设置

# 设置贷款金额 value
value = 1000000

# 设置贷款利率 rate
rate = 0.06

# 设置贷款期限 term
term = 15

# 设置还款方式 mode
mode1 = "等额本金"
mode2 = "等额本息"

编写函数

repayment = function(value, rate, term, mode) {
  
  # 年利率换算为月利率
  rate_m = rate / 12
  # 还款期限换算成月
  t = term * 12
  # 生成还款期次向量
  N = 1:t  # 还款期次
  
  # 等额本金模式
  if (mode == "等额本金") {
    MBA = value / t  # 每月应还本金
    MYA = value - MBA * (N-1)  # 截至当月还款前贷款余额
    MYAA = value - MBA * N  # 还贷后剩余本金
    MIA = MYA * rate_m  # 当月应还利息
    MPA = MIA + MBA  # 当月应还本息和
    tbl = data.frame(N, MYA, MBA, MIA, MPA, MYAA, mode)
    colnames(tbl) = c(
      "还款期次", "贷款余额", "应还本金", 
      "应还利息", "应还本息", "剩余本金",
      "还款方式"
    )
  }
    
  # 等额本息模式
  if (mode == "等额本息") {
    # 每月应还的等额本息
    MPB = value * rate_m * (1 + rate_m)^t / ((1 + rate_m)^t - 1) 
    # 截至当月还款前贷款余额
    MYB = value *(1 + rate_m)^(N-1) - MPB * ((1 + rate_m)^(N-1) - 1) / rate_m
    MIB = MYB * rate_m  # 当月应还利息
    MBB = MPB - MIB  # 当月应还本金
    MYBB = MYB - MBB  # 剩余本金
    tbl = data.frame(N, MYB, MBB, MIB, MPB, MYBB, mode)
    colnames(tbl) = c(
      "还款期次", "贷款余额", "应还本金", 
      "应还利息", "应还本息", "剩余本金",
      "还款方式"
    )
  }
  
  # 返回生成的数据框
  return(tbl)

}

生成还款表验证函数

生成等额本金还款表

# 计算等额本金月供
df1 = repayment(
  value = value,
  rate = rate,
  term = term, 
  mode = mode1
)

# 生成还款表
df1[1:6] %>% 
  gt() %>% 
  tab_style(
    style = cell_text(size = px(12)),
    locations = list(
      cells_body(),
      cells_column_labels()
    )
  ) %>% 
  tab_style(
    style = cell_text(align = "center"),
    locations = cells_body(columns = 1)
  ) %>% 
  tab_style(
    style = cell_text(align = "right"),
    locations = cells_body(columns = -1)
  ) %>% 
  fmt_number(
    columns = -还款期次, 
    decimals = 2
  ) %>% 
  tab_style(
    style = cell_fill(color = "#f8f8f8"),
    locations = cells_body(
      rows = (还款期次 %% 2 == 0)
    )
  )
还款期次 贷款余额 应还本金 应还利息 应还本息 剩余本金
1 1,000,000.00 5,555.56 5,000.00 10,555.56 994,444.44
2 994,444.44 5,555.56 4,972.22 10,527.78 988,888.89
3 988,888.89 5,555.56 4,944.44 10,500.00 983,333.33
4 983,333.33 5,555.56 4,916.67 10,472.22 977,777.78
5 977,777.78 5,555.56 4,888.89 10,444.44 972,222.22
6 972,222.22 5,555.56 4,861.11 10,416.67 966,666.67
7 966,666.67 5,555.56 4,833.33 10,388.89 961,111.11
8 961,111.11 5,555.56 4,805.56 10,361.11 955,555.56
9 955,555.56 5,555.56 4,777.78 10,333.33 950,000.00
10 950,000.00 5,555.56 4,750.00 10,305.56 944,444.44
11 944,444.44 5,555.56 4,722.22 10,277.78 938,888.89
12 938,888.89 5,555.56 4,694.44 10,250.00 933,333.33
13 933,333.33 5,555.56 4,666.67 10,222.22 927,777.78
14 927,777.78 5,555.56 4,638.89 10,194.44 922,222.22
15 922,222.22 5,555.56 4,611.11 10,166.67 916,666.67
16 916,666.67 5,555.56 4,583.33 10,138.89 911,111.11
17 911,111.11 5,555.56 4,555.56 10,111.11 905,555.56
18 905,555.56 5,555.56 4,527.78 10,083.33 900,000.00
19 900,000.00 5,555.56 4,500.00 10,055.56 894,444.44
20 894,444.44 5,555.56 4,472.22 10,027.78 888,888.89
21 888,888.89 5,555.56 4,444.44 10,000.00 883,333.33
22 883,333.33 5,555.56 4,416.67 9,972.22 877,777.78
23 877,777.78 5,555.56 4,388.89 9,944.44 872,222.22
24 872,222.22 5,555.56 4,361.11 9,916.67 866,666.67
25 866,666.67 5,555.56 4,333.33 9,888.89 861,111.11
26 861,111.11 5,555.56 4,305.56 9,861.11 855,555.56
27 855,555.56 5,555.56 4,277.78 9,833.33 850,000.00
28 850,000.00 5,555.56 4,250.00 9,805.56 844,444.44
29 844,444.44 5,555.56 4,222.22 9,777.78 838,888.89
30 838,888.89 5,555.56 4,194.44 9,750.00 833,333.33
31 833,333.33 5,555.56 4,166.67 9,722.22 827,777.78
32 827,777.78 5,555.56 4,138.89 9,694.44 822,222.22
33 822,222.22 5,555.56 4,111.11 9,666.67 816,666.67
34 816,666.67 5,555.56 4,083.33 9,638.89 811,111.11
35 811,111.11 5,555.56 4,055.56 9,611.11 805,555.56
36 805,555.56 5,555.56 4,027.78 9,583.33 800,000.00
37 800,000.00 5,555.56 4,000.00 9,555.56 794,444.44
38 794,444.44 5,555.56 3,972.22 9,527.78 788,888.89
39 788,888.89 5,555.56 3,944.44 9,500.00 783,333.33
40 783,333.33 5,555.56 3,916.67 9,472.22 777,777.78
41 777,777.78 5,555.56 3,888.89 9,444.44 772,222.22
42 772,222.22 5,555.56 3,861.11 9,416.67 766,666.67
43 766,666.67 5,555.56 3,833.33 9,388.89 761,111.11
44 761,111.11 5,555.56 3,805.56 9,361.11 755,555.56
45 755,555.56 5,555.56 3,777.78 9,333.33 750,000.00
46 750,000.00 5,555.56 3,750.00 9,305.56 744,444.44
47 744,444.44 5,555.56 3,722.22 9,277.78 738,888.89
48 738,888.89 5,555.56 3,694.44 9,250.00 733,333.33
49 733,333.33 5,555.56 3,666.67 9,222.22 727,777.78
50 727,777.78 5,555.56 3,638.89 9,194.44 722,222.22
51 722,222.22 5,555.56 3,611.11 9,166.67 716,666.67
52 716,666.67 5,555.56 3,583.33 9,138.89 711,111.11
53 711,111.11 5,555.56 3,555.56 9,111.11 705,555.56
54 705,555.56 5,555.56 3,527.78 9,083.33 700,000.00
55 700,000.00 5,555.56 3,500.00 9,055.56 694,444.44
56 694,444.44 5,555.56 3,472.22 9,027.78 688,888.89
57 688,888.89 5,555.56 3,444.44 9,000.00 683,333.33
58 683,333.33 5,555.56 3,416.67 8,972.22 677,777.78
59 677,777.78 5,555.56 3,388.89 8,944.44 672,222.22
60 672,222.22 5,555.56 3,361.11 8,916.67 666,666.67
61 666,666.67 5,555.56 3,333.33 8,888.89 661,111.11
62 661,111.11 5,555.56 3,305.56 8,861.11 655,555.56
63 655,555.56 5,555.56 3,277.78 8,833.33 650,000.00
64 650,000.00 5,555.56 3,250.00 8,805.56 644,444.44
65 644,444.44 5,555.56 3,222.22 8,777.78 638,888.89
66 638,888.89 5,555.56 3,194.44 8,750.00 633,333.33
67 633,333.33 5,555.56 3,166.67 8,722.22 627,777.78
68 627,777.78 5,555.56 3,138.89 8,694.44 622,222.22
69 622,222.22 5,555.56 3,111.11 8,666.67 616,666.67
70 616,666.67 5,555.56 3,083.33 8,638.89 611,111.11
71 611,111.11 5,555.56 3,055.56 8,611.11 605,555.56
72 605,555.56 5,555.56 3,027.78 8,583.33 600,000.00
73 600,000.00 5,555.56 3,000.00 8,555.56 594,444.44
74 594,444.44 5,555.56 2,972.22 8,527.78 588,888.89
75 588,888.89 5,555.56 2,944.44 8,500.00 583,333.33
76 583,333.33 5,555.56 2,916.67 8,472.22 577,777.78
77 577,777.78 5,555.56 2,888.89 8,444.44 572,222.22
78 572,222.22 5,555.56 2,861.11 8,416.67 566,666.67
79 566,666.67 5,555.56 2,833.33 8,388.89 561,111.11
80 561,111.11 5,555.56 2,805.56 8,361.11 555,555.56
81 555,555.56 5,555.56 2,777.78 8,333.33 550,000.00
82 550,000.00 5,555.56 2,750.00 8,305.56 544,444.44
83 544,444.44 5,555.56 2,722.22 8,277.78 538,888.89
84 538,888.89 5,555.56 2,694.44 8,250.00 533,333.33
85 533,333.33 5,555.56 2,666.67 8,222.22 527,777.78
86 527,777.78 5,555.56 2,638.89 8,194.44 522,222.22
87 522,222.22 5,555.56 2,611.11 8,166.67 516,666.67
88 516,666.67 5,555.56 2,583.33 8,138.89 511,111.11
89 511,111.11 5,555.56 2,555.56 8,111.11 505,555.56
90 505,555.56 5,555.56 2,527.78 8,083.33 500,000.00
91 500,000.00 5,555.56 2,500.00 8,055.56 494,444.44
92 494,444.44 5,555.56 2,472.22 8,027.78 488,888.89
93 488,888.89 5,555.56 2,444.44 8,000.00 483,333.33
94 483,333.33 5,555.56 2,416.67 7,972.22 477,777.78
95 477,777.78 5,555.56 2,388.89 7,944.44 472,222.22
96 472,222.22 5,555.56 2,361.11 7,916.67 466,666.67
97 466,666.67 5,555.56 2,333.33 7,888.89 461,111.11
98 461,111.11 5,555.56 2,305.56 7,861.11 455,555.56
99 455,555.56 5,555.56 2,277.78 7,833.33 450,000.00
100 450,000.00 5,555.56 2,250.00 7,805.56 444,444.44
101 444,444.44 5,555.56 2,222.22 7,777.78 438,888.89
102 438,888.89 5,555.56 2,194.44 7,750.00 433,333.33
103 433,333.33 5,555.56 2,166.67 7,722.22 427,777.78
104 427,777.78 5,555.56 2,138.89 7,694.44 422,222.22
105 422,222.22 5,555.56 2,111.11 7,666.67 416,666.67
106 416,666.67 5,555.56 2,083.33 7,638.89 411,111.11
107 411,111.11 5,555.56 2,055.56 7,611.11 405,555.56
108 405,555.56 5,555.56 2,027.78 7,583.33 400,000.00
109 400,000.00 5,555.56 2,000.00 7,555.56 394,444.44
110 394,444.44 5,555.56 1,972.22 7,527.78 388,888.89
111 388,888.89 5,555.56 1,944.44 7,500.00 383,333.33
112 383,333.33 5,555.56 1,916.67 7,472.22 377,777.78
113 377,777.78 5,555.56 1,888.89 7,444.44 372,222.22
114 372,222.22 5,555.56 1,861.11 7,416.67 366,666.67
115 366,666.67 5,555.56 1,833.33 7,388.89 361,111.11
116 361,111.11 5,555.56 1,805.56 7,361.11 355,555.56
117 355,555.56 5,555.56 1,777.78 7,333.33 350,000.00
118 350,000.00 5,555.56 1,750.00 7,305.56 344,444.44
119 344,444.44 5,555.56 1,722.22 7,277.78 338,888.89
120 338,888.89 5,555.56 1,694.44 7,250.00 333,333.33
121 333,333.33 5,555.56 1,666.67 7,222.22 327,777.78
122 327,777.78 5,555.56 1,638.89 7,194.44 322,222.22
123 322,222.22 5,555.56 1,611.11 7,166.67 316,666.67
124 316,666.67 5,555.56 1,583.33 7,138.89 311,111.11
125 311,111.11 5,555.56 1,555.56 7,111.11 305,555.56
126 305,555.56 5,555.56 1,527.78 7,083.33 300,000.00
127 300,000.00 5,555.56 1,500.00 7,055.56 294,444.44
128 294,444.44 5,555.56 1,472.22 7,027.78 288,888.89
129 288,888.89 5,555.56 1,444.44 7,000.00 283,333.33
130 283,333.33 5,555.56 1,416.67 6,972.22 277,777.78
131 277,777.78 5,555.56 1,388.89 6,944.44 272,222.22
132 272,222.22 5,555.56 1,361.11 6,916.67 266,666.67
133 266,666.67 5,555.56 1,333.33 6,888.89 261,111.11
134 261,111.11 5,555.56 1,305.56 6,861.11 255,555.56
135 255,555.56 5,555.56 1,277.78 6,833.33 250,000.00
136 250,000.00 5,555.56 1,250.00 6,805.56 244,444.44
137 244,444.44 5,555.56 1,222.22 6,777.78 238,888.89
138 238,888.89 5,555.56 1,194.44 6,750.00 233,333.33
139 233,333.33 5,555.56 1,166.67 6,722.22 227,777.78
140 227,777.78 5,555.56 1,138.89 6,694.44 222,222.22
141 222,222.22 5,555.56 1,111.11 6,666.67 216,666.67
142 216,666.67 5,555.56 1,083.33 6,638.89 211,111.11
143 211,111.11 5,555.56 1,055.56 6,611.11 205,555.56
144 205,555.56 5,555.56 1,027.78 6,583.33 200,000.00
145 200,000.00 5,555.56 1,000.00 6,555.56 194,444.44
146 194,444.44 5,555.56 972.22 6,527.78 188,888.89
147 188,888.89 5,555.56 944.44 6,500.00 183,333.33
148 183,333.33 5,555.56 916.67 6,472.22 177,777.78
149 177,777.78 5,555.56 888.89 6,444.44 172,222.22
150 172,222.22 5,555.56 861.11 6,416.67 166,666.67
151 166,666.67 5,555.56 833.33 6,388.89 161,111.11
152 161,111.11 5,555.56 805.56 6,361.11 155,555.56
153 155,555.56 5,555.56 777.78 6,333.33 150,000.00
154 150,000.00 5,555.56 750.00 6,305.56 144,444.44
155 144,444.44 5,555.56 722.22 6,277.78 138,888.89
156 138,888.89 5,555.56 694.44 6,250.00 133,333.33
157 133,333.33 5,555.56 666.67 6,222.22 127,777.78
158 127,777.78 5,555.56 638.89 6,194.44 122,222.22
159 122,222.22 5,555.56 611.11 6,166.67 116,666.67
160 116,666.67 5,555.56 583.33 6,138.89 111,111.11
161 111,111.11 5,555.56 555.56 6,111.11 105,555.56
162 105,555.56 5,555.56 527.78 6,083.33 100,000.00
163 100,000.00 5,555.56 500.00 6,055.56 94,444.44
164 94,444.44 5,555.56 472.22 6,027.78 88,888.89
165 88,888.89 5,555.56 444.44 6,000.00 83,333.33
166 83,333.33 5,555.56 416.67 5,972.22 77,777.78
167 77,777.78 5,555.56 388.89 5,944.44 72,222.22
168 72,222.22 5,555.56 361.11 5,916.67 66,666.67
169 66,666.67 5,555.56 333.33 5,888.89 61,111.11
170 61,111.11 5,555.56 305.56 5,861.11 55,555.56
171 55,555.56 5,555.56 277.78 5,833.33 50,000.00
172 50,000.00 5,555.56 250.00 5,805.56 44,444.44
173 44,444.44 5,555.56 222.22 5,777.78 38,888.89
174 38,888.89 5,555.56 194.44 5,750.00 33,333.33
175 33,333.33 5,555.56 166.67 5,722.22 27,777.78
176 27,777.78 5,555.56 138.89 5,694.44 22,222.22
177 22,222.22 5,555.56 111.11 5,666.67 16,666.67
178 16,666.67 5,555.56 83.33 5,638.89 11,111.11
179 11,111.11 5,555.56 55.56 5,611.11 5,555.56
180 5,555.56 5,555.56 27.78 5,583.33 0.00

生成等额本息还款表

# 计算等额本息月供
df2 = repayment(
  value = value, 
  rate = rate, 
  term = term, 
  mode = mode2
)

# 生成还款表
df2[1:6] %>% 
  gt() %>% 
  tab_style(
    style = cell_text(size = px(12)),
    locations = list(
      cells_body(),
      cells_column_labels()
    )
  ) %>% 
  tab_style(
    style = cell_text(align = "center"),
    locations = cells_body(columns = 1)
  ) %>% 
  tab_style(
    style = cell_text(align = "right"),
    locations = cells_body(columns = -1)
  ) %>% 
  fmt_number(
    columns = -还款期次, 
    decimals = 2
  ) %>% 
  tab_style(
    style = cell_fill(color = "#f8f8f8"),
    locations = cells_body(
      rows = (还款期次 %% 2 == 0)
    )
  )
还款期次 贷款余额 应还本金 应还利息 应还本息 剩余本金
1 1,000,000.00 3,438.57 5,000.00 8,438.57 996,561.43
2 996,561.43 3,455.76 4,982.81 8,438.57 993,105.67
3 993,105.67 3,473.04 4,965.53 8,438.57 989,632.63
4 989,632.63 3,490.41 4,948.16 8,438.57 986,142.23
5 986,142.23 3,507.86 4,930.71 8,438.57 982,634.37
6 982,634.37 3,525.40 4,913.17 8,438.57 979,108.97
7 979,108.97 3,543.02 4,895.54 8,438.57 975,565.95
8 975,565.95 3,560.74 4,877.83 8,438.57 972,005.21
9 972,005.21 3,578.54 4,860.03 8,438.57 968,426.67
10 968,426.67 3,596.43 4,842.13 8,438.57 964,830.23
11 964,830.23 3,614.42 4,824.15 8,438.57 961,215.82
12 961,215.82 3,632.49 4,806.08 8,438.57 957,583.33
13 957,583.33 3,650.65 4,787.92 8,438.57 953,932.67
14 953,932.67 3,668.90 4,769.66 8,438.57 950,263.77
15 950,263.77 3,687.25 4,751.32 8,438.57 946,576.52
16 946,576.52 3,705.69 4,732.88 8,438.57 942,870.83
17 942,870.83 3,724.21 4,714.35 8,438.57 939,146.62
18 939,146.62 3,742.84 4,695.73 8,438.57 935,403.79
19 935,403.79 3,761.55 4,677.02 8,438.57 931,642.24
20 931,642.24 3,780.36 4,658.21 8,438.57 927,861.88
21 927,861.88 3,799.26 4,639.31 8,438.57 924,062.62
22 924,062.62 3,818.26 4,620.31 8,438.57 920,244.37
23 920,244.37 3,837.35 4,601.22 8,438.57 916,407.02
24 916,407.02 3,856.53 4,582.04 8,438.57 912,550.49
25 912,550.49 3,875.82 4,562.75 8,438.57 908,674.67
26 908,674.67 3,895.19 4,543.37 8,438.57 904,779.47
27 904,779.47 3,914.67 4,523.90 8,438.57 900,864.80
28 900,864.80 3,934.24 4,504.32 8,438.57 896,930.56
29 896,930.56 3,953.92 4,484.65 8,438.57 892,976.64
30 892,976.64 3,973.69 4,464.88 8,438.57 889,002.96
31 889,002.96 3,993.55 4,445.01 8,438.57 885,009.41
32 885,009.41 4,013.52 4,425.05 8,438.57 880,995.88
33 880,995.88 4,033.59 4,404.98 8,438.57 876,962.30
34 876,962.30 4,053.76 4,384.81 8,438.57 872,908.54
35 872,908.54 4,074.03 4,364.54 8,438.57 868,834.51
36 868,834.51 4,094.40 4,344.17 8,438.57 864,740.12
37 864,740.12 4,114.87 4,323.70 8,438.57 860,625.25
38 860,625.25 4,135.44 4,303.13 8,438.57 856,489.81
39 856,489.81 4,156.12 4,282.45 8,438.57 852,333.69
40 852,333.69 4,176.90 4,261.67 8,438.57 848,156.79
41 848,156.79 4,197.78 4,240.78 8,438.57 843,959.00
42 843,959.00 4,218.77 4,219.80 8,438.57 839,740.23
43 839,740.23 4,239.87 4,198.70 8,438.57 835,500.36
44 835,500.36 4,261.07 4,177.50 8,438.57 831,239.30
45 831,239.30 4,282.37 4,156.20 8,438.57 826,956.93
46 826,956.93 4,303.78 4,134.78 8,438.57 822,653.14
47 822,653.14 4,325.30 4,113.27 8,438.57 818,327.84
48 818,327.84 4,346.93 4,091.64 8,438.57 813,980.91
49 813,980.91 4,368.66 4,069.90 8,438.57 809,612.25
50 809,612.25 4,390.51 4,048.06 8,438.57 805,221.74
51 805,221.74 4,412.46 4,026.11 8,438.57 800,809.28
52 800,809.28 4,434.52 4,004.05 8,438.57 796,374.76
53 796,374.76 4,456.69 3,981.87 8,438.57 791,918.06
54 791,918.06 4,478.98 3,959.59 8,438.57 787,439.09
55 787,439.09 4,501.37 3,937.20 8,438.57 782,937.71
56 782,937.71 4,523.88 3,914.69 8,438.57 778,413.83
57 778,413.83 4,546.50 3,892.07 8,438.57 773,867.33
58 773,867.33 4,569.23 3,869.34 8,438.57 769,298.10
59 769,298.10 4,592.08 3,846.49 8,438.57 764,706.02
60 764,706.02 4,615.04 3,823.53 8,438.57 760,090.99
61 760,090.99 4,638.11 3,800.45 8,438.57 755,452.87
62 755,452.87 4,661.30 3,777.26 8,438.57 750,791.57
63 750,791.57 4,684.61 3,753.96 8,438.57 746,106.96
64 746,106.96 4,708.03 3,730.53 8,438.57 741,398.92
65 741,398.92 4,731.57 3,706.99 8,438.57 736,667.35
66 736,667.35 4,755.23 3,683.34 8,438.57 731,912.12
67 731,912.12 4,779.01 3,659.56 8,438.57 727,133.11
68 727,133.11 4,802.90 3,635.67 8,438.57 722,330.21
69 722,330.21 4,826.92 3,611.65 8,438.57 717,503.29
70 717,503.29 4,851.05 3,587.52 8,438.57 712,652.24
71 712,652.24 4,875.31 3,563.26 8,438.57 707,776.93
72 707,776.93 4,899.68 3,538.88 8,438.57 702,877.25
73 702,877.25 4,924.18 3,514.39 8,438.57 697,953.07
74 697,953.07 4,948.80 3,489.77 8,438.57 693,004.26
75 693,004.26 4,973.55 3,465.02 8,438.57 688,030.72
76 688,030.72 4,998.41 3,440.15 8,438.57 683,032.30
77 683,032.30 5,023.41 3,415.16 8,438.57 678,008.90
78 678,008.90 5,048.52 3,390.04 8,438.57 672,960.37
79 672,960.37 5,073.77 3,364.80 8,438.57 667,886.61
80 667,886.61 5,099.14 3,339.43 8,438.57 662,787.47
81 662,787.47 5,124.63 3,313.94 8,438.57 657,662.84
82 657,662.84 5,150.25 3,288.31 8,438.57 652,512.59
83 652,512.59 5,176.01 3,262.56 8,438.57 647,336.58
84 647,336.58 5,201.89 3,236.68 8,438.57 642,134.70
85 642,134.70 5,227.89 3,210.67 8,438.57 636,906.80
86 636,906.80 5,254.03 3,184.53 8,438.57 631,652.77
87 631,652.77 5,280.30 3,158.26 8,438.57 626,372.46
88 626,372.46 5,306.71 3,131.86 8,438.57 621,065.76
89 621,065.76 5,333.24 3,105.33 8,438.57 615,732.52
90 615,732.52 5,359.91 3,078.66 8,438.57 610,372.61
91 610,372.61 5,386.71 3,051.86 8,438.57 604,985.91
92 604,985.91 5,413.64 3,024.93 8,438.57 599,572.27
93 599,572.27 5,440.71 2,997.86 8,438.57 594,131.56
94 594,131.56 5,467.91 2,970.66 8,438.57 588,663.65
95 588,663.65 5,495.25 2,943.32 8,438.57 583,168.40
96 583,168.40 5,522.73 2,915.84 8,438.57 577,645.67
97 577,645.67 5,550.34 2,888.23 8,438.57 572,095.33
98 572,095.33 5,578.09 2,860.48 8,438.57 566,517.24
99 566,517.24 5,605.98 2,832.59 8,438.57 560,911.26
100 560,911.26 5,634.01 2,804.56 8,438.57 555,277.25
101 555,277.25 5,662.18 2,776.39 8,438.57 549,615.06
102 549,615.06 5,690.49 2,748.08 8,438.57 543,924.57
103 543,924.57 5,718.95 2,719.62 8,438.57 538,205.63
104 538,205.63 5,747.54 2,691.03 8,438.57 532,458.09
105 532,458.09 5,776.28 2,662.29 8,438.57 526,681.81
106 526,681.81 5,805.16 2,633.41 8,438.57 520,876.65
107 520,876.65 5,834.19 2,604.38 8,438.57 515,042.46
108 515,042.46 5,863.36 2,575.21 8,438.57 509,179.11
109 509,179.11 5,892.67 2,545.90 8,438.57 503,286.44
110 503,286.44 5,922.14 2,516.43 8,438.57 497,364.30
111 497,364.30 5,951.75 2,486.82 8,438.57 491,412.55
112 491,412.55 5,981.51 2,457.06 8,438.57 485,431.05
113 485,431.05 6,011.41 2,427.16 8,438.57 479,419.63
114 479,419.63 6,041.47 2,397.10 8,438.57 473,378.16
115 473,378.16 6,071.68 2,366.89 8,438.57 467,306.49
116 467,306.49 6,102.04 2,336.53 8,438.57 461,204.45
117 461,204.45 6,132.55 2,306.02 8,438.57 455,071.90
118 455,071.90 6,163.21 2,275.36 8,438.57 448,908.70
119 448,908.70 6,194.02 2,244.54 8,438.57 442,714.67
120 442,714.67 6,224.99 2,213.57 8,438.57 436,489.68
121 436,489.68 6,256.12 2,182.45 8,438.57 430,233.56
122 430,233.56 6,287.40 2,151.17 8,438.57 423,946.16
123 423,946.16 6,318.84 2,119.73 8,438.57 417,627.32
124 417,627.32 6,350.43 2,088.14 8,438.57 411,276.89
125 411,276.89 6,382.18 2,056.38 8,438.57 404,894.70
126 404,894.70 6,414.09 2,024.47 8,438.57 398,480.61
127 398,480.61 6,446.17 1,992.40 8,438.57 392,034.44
128 392,034.44 6,478.40 1,960.17 8,438.57 385,556.05
129 385,556.05 6,510.79 1,927.78 8,438.57 379,045.26
130 379,045.26 6,543.34 1,895.23 8,438.57 372,501.92
131 372,501.92 6,576.06 1,862.51 8,438.57 365,925.86
132 365,925.86 6,608.94 1,829.63 8,438.57 359,316.92
133 359,316.92 6,641.98 1,796.58 8,438.57 352,674.94
134 352,674.94 6,675.19 1,763.37 8,438.57 345,999.74
135 345,999.74 6,708.57 1,730.00 8,438.57 339,291.17
136 339,291.17 6,742.11 1,696.46 8,438.57 332,549.06
137 332,549.06 6,775.82 1,662.75 8,438.57 325,773.24
138 325,773.24 6,809.70 1,628.87 8,438.57 318,963.53
139 318,963.53 6,843.75 1,594.82 8,438.57 312,119.78
140 312,119.78 6,877.97 1,560.60 8,438.57 305,241.81
141 305,241.81 6,912.36 1,526.21 8,438.57 298,329.46
142 298,329.46 6,946.92 1,491.65 8,438.57 291,382.53
143 291,382.53 6,981.66 1,456.91 8,438.57 284,400.88
144 284,400.88 7,016.56 1,422.00 8,438.57 277,384.31
145 277,384.31 7,051.65 1,386.92 8,438.57 270,332.67
146 270,332.67 7,086.90 1,351.66 8,438.57 263,245.76
147 263,245.76 7,122.34 1,316.23 8,438.57 256,123.42
148 256,123.42 7,157.95 1,280.62 8,438.57 248,965.47
149 248,965.47 7,193.74 1,244.83 8,438.57 241,771.73
150 241,771.73 7,229.71 1,208.86 8,438.57 234,542.02
151 234,542.02 7,265.86 1,172.71 8,438.57 227,276.16
152 227,276.16 7,302.19 1,136.38 8,438.57 219,973.98
153 219,973.98 7,338.70 1,099.87 8,438.57 212,635.28
154 212,635.28 7,375.39 1,063.18 8,438.57 205,259.89
155 205,259.89 7,412.27 1,026.30 8,438.57 197,847.62
156 197,847.62 7,449.33 989.24 8,438.57 190,398.29
157 190,398.29 7,486.58 951.99 8,438.57 182,911.71
158 182,911.71 7,524.01 914.56 8,438.57 175,387.70
159 175,387.70 7,561.63 876.94 8,438.57 167,826.07
160 167,826.07 7,599.44 839.13 8,438.57 160,226.63
161 160,226.63 7,637.44 801.13 8,438.57 152,589.20
162 152,589.20 7,675.62 762.95 8,438.57 144,913.58
163 144,913.58 7,714.00 724.57 8,438.57 137,199.58
164 137,199.58 7,752.57 686.00 8,438.57 129,447.00
165 129,447.00 7,791.33 647.24 8,438.57 121,655.67
166 121,655.67 7,830.29 608.28 8,438.57 113,825.38
167 113,825.38 7,869.44 569.13 8,438.57 105,955.94
168 105,955.94 7,908.79 529.78 8,438.57 98,047.15
169 98,047.15 7,948.33 490.24 8,438.57 90,098.82
170 90,098.82 7,988.07 450.49 8,438.57 82,110.74
171 82,110.74 8,028.01 410.55 8,438.57 74,082.73
172 74,082.73 8,068.15 370.41 8,438.57 66,014.58
173 66,014.58 8,108.50 330.07 8,438.57 57,906.08
174 57,906.08 8,149.04 289.53 8,438.57 49,757.04
175 49,757.04 8,189.78 248.79 8,438.57 41,567.26
176 41,567.26 8,230.73 207.84 8,438.57 33,336.53
177 33,336.53 8,271.89 166.68 8,438.57 25,064.64
178 25,064.64 8,313.25 125.32 8,438.57 16,751.40
179 16,751.40 8,354.81 83.76 8,438.57 8,396.59
180 8,396.59 8,396.59 41.98 8,438.57 0.00

两种还款方式比较分析

月还款利息对比

df = rbind(df1, df2)
df %>% 
  ggplot(aes(`还款期次`, `应还利息`, color = `还款方式`)) + 
  geom_line(linewidth = 0.8) + 
  theme(
    legend.title = element_blank(),
    legend.position = "inside",
    legend.position.inside = c(0.89, 0.87)
  )

从上图我们可以可以清洗地发现:等额本金累计还利息比等额本息方式少。 统计结果显示: 等额本金累计还利息452500.00元, 等额本息累计还利息518942.29元, 两者相差66442.29元。

月还本息对比

df %>% 
  ggplot(aes(`还款期次`, `应还本息`, color = `还款方式`)) + 
  geom_line(linewidth = 0.8) + 
  theme(
    legend.title = element_blank(),
    legend.position = "inside",
    legend.position.inside = c(0.89, 0.87)
  )

从图上可以看出,等额本金还款模式前期还款压力较大,后期还款压力逐渐递减,等额本息模式每期还款压力不变。

红线与坐标轴围成的面积即为等额本金下还款总额。同理,蓝线与坐标轴围成的面积即为等额本息下还款总额;很明显蓝线围成的面积更大,即等额本息还款总额较多。

还款总额对比

df %>% 
  group_by(`还款方式`) %>% 
  summarise(`还款总额` = round(sum(`应还本息`), 2)) %>% 
  ggplot(aes(`还款方式`, `还款总额`, fill = `还款方式`)) + 
  geom_bar(stat = "identity") + 
  geom_text(aes(label = `还款总额`), vjust = -0.3) + 
  xlab("")  + 
  guides(fill = "none")

从总还款额同样也能清晰地看出等额本金累计还利息比等额本息方式少。