loading packages and data

    from the  histgrams we can see that a lot of variables are not normally ditributed, thus we took log of these variables. 

we ts the variables after take log

suntrust_data$log_interest.income <- log(suntrust_data$total.interest.income)
suntrust_data$log_interest.expense <- log(suntrust_data$total.interest.expense)
suntrust_data$log_noninterest.expense <- log(suntrust_data$total.noninterest.expense)
suntrust_data$log_noninterest.income <- log(suntrust_data$total.noninterest.income)
suntrust_data$log_alll <- log(suntrust_data$provision.ALLL)
## Warning in log(suntrust_data$provision.ALLL): 产生了NaNs
suntrust_data$log_house.price.index..level. <- log(suntrust_data$house.price.index..level.)
suntrust_data$log_unemployment.rate <- log(suntrust_data$unemployment.rate)
suntrust_data$log_mortgage.rate <- log(suntrust_data$mortgage.rate)
suntrust_data$log_DJ.index <- log(suntrust_data$dow.jones.total.stock.market.index..level.)
suntrust_data$log_10treasury.yield <- log(suntrust_data$x10.year.treasury.yield)
suntrust_data$log_5treasury.yield <- log(suntrust_data$x5.year.treasury.yield)
suntrust_data$log_3treasury.yield <- log(suntrust_data$x3.month.treasury.rate)
suntrust_data$log_bbb <- log(suntrust_data$bbb.corporate.yield)
suntrust_data$market.returns <- diff(suntrust_data$dow.jones.total.stock.market.index..level.)
## Warning in `[<-.data.table`(x, j = name, value = value): Supplied 103 items
## to be assigned to 104 items of column 'market.returns' (recycled leaving
## remainder of 1 items).
jpmorgan_data$log_interest.income <- log(jpmorgan_data$total.interest.income)
jpmorgan_data$log_interest.expense <- log(jpmorgan_data$total.interest.expense)
jpmorgan_data$log_noninterest.expense <- log(jpmorgan_data$total.noninterest.expense)
jpmorgan_data$log_noninterest.income <- log(jpmorgan_data$total.noninterest.income)
jpmorgan_data$log_alll <- log(jpmorgan_data$provision.ALLL)
## Warning in log(jpmorgan_data$provision.ALLL): 产生了NaNs
jpmorgan_data$log_house.price.index..level. <- log(jpmorgan_data$house.price.index..level.)
jpmorgan_data$log_unemployment.rate <- log(jpmorgan_data$unemployment.rate)
jpmorgan_data$log_mortgage.rate <- log(jpmorgan_data$mortgage.rate)
jpmorgan_data$log_DJ.index <- log(jpmorgan_data$dow.jones.total.stock.market.index..level.)
jpmorgan_data$log_10treasury.yield <- log(jpmorgan_data$x10.year.treasury.yield)
jpmorgan_data$log_5treasury.yield <- log(jpmorgan_data$x5.year.treasury.yield)
jpmorgan_data$log_3treasury.yield <- log(jpmorgan_data$x3.month.treasury.rate)
jpmorgan_data$log_bbb <- log(jpmorgan_data$bbb.corporate.yield)
jpmorgan_data$market.returns <- diff(jpmorgan_data$dow.jones.total.stock.market.index..level.)
## Warning in `[<-.data.table`(x, j = name, value = value): Supplied 103 items
## to be assigned to 104 items of column 'market.returns' (recycled leaving
## remainder of 1 items).
suntrust_data <- na.omit(suntrust_data)
jpmorgan_data <- na.omit(jpmorgan_data)

suntrust_ts <- ts(suntrust_data,start = c(1990), frequency = 4)
jpmorgan_ts <- ts(jpmorgan_data,start = c(1990), frequency = 4)

fit models for total interest income. The candidate macro-indicators are : treasury bbb and mortgage(we have problems here because these three variable’s correlation level are high, “> 0.8”)

JP.intinc_model1 <- tslm(log_interest.income ~ 
                           log_10treasury.yield +
                           log_bbb +
                           log_mortgage.rate, 
                         data = jpmorgan_ts)
summary(JP.intinc_model1)
## 
## Call:
## tslm(formula = log_interest.income ~ log_10treasury.yield + log_bbb + 
##     log_mortgage.rate, data = jpmorgan_ts)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.9641 -0.3911 -0.0294  0.2527  1.4531 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           20.0572     1.0010  20.038  < 2e-16 ***
## log_10treasury.yield   0.7308     0.8128   0.899  0.37073    
## log_bbb                1.0640     0.5286   2.013  0.04685 *  
## log_mortgage.rate     -4.0459     1.3671  -2.959  0.00386 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5093 on 99 degrees of freedom
## Multiple R-squared:  0.5959, Adjusted R-squared:  0.5836 
## F-statistic: 48.66 on 3 and 99 DF,  p-value: < 2.2e-16
ST.intinc_model1 <- tslm(log_interest.income ~ 
                            log_10treasury.yield +
                            log_bbb +
                            log_mortgage.rate, 
                          data = suntrust_ts)
summary(ST.intinc_model1)
## 
## Call:
## tslm(formula = log_interest.income ~ log_10treasury.yield + log_bbb + 
##     log_mortgage.rate, data = suntrust_ts)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.5900 -0.2784 -0.1011  0.2616  0.8575 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           14.7532     0.7388  19.970   <2e-16 ***
## log_10treasury.yield  -0.4302     0.5993  -0.718    0.475    
## log_bbb                0.3128     0.3903   0.802    0.425    
## log_mortgage.rate     -0.3590     1.0079  -0.356    0.722    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3755 on 99 degrees of freedom
## Multiple R-squared:  0.2586, Adjusted R-squared:  0.2361 
## F-statistic: 11.51 on 3 and 99 DF,  p-value: 1.548e-06
 The 10 year Treasury yield is not significant for the regression model, so we will use the 5 year Treasury yield. We tried using the 3 month treasury rate because after we took log of it, it has "-inf" because you can't take the log of zero, and also the distribution does not improve by taking log. So we will choose 5 year for treasury. 
 
JP.intinc_model2 <- tslm(log_interest.income ~ 
                           log_5treasury.yield+
                           log_bbb+
                           log_mortgage.rate,
                         data = jpmorgan_ts)
summary(JP.intinc_model2)
## 
## Call:
## tslm(formula = log_interest.income ~ log_5treasury.yield + log_bbb + 
##     log_mortgage.rate, data = jpmorgan_ts)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.96984 -0.29034 -0.01024  0.23475  1.37194 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          22.9116     0.8779  26.097  < 2e-16 ***
## log_5treasury.yield   1.5095     0.3277   4.606 1.22e-05 ***
## log_bbb               2.1250     0.5341   3.978 0.000132 ***
## log_mortgage.rate    -7.1432     1.0099  -7.074 2.18e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4641 on 99 degrees of freedom
## Multiple R-squared:  0.6645, Adjusted R-squared:  0.6543 
## F-statistic: 65.36 on 3 and 99 DF,  p-value: < 2.2e-16
checkresiduals(JP.intinc_model2)

## 
##  Breusch-Godfrey test for serial correlation of order up to 8
## 
## data:  Residuals from Linear regression model
## LM test = 70.247, df = 8, p-value = 4.388e-12
ST.intinc_model2 <- tslm(log_interest.income ~ 
                            log_5treasury.yield+
                            log_bbb+
                            log_mortgage.rate,
                          data = suntrust_ts)
summary(ST.intinc_model2)
## 
## Call:
## tslm(formula = log_interest.income ~ log_5treasury.yield + log_bbb + 
##     log_mortgage.rate, data = suntrust_ts)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.64228 -0.23368 -0.05948  0.19434  0.88319 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          17.5951     0.6630  26.540  < 2e-16 ***
## log_5treasury.yield   0.9620     0.2467   3.899 0.000176 ***
## log_bbb               1.1097     0.4037   2.749 0.007109 ** 
## log_mortgage.rate    -3.7619     0.7618  -4.938  3.2e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3505 on 99 degrees of freedom
## Multiple R-squared:  0.3539, Adjusted R-squared:  0.3343 
## F-statistic: 18.08 on 3 and 99 DF,  p-value: 1.969e-09
checkresiduals(ST.intinc_model2)

## 
##  Breusch-Godfrey test for serial correlation of order up to 8
## 
## data:  Residuals from Linear regression model
## LM test = 84.623, df = 8, p-value = 5.711e-15
X5 Treasury works better for both model. but suffer from autocorrelation. 

hope to get the correlation data from Ivan. Try with eliminating morgate. but failed it performs bad on both dataset.

JP.intinc_model3 <- tslm(log_interest.income ~ 
                           log_5treasury.yield+
                           log_bbb,
                         data = jpmorgan_ts)
summary(JP.intinc_model3)
## 
## Call:
## tslm(formula = log_interest.income ~ log_5treasury.yield + log_bbb, 
##     data = jpmorgan_ts)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.99003 -0.47711 -0.02454  0.33264  1.43348 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          17.9275     0.6394  28.038  < 2e-16 ***
## log_5treasury.yield  -0.6136     0.1607  -3.818 0.000233 ***
## log_bbb              -0.7332     0.4265  -1.719 0.088671 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5666 on 100 degrees of freedom
## Multiple R-squared:  0.4949, Adjusted R-squared:  0.4848 
## F-statistic: 48.99 on 2 and 100 DF,  p-value: 1.473e-15
checkresiduals(JP.intinc_model3)

## 
##  Breusch-Godfrey test for serial correlation of order up to 8
## 
## data:  Residuals from Linear regression model
## LM test = 81.349, df = 8, p-value = 2.616e-14
ST.intinc_model3 <- tslm(log_interest.income ~ 
                           log_5treasury.yield+
                           log_bbb,
                         data = suntrust_ts)
summary(ST.intinc_model3)
## 
## Call:
## tslm(formula = log_interest.income ~ log_5treasury.yield + log_bbb, 
##     data = suntrust_ts)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.6568 -0.2695 -0.1481  0.3093  0.8433 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          14.9697     0.4400  34.022   <2e-16 ***
## log_5treasury.yield  -0.1534     0.1103  -1.390    0.168    
## log_bbb              -0.3973     0.2936  -1.353    0.179    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3894 on 100 degrees of freedom
## Multiple R-squared:  0.1948, Adjusted R-squared:  0.1787 
## F-statistic: 12.09 on 2 and 100 DF,  p-value: 1.978e-05
checkresiduals(ST.intinc_model3)

## 
##  Breusch-Godfrey test for serial correlation of order up to 8
## 
## data:  Residuals from Linear regression model
## LM test = 92.497, df = 8, p-value < 2.2e-16

try to eliminate autocorrelation by subset the recent years, after 2009 because of the big economic recession

JP.ts <- window(jpmorgan_ts, start  = c(2009))
ST.ts <- window(suntrust_ts, start = c(2009))

JP.intinc_model2s <- tslm(log_interest.income ~ 
                           log_bbb+
                           log_mortgage.rate,
                         data = JP.ts)
summary(JP.intinc_model2s)
## 
## Call:
## tslm(formula = log_interest.income ~ log_bbb + log_mortgage.rate, 
##     data = JP.ts)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.091885 -0.044358 -0.008604  0.049843  0.079606 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       15.72839    0.13210 119.061  < 2e-16 ***
## log_bbb            0.36068    0.09764   3.694  0.00114 ** 
## log_mortgage.rate  0.12448    0.16403   0.759  0.45532    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.05508 on 24 degrees of freedom
## Multiple R-squared:  0.7409, Adjusted R-squared:  0.7193 
## F-statistic: 34.32 on 2 and 24 DF,  p-value: 9.14e-08
checkresiduals(JP.intinc_model2s)

## 
##  Breusch-Godfrey test for serial correlation of order up to 6
## 
## data:  Residuals from Linear regression model
## LM test = 17.86, df = 6, p-value = 0.006591
ST.intinc_model2s <- tslm(log_interest.income ~ 
                           log_bbb+
                           log_mortgage.rate,
                         data = ST.ts)
summary(ST.intinc_model2s)
## 
## Call:
## tslm(formula = log_interest.income ~ log_bbb + log_mortgage.rate, 
##     data = ST.ts)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.083566 -0.051927  0.003078  0.039518  0.084035 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)        13.6057     0.1244 109.351  < 2e-16 ***
## log_bbb             0.4665     0.1221   3.820 0.000829 ***
## log_mortgage.rate  -0.1045     0.1750  -0.597 0.555844    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.05204 on 24 degrees of freedom
## Multiple R-squared:  0.6619, Adjusted R-squared:  0.6337 
## F-statistic: 23.49 on 2 and 24 DF,  p-value: 2.233e-06
checkresiduals(ST.intinc_model2s)

## 
##  Breusch-Godfrey test for serial correlation of order up to 6
## 
## data:  Residuals from Linear regression model
## LM test = 17.477, df = 6, p-value = 0.00768

same procedures for interest expense. Results similar to interest income. Just pose model2 and model 2s

JP.intex_model2s <- tslm(log_interest.expense ~ 
                            log_bbb+
                            log_mortgage.rate,
                          data = JP.ts)
summary(JP.intex_model2s)
## 
## Call:
## tslm(formula = log_interest.expense ~ log_bbb + log_mortgage.rate, 
##     data = JP.ts)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.29899 -0.14288 -0.00063  0.15666  0.31808 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)        13.2375     0.4393  30.134  < 2e-16 ***
## log_bbb             0.9969     0.3247   3.070  0.00525 ** 
## log_mortgage.rate  -0.0193     0.5454  -0.035  0.97206    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1831 on 24 degrees of freedom
## Multiple R-squared:  0.5819, Adjusted R-squared:  0.5471 
## F-statistic:  16.7 on 2 and 24 DF,  p-value: 2.849e-05
checkresiduals(JP.intex_model2s)

## 
##  Breusch-Godfrey test for serial correlation of order up to 6
## 
## data:  Residuals from Linear regression model
## LM test = 22.008, df = 6, p-value = 0.001207
ST.intex_model2s <- tslm(log_interest.expense ~ 
                            log_bbb+
                            log_mortgage.rate,
                          data = ST.ts)
summary(ST.intex_model2s)
## 
## Call:
## tslm(formula = log_interest.expense ~ log_bbb + log_mortgage.rate, 
##     data = ST.ts)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.50986 -0.11859  0.07334  0.17587  0.41395 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)        8.16487    0.64096  12.738  3.6e-12 ***
## log_bbb            2.60588    0.62906   4.142 0.000367 ***
## log_mortgage.rate -0.01045    0.90155  -0.012 0.990846    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2681 on 24 degrees of freedom
## Multiple R-squared:  0.7532, Adjusted R-squared:  0.7326 
## F-statistic: 36.62 on 2 and 24 DF,  p-value: 5.111e-08
checkresiduals(ST.intex_model2s)

## 
##  Breusch-Godfrey test for serial correlation of order up to 6
## 
## data:  Residuals from Linear regression model
## LM test = 17.086, df = 6, p-value = 0.008971

models for noninterest income and noninterest expense. candidate variables are: GDP, market volatiliry, stock returns, home price growth. Still working on how to calculate market return on r. models for noninterest income

JP.noninc_model1 <- tslm(log_noninterest.income ~  
                            log_house.price.index..level. +
                          real.gdp.growth +
                           market.volatility.index..level. ,data = JP.ts)
summary(JP.noninc_model1)
## 
## Call:
## tslm(formula = log_noninterest.income ~ log_house.price.index..level. + 
##     real.gdp.growth + market.volatility.index..level., data = JP.ts)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.23984 -0.05411  0.01562  0.06648  0.11720 
## 
## Coefficients:
##                                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     17.157813   0.955843  17.950 5.03e-15 ***
## log_house.price.index..level.   -0.112051   0.185614  -0.604  0.55196    
## real.gdp.growth                 -0.017931   0.008315  -2.157  0.04174 *  
## market.volatility.index..level. -0.007920   0.001838  -4.310  0.00026 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.08667 on 23 degrees of freedom
## Multiple R-squared:  0.4679, Adjusted R-squared:  0.3986 
## F-statistic: 6.743 on 3 and 23 DF,  p-value: 0.001989
checkresiduals(JP.noninc_model1)

## 
##  Breusch-Godfrey test for serial correlation of order up to 7
## 
## data:  Residuals from Linear regression model
## LM test = 5.4626, df = 7, p-value = 0.6037
ST.noninc_model1 <- tslm(log_noninterest.income ~  
                           log_house.price.index..level. +
                        real.gdp.growth +
                        market.volatility.index..level. ,data = ST.ts)
summary(ST.noninc_model1)
## 
## Call:
## tslm(formula = log_noninterest.income ~ log_house.price.index..level. + 
##     real.gdp.growth + market.volatility.index..level., data = ST.ts)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.31568 -0.08019  0.03505  0.07509  0.27381 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     12.5803540  1.6559363   7.597 1.03e-07 ***
## log_house.price.index..level.    0.2128301  0.3212458   0.663    0.514    
## real.gdp.growth                 -0.0132311  0.0174621  -0.758    0.456    
## market.volatility.index..level.  0.0006994  0.0034006   0.206    0.839    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1482 on 23 degrees of freedom
## Multiple R-squared:  0.03791,    Adjusted R-squared:  -0.08759 
## F-statistic: 0.3021 on 3 and 23 DF,  p-value: 0.8236
checkresiduals(ST.noninc_model1)

## 
##  Breusch-Godfrey test for serial correlation of order up to 7
## 
## data:  Residuals from Linear regression model
## LM test = 11.445, df = 7, p-value = 0.1203

models for noninterest expense

JP.nonex_model1 <- tslm(log_noninterest.expense ~  
                           real.gdp.growth +
                           log_house.price.index..level. +
                           market.volatility.index..level. ,data = JP.ts)
summary(JP.nonex_model1)
## 
## Call:
## tslm(formula = log_noninterest.expense ~ real.gdp.growth + log_house.price.index..level. + 
##     market.volatility.index..level., data = JP.ts)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.226433 -0.033077  0.009602  0.030898  0.160066 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     17.7907742  0.8167915  21.781   <2e-16 ***
## real.gdp.growth                  0.0005766  0.0071051   0.081   0.9360    
## log_house.price.index..level.   -0.2263870  0.1586114  -1.427   0.1669    
## market.volatility.index..level. -0.0041213  0.0015704  -2.624   0.0152 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.07407 on 23 degrees of freedom
## Multiple R-squared:  0.2566, Adjusted R-squared:  0.1597 
## F-statistic: 2.647 on 3 and 23 DF,  p-value: 0.07307
checkresiduals(JP.nonex_model1)

## 
##  Breusch-Godfrey test for serial correlation of order up to 7
## 
## data:  Residuals from Linear regression model
## LM test = 3.2363, df = 7, p-value = 0.8623
ST.nonex_model1 <- tslm(log_noninterest.expense ~  
                           log_house.price.index..level. +
                        real.gdp.growth +
                        market.volatility.index..level. ,data = ST.ts)
summary(ST.nonex_model1)
## 
## Call:
## tslm(formula = log_noninterest.expense ~ log_house.price.index..level. + 
##     real.gdp.growth + market.volatility.index..level., data = ST.ts)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.11339 -0.03249 -0.01744  0.03330  0.19277 
## 
## Coefficients:
##                                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     16.520211   0.799043  20.675 2.34e-16 ***
## log_house.price.index..level.   -0.452676   0.155011  -2.920   0.0077 ** 
## real.gdp.growth                  0.004403   0.008426   0.523   0.6063    
## market.volatility.index..level. -0.001615   0.001641  -0.984   0.3354    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.0715 on 23 degrees of freedom
## Multiple R-squared:  0.2726, Adjusted R-squared:  0.1778 
## F-statistic: 2.874 on 3 and 23 DF,  p-value: 0.05824
checkresiduals(ST.nonex_model1)

## 
##  Breusch-Godfrey test for serial correlation of order up to 7
## 
## data:  Residuals from Linear regression model
## LM test = 4.2816, df = 7, p-value = 0.7468
Since using recent data can help reduce autocorrelatioins. I directly use those data to fit models.(I actually run the regression of the whole time, ST.ts and JP.ts still win. So I didn't pose them.)  gdp performs bad on this model. Mayve need stock returns.

models for Provisions for loan & lease Loss. Candidates: real.gdp, 5 treasury, mortgage, bbb

JP.alll_model1 <- tslm(log_alll ~ real.gdp.growth +
                         log_10treasury.yield +
                         log_mortgage.rate +
                         log_bbb, data = JP.ts)
summary(JP.alll_model1)
## 
## Call:
## tslm(formula = log_alll ~ real.gdp.growth + log_10treasury.yield + 
##     log_mortgage.rate + log_bbb, data = JP.ts)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.8081 -0.3024  0.2332  0.6649  1.5575 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)
## (Intercept)           9.09838   11.59956   0.784    0.441
## real.gdp.growth       0.05271    0.13330   0.395    0.696
## log_10treasury.yield  1.88541    5.08345   0.371    0.714
## log_mortgage.rate    -3.03761   13.35666  -0.227    0.822
## log_bbb               4.62754    2.93981   1.574    0.130
## 
## Residual standard error: 1.201 on 22 degrees of freedom
## Multiple R-squared:  0.4513, Adjusted R-squared:  0.3516 
## F-statistic: 4.524 on 4 and 22 DF,  p-value: 0.008091
checkresiduals(JP.alll_model1)

## 
##  Breusch-Godfrey test for serial correlation of order up to 8
## 
## data:  Residuals from Linear regression model
## LM test = 10.384, df = 8, p-value = 0.2391
ST.alll_model1 <- tslm(log_alll ~ real.gdp.growth +
                         log_10treasury.yield +
                         log_mortgage.rate+
                         log_bbb, data = ST.ts)
summary(ST.alll_model1)
## 
## Call:
## tslm(formula = log_alll ~ real.gdp.growth + log_10treasury.yield + 
##     log_mortgage.rate + log_bbb, data = ST.ts)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.8515 -0.5873  0.1372  0.6997  1.2682 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)  
## (Intercept)            0.9852     8.1529   0.121    0.905  
## real.gdp.growth       -0.0525     0.1076  -0.488    0.630  
## log_10treasury.yield  -2.3906     3.5883  -0.666    0.512  
## log_mortgage.rate      4.6752     9.3802   0.498    0.623  
## log_bbb                4.4200     2.3388   1.890    0.072 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8872 on 22 degrees of freedom
## Multiple R-squared:  0.4751, Adjusted R-squared:  0.3796 
## F-statistic: 4.978 on 4 and 22 DF,  p-value: 0.00519
checkresiduals(ST.alll_model1)

## 
##  Breusch-Godfrey test for serial correlation of order up to 8
## 
## data:  Residuals from Linear regression model
## LM test = 17.667, df = 8, p-value = 0.02387

models for aggregate loss

y9c <- read_xlsx("Y9C_banks_all_data_v13.xlsx")
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits, shim =
## shim, : Expecting logical in CJL1085 / R1085C2300: got 'LOANS'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits,
## shim = shim, : Expecting logical in CJS1131 / R1131C2307: got 'NON-CASH
## COLLATERAL'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits, shim =
## shim, : Expecting logical in CJS1153 / R1153C2307: got 'ACCOUNTS PAYABLE'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits,
## shim = shim, : Expecting logical in CJS1161 / R1161C2307: got 'NON-CASH
## COLLATERAL'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits, shim =
## shim, : Expecting logical in CJL1175 / R1175C2300: got 'LOANS'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits, shim =
## shim, : Expecting logical in CJS1183 / R1183C2307: got 'ACCOUNTS PAYABLE'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits, shim
## = shim, : Expecting logical in CJS1191 / R1191C2307: got 'SWAPS USED FOR
## HEDGING ACTIVITIES'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits,
## shim = shim, : Expecting logical in CJS1221 / R1221C2307: got 'NON-CASH
## COLLATERAL'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits,
## shim = shim, : Expecting logical in CJS1251 / R1251C2307: got 'NON-CASH
## COLLATERAL'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits, shim =
## shim, : Expecting logical in CJL1265 / R1265C2300: got 'LOANS'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits,
## shim = shim, : Expecting logical in CJS1281 / R1281C2307: got 'NON-CASH
## COLLATERAL'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits, shim =
## shim, : Expecting logical in CJL1295 / R1295C2300: got 'LOANS'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits,
## shim = shim, : Expecting logical in CJS1312 / R1312C2307: got 'NON-CASH
## COLLATERAL'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits, shim
## = shim, : Expecting logical in CJL1357 / R1357C2300: got 'FAIR VALUE OF
## UNFUNDED COMMITMENTS'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits, shim =
## shim, : Expecting logical in CJL1388 / R1388C2300: got 'LOANS'
## Warning in read_fun(path = path, sheet_i = sheet, limits = limits, shim
## = shim, : Expecting logical in CJS1408 / R1408C2307: got 'CONTINGENT
## CONSIDERATION'
suntrust_loss <- subset(y9c, y9c[,1] == "1131787")
jpmorgan_loss <- subset(y9c, y9c[,1] == "1039502")
rm(y9c)
suntrust_loss <- suntrust_loss[,"bhck4635"]
jpmorgan_loss <- jpmorgan_loss[,"bhck4635"]

par(mfrow = c(1,2))
hist(suntrust_loss$bhck4635)
hist(jpmorgan_loss$bhck4635)

suntrust_loss$log_aggregate.loss <- log(suntrust_loss$bhck4635)
jpmorgan_loss$log_aggregate.loss <- log(jpmorgan_loss$bhck4635)


suntrust_loss_ts <- ts(suntrust_loss, start =c(2000,1), frequency = 4)
jpmorgan_loss_ts <- ts(jpmorgan_loss, start =c(2000,1), frequency = 4)

suntrust_loss.ts <- window(suntrust_loss_ts, start = c(2009))
jpmorgan_loss.ts  <- window(jpmorgan_loss_ts, start = c(2009))
suntrust_new <- cbind(ST.ts, suntrust_loss.ts)
jpmorgan_new <- cbind(JP.ts, jpmorgan_loss.ts)

suntrust_new <- na.omit(suntrust_new)
jpmorgan_new <- na.omit(jpmorgan_new)

colnames(jpmorgan_new)[36] <- "log_bbb"
colnames(jpmorgan_new)[31] <- "log_mortgage.rate"
colnames(jpmorgan_new)[34] <- "log_5treasury.yield"

colnames(suntrust_new)[36] <- "log_bbb"
colnames(suntrust_new)[31] <- "log_mortgage.rate"
colnames(suntrust_new)[34] <- "log_5treasury.yield"
JP.loss_model1 <- tslm(jpmorgan_loss.ts.log_aggregate.loss ~
                         log_5treasury.yield +
                         log_bbb +
                         log_mortgage.rate, data = jpmorgan_new)
summary(JP.loss_model1)
## 
## Call:
## tslm(formula = jpmorgan_loss.ts.log_aggregate.loss ~ log_5treasury.yield + 
##     log_bbb + log_mortgage.rate, data = jpmorgan_new)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.60463 -0.41286  0.01571  0.37775  1.01968 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)   
## (Intercept)           6.5251     2.8756   2.269  0.03295 * 
## log_5treasury.yield  -1.6991     0.6485  -2.620  0.01531 * 
## log_bbb              -1.8443     1.2028  -1.533  0.13886   
## log_mortgage.rate     8.9449     3.0188   2.963  0.00697 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6302 on 23 degrees of freedom
## Multiple R-squared:  0.3133, Adjusted R-squared:  0.2238 
## F-statistic: 3.499 on 3 and 23 DF,  p-value: 0.03171
checkresiduals((JP.loss_model1))

## 
##  Breusch-Godfrey test for serial correlation of order up to 7
## 
## data:  Residuals from Linear regression model
## LM test = 18.057, df = 7, p-value = 0.01172
ST.loss_model1 <- tslm(suntrust_loss.ts.log_aggregate.loss ~
                         log_5treasury.yield +
                         log_bbb +
                         log_mortgage.rate, data = suntrust_new)
summary(ST.loss_model1)
## 
## Call:
## tslm(formula = suntrust_loss.ts.log_aggregate.loss ~ log_5treasury.yield + 
##     log_bbb + log_mortgage.rate, data = suntrust_new)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.4230 -0.4269  0.1171  0.4512  0.8464 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)   
## (Intercept)           3.5301     2.8881   1.222   0.2340   
## log_5treasury.yield  -2.3799     0.6554  -3.631   0.0014 **
## log_bbb              -0.4052     1.5863  -0.255   0.8006   
## log_mortgage.rate     8.1975     3.2494   2.523   0.0190 * 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6405 on 23 degrees of freedom
## Multiple R-squared:  0.4005, Adjusted R-squared:  0.3223 
## F-statistic: 5.121 on 3 and 23 DF,  p-value: 0.007357
checkresiduals((ST.loss_model1))

## 
##  Breusch-Godfrey test for serial correlation of order up to 7
## 
## data:  Residuals from Linear regression model
## LM test = 15.496, df = 7, p-value = 0.03014

Forecasting for each model

setting the scenario based on DFAST

indicators$log_house.price.index..level. <- log(indicators$house.price.index..level.)
indicators$log_unemployment.rate <- log(indicators$unemployment.rate)
indicators$log_mortgage.rate <- log(indicators$mortgage.rate)
indicators$log_DJ.index <- log(indicators$dow.jones.total.stock.market.index..level.)
indicators$log_10treasury.yield <- log(indicators$x10.year.treasury.yield)
indicators$log_5treasury.yield <- log(indicators$x5.year.treasury.yield)
indicators$log_3treasury.yield <- log(indicators$x3.month.treasury.rate)
## Warning in log(indicators$x3.month.treasury.rate): 产生了NaNs
indicators$log_bbb <- log(indicators$bbb.corporate.yield)

indicators_ts <- ts(indicators, start = c(1976,1), frequency = 4)



scenario.ts <- window(indicators_ts,  start = c(2016),h = 8)
scenario <- as.data.table(scenario.ts)
scenario[1,9] = 0.1
scenario$log_5treasury.yield = log(scenario$x5.year.treasury.yield)
We change the scenario parameter of the 5 treasury, because the log of 0 would not be infinite and thus to eliminate the disastered influence on our forecast.

forecast for interest income of JP and ST

JP.intinc_model2s_fc <- forecast(JP.intinc_model2s, newdata = scenario, h=8)
autoplot(JP.intinc_model2s_fc) +
  ggtitle("Forecasting Interest Income for JPmorgan") +
  ylab("Log_interest.income") +
  xlab("Time")

JP_intinc_forecast <- data.frame(JP.intinc_model2s_fc)
tsJP_intinc_forecast <- ts(JP_intinc_forecast, start = c(2016,1), frequency = 4)
JP.intinc_fc <- as.data.table(tsJP_intinc_forecast)
ST.intinc_model2s_fc <- forecast(ST.intinc_model2s, newdata = scenario, h=8)
autoplot(ST.intinc_model2s_fc) +
  ggtitle("Forecasting Interest Income for SunTrust") +
  ylab("log_interest.income") +
  xlab("Time")

ST_intinc_forecast <- data.frame(ST.intinc_model2s_fc)
tsST_intinc_forecast <- ts(ST_intinc_forecast, start = c(2016,1), frequency = 4)
ST.intinc_fc <- as.data.table(tsST_intinc_forecast)

forestcast for interest expense of JP and ST

JP.intex_model2s_fc <- forecast(JP.intex_model2s, newdata = scenario, h=8)
autoplot(JP.intex_model2s_fc) +
  ggtitle("Forecasting Interest Expense of JPmorgan") +
  ylab("Log_interest.expense") +
  xlab("Time")

JP_intex_forecast <- data.frame(JP.intex_model2s_fc)
tsJP_intex_forecast <- ts(JP_intex_forecast, start = c(2016,1), frequency = 4)
JP.intex_fc <- as.data.table(tsJP_intex_forecast)
ST.intex_model2s_fc <- forecast(ST.intex_model2s, newdata = scenario, h=8)
autoplot(ST.intex_model2s_fc) +
  ggtitle("Forecasting for Interest Expense for SunTrust") +
  ylab("Log_interest.expense") +
  xlab("Time")

ST_intex_forecast <- data.frame(ST.intex_model2s_fc)
tsST_intex_forecast <- ts(ST_intex_forecast, start = c(2016,1), frequency = 4)
ST.intex_fc <- as.data.table(tsST_intex_forecast)

forecasr for noninterest income

JP.noninc_model1_fc <- forecast(JP.noninc_model1, newdata = scenario, h=8)
autoplot(JP.noninc_model1_fc) +
  ggtitle("Forecasting Noninterest Income for JPmorgan") +
  ylab("Log_noninterest.income") +
  xlab("Time")

JP_noninc_forecast <- data.frame(JP.noninc_model1_fc)
tsJP_noninc_forecast <- ts(JP_noninc_forecast, start = c(2016,1), frequency = 4)
JP.noninc_fc <- as.data.table(tsJP_noninc_forecast)
ST.noninc_model1_fc <- forecast(ST.noninc_model1, newdata = scenario, h=8)
autoplot(ST.noninc_model1_fc) +
  ggtitle("Forecasting Noninterest Income for SunTrust") +
  ylab("Log_noninterest.income") +
  xlab("Time")

ST_noninc_forecast <- data.frame(ST.noninc_model1_fc)
tsST_noninc_forecast <- ts(ST_noninc_forecast, start = c(2016,1), frequency = 4)
ST.noninc_fc <- as.data.table(ST_noninc_forecast)

forecast for noninerest expense

JP.nonex_model1_fc <- forecast(JP.nonex_model1, newdata = scenario, h=8)
autoplot(JP.noninc_model1_fc) +
  ggtitle("Forecasting Noninterest Expense for JPmorgan") +
  ylab("Log_noninterest.expense") +
  xlab("Time")

JP_nonex_forecast <- data.frame(JP.nonex_model1_fc)
tsJP_nonex_forecast <- ts(JP_nonex_forecast, start = c(2016,1), frequency = 4)
JP.nonex_fc <- as.data.table(tsJP_nonex_forecast)
ST.nonex_model1_fc <- forecast(ST.nonex_model1, newdata = scenario, h=8)
autoplot(ST.nonex_model1_fc) +
   ggtitle("Forecasting for Interest Expense for SunTrust") +
  ylab("Log_noninterest.expense") +
  xlab("Time")

ST_nonex_forecast <- data.frame(ST.nonex_model1_fc)
tsST_nonex_forecast <- ts(ST_nonex_forecast, start = c(2016,1), frequency = 4)
ST.nonex_fc <- as.data.table(ST_nonex_forecast)

forecast for provision of loan&lease loss

JP.alll_model1_fc <- forecast(JP.alll_model1, newdata = scenario, h=8)
autoplot(JP.alll_model1_fc) +
  ggtitle("Forecasting Provision for Loan & Lease Losses for JPmorgan") +
  ylab("Log_alll") +
  xlab("Time")

JP_alll_forecast <- data.frame(JP.alll_model1_fc)
tsJP_alll_forecast <- ts(JP_alll_forecast, start = c(2016,1), frequency = 4)
JP.alll_fc <- as.data.table(tsJP_alll_forecast)
ST.alll_model1_fc <- forecast(ST.alll_model1, newdata = scenario, h=8)
autoplot(ST.alll_model1_fc) +
  ggtitle("Forecasting Provision for Loan & Lease Losses for SunTrust") +
  ylab("Log_alll") +
  xlab("Time")

ST_alll_forecast <- data.frame(ST.alll_model1_fc)
tsST_alll_forecast <- ts(ST_alll_forecast, start = c(2016,1), frequency = 4)
ST.alll_fc <- as.data.table(tsST_alll_forecast)

forecast for aggregate loss

JP.loss_model1_fc <- forecast(JP.loss_model1, newdata = scenario, h=8)
autoplot(JP.loss_model1_fc) +
  ggtitle("Forecasting Aggregate Loss for JPmorgan") +
  ylab("Log_loss") +
  xlab("Time")

JP.loss_fc <- as.data.table(JP.loss_model1_fc)
JP_loss_forecast <- data.frame(JP.loss_fc)
tsJP_loss_forecast <- ts(JP_loss_forecast, start = c(2016,1), frequency = 4)
JP.loss_fc <- as.data.table(tsJP_loss_forecast)
ST.loss_model1_fc <- forecast(ST.loss_model1, newdata = scenario, h=8)
autoplot(ST.loss_model1_fc) +
    ggtitle("Forecasting Aggregate Loss for SunTrust") +
  ylab("Log_loss") +
  xlab("Time")

ST.loss_fc <- as.data.table(ST.loss_model1_fc)
ST_loss_forecast <- data.frame(ST.loss_fc)
tsST_loss_forecast <- ts(ST_loss_forecast, start = c(2016,1), frequency = 4)
ST.loss_fc <- as.data.table(tsST_loss_forecast)

net income

names(JP.intinc_fc)[1] <- "interest.income"
names(JP.intex_fc)[1] <- "interest.expense"
names(JP.noninc_fc)[1] <- "noninterest.income"
names(JP.nonex_fc)[1] <- "noninterest.expense"

names(ST.intinc_fc)[1] <- "interest.income"
names(ST.intex_fc)[1] <- "interest.expense"
names(ST.noninc_fc)[1] <- "noninterest.income"
names(ST.nonex_fc)[1] <- "noninterest.expense"

JP.net.income <-  cbind(JP.intex_fc, JP.intinc_fc,JP.noninc_fc, JP.nonex_fc)
ST.net.income <-  cbind(ST.intex_fc, ST.intinc_fc,ST.noninc_fc, ST.nonex_fc)

JP.net.income_fc <- exp(JP.net.income)
ST.net.income_fc <- exp(ST.net.income)

JP.net.income_fc$net.interest.income <- JP.net.income_fc$interest.income - JP.net.income_fc$interest.expense
JP.net.income_fc$net.noninterest.income <- JP.net.income_fc$noninterest.income - JP.net.income_fc$noninterest.expense
JP.net.income_fc$net.income <- JP.net.income_fc$net.interest.income + JP.net.income_fc$net.noninterest.income

ST.net.income_fc$net.interest.income <- ST.net.income_fc$interest.income - ST.net.income_fc$interest.expense
ST.net.income_fc$net.noninterest.income <- ST.net.income_fc$noninterest.income - ST.net.income_fc$noninterest.expense
ST.net.income_fc$net.income <- ST.net.income_fc$net.interest.income + ST.net.income_fc$net.noninterest.income

JP.net.income_fc <- ts(JP.net.income_fc, start = c(2016,1), frequency = 4)
ST.net.income_fc <- ts(ST.net.income_fc, start = c(2016,1), frequency = 4)

draw the plot of the net.interest.income

ST.his <- subset(newincome, institution.name ==  "SunTrust Banks, Inc.")
JP.his<- subset(newincome, institution.name == "JPMorgan Chase & Co.")

JP.his$net.interest.income <- JP.his$total.interest.income - JP.his$total.interest.expense

JP.his$net.noninterest.income <- JP.his$total.noninterest.income - JP.his$total.noninterest.expense

ST.his$net.interest.income <- ST.his$total.interest.income - ST.his$total.interest.expense
ST.his$net.noninterest.income <- ST.his$total.noninterest.income - ST.his$total.noninterest.expense


jpmorgan.net.interest.income <- JP.his["net.interest.income"]
jpmorgan.net.interest.income.ts <- ts(jpmorgan.net.interest.income, start = c(1990), frequency = 4)
jpmorgan.net.noninterest.income <- JP.his["net.noninterest.income"]
jpmorgan.net.noninterest.income.ts <- ts(jpmorgan.net.noninterest.income, start = c(1990), frequency = 4)

suntrust.net.interest.income <- ST.his["net.interest.income"]
suntrust.net.interest.income.ts <- ts(suntrust.net.interest.income, start = c(1990), frequency = 4)
suntrust.net.noninterest.income <- ST.his["net.noninterest.income"]
suntrust.net.noninterest.income.ts <- ts(suntrust.net.noninterest.income, start = c(1990), frequency = 4)

#plot for jpmorgan net interest income
jpmorgan.net.interest.income.fc <- JP.net.income_fc[,"net.interest.income"]
all.jpmorgan.net.interest.income <- cbind(jpmorgan.net.interest.income.fc, jpmorgan.net.interest.income.ts)
autoplot(all.jpmorgan.net.interest.income) +
  ggtitle("Net Interest Income of JPmorgan") 

#plot for jpmorgan net noninterest income
jpmorgan.net.noninterest.income.fc <- JP.net.income_fc[,"net.noninterest.income"]
all.jpmorgan.net.noninterest.income <- cbind(jpmorgan.net.noninterest.income.fc, jpmorgan.net.noninterest.income.ts)
autoplot(all.jpmorgan.net.noninterest.income) +
  ggtitle("Net Noninterest Income of JPmorgan")

#plot for suntrust net interest income
suntrust.net.interest.income.fc <- ST.net.income_fc[,"net.interest.income"]
all.suntrust.net.interest.income <- cbind(suntrust.net.interest.income.fc, suntrust.net.interest.income.ts)
autoplot(all.suntrust.net.interest.income) +
  ggtitle("Net Interest Income of SunTrust")

#plot for suntrust net noninterest income
suntrust.net.noninterest.income.fc <- ST.net.income_fc[,"net.noninterest.income"]
all.suntrust.net.noninterest.income <- cbind(suntrust.net.noninterest.income.fc, suntrust.net.noninterest.income.ts)
autoplot(all.suntrust.net.noninterest.income) +
  ggtitle("Net Noninterest Income of SunTrust")