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)
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)
suntrust_data <- na.omit(suntrust_data)
jpmorgan_data <- na.omit(jpmorgan_data)
suntrust_ts <- ts(suntrust_data,start = c(1990), end = c(2016), frequency = 4)
jpmorgan_ts <- ts(jpmorgan_data,start = c(1990), end = c(2016), frequency = 4)
JP.ts <- window(jpmorgan_ts, start = c(2009))
ST.ts <- window(suntrust_ts, start = c(2009))
JP.intinc_model1s <- tslm(log_interest.income ~
log_10treasury.yield +
log_bbb+
log_mortgage.rate,
data = JP.ts)
summary(JP.intinc_model1s)
##
## Call:
## tslm(formula = log_interest.income ~ log_10treasury.yield + log_bbb +
## log_mortgage.rate, data = JP.ts)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.273454 -0.094331 -0.003461 0.075037 0.283346
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 21.5506 0.3998 53.900 < 2e-16 ***
## log_10treasury.yield 2.3357 0.2875 8.125 1.77e-08 ***
## log_bbb 1.4789 0.2223 6.654 5.68e-07 ***
## log_mortgage.rate -6.7161 0.4771 -14.076 2.18e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.147 on 25 degrees of freedom
## Multiple R-squared: 0.941, Adjusted R-squared: 0.934
## F-statistic: 133 on 3 and 25 DF, p-value: 1.709e-15
checkresiduals(JP.intinc_model1s)
##
## Breusch-Godfrey test for serial correlation of order up to 7
##
## data: Residuals from Linear regression model
## LM test = 11.622, df = 7, p-value = 0.1137
ST.intinc_model1s <- tslm(log_interest.income ~
log_10treasury.yield +
log_bbb+
log_mortgage.rate,
data = ST.ts)
summary(ST.intinc_model1s)
##
## Call:
## tslm(formula = log_interest.income ~ log_10treasury.yield + log_bbb +
## log_mortgage.rate, data = ST.ts)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.11627 -0.04916 0.01499 0.05006 0.13631
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 15.7956 0.2265 69.736 < 2e-16 ***
## log_10treasury.yield 0.8570 0.1576 5.437 1.21e-05 ***
## log_bbb 0.8828 0.1661 5.316 1.65e-05 ***
## log_mortgage.rate -2.6570 0.2630 -10.103 2.60e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.07919 on 25 degrees of freedom
## Multiple R-squared: 0.8664, Adjusted R-squared: 0.8504
## F-statistic: 54.06 on 3 and 25 DF, p-value: 4.529e-11
checkresiduals(ST.intinc_model1s)
##
## Breusch-Godfrey test for serial correlation of order up to 7
##
## data: Residuals from Linear regression model
## LM test = 15.463, df = 7, p-value = 0.0305
JP.intex_model1s <- tslm(log_interest.expense ~
log_10treasury.yield +
log_bbb+
log_mortgage.rate,
data = JP.ts)
summary(JP.intex_model1s)
##
## Call:
## tslm(formula = log_interest.expense ~ log_10treasury.yield +
## log_bbb + log_mortgage.rate, data = JP.ts)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.38232 -0.13115 -0.00771 0.13196 0.35738
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 16.5395 0.5791 28.562 < 2e-16 ***
## log_10treasury.yield 1.2165 0.4164 2.922 0.00728 **
## log_bbb 1.6996 0.3219 5.280 1.81e-05 ***
## log_mortgage.rate -3.9054 0.6910 -5.652 6.98e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.213 on 25 degrees of freedom
## Multiple R-squared: 0.6602, Adjusted R-squared: 0.6194
## F-statistic: 16.19 on 3 and 25 DF, p-value: 4.693e-06
checkresiduals(JP.intex_model1s)
##
## Breusch-Godfrey test for serial correlation of order up to 7
##
## data: Residuals from Linear regression model
## LM test = 23.538, df = 7, p-value = 0.001373
ST.intex_model1s <- tslm(log_interest.expense ~
log_10treasury.yield +
log_bbb+
log_mortgage.rate,
data = ST.ts)
summary(ST.intex_model1s)
##
## Call:
## tslm(formula = log_interest.expense ~ log_10treasury.yield +
## log_bbb + log_mortgage.rate, data = ST.ts)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.48864 -0.10464 0.00054 0.19035 0.41429
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 11.0948 0.7827 14.174 1.87e-13 ***
## log_10treasury.yield 1.1581 0.5447 2.126 0.043559 *
## log_bbb 3.1521 0.5738 5.493 1.05e-05 ***
## log_mortgage.rate -3.4212 0.9088 -3.765 0.000905 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2737 on 25 degrees of freedom
## Multiple R-squared: 0.7574, Adjusted R-squared: 0.7283
## F-statistic: 26.02 on 3 and 25 DF, p-value: 7.389e-08
checkresiduals(ST.intex_model1s)
##
## Breusch-Godfrey test for serial correlation of order up to 7
##
## data: Residuals from Linear regression model
## LM test = 21.408, df = 7, p-value = 0.00321
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.7795 -0.3522 0.1286 0.2639 0.6806
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -3.482188 2.030911 -1.715 0.0988 .
## log_house.price.index..level. 3.892148 0.394269 9.872 4.16e-10 ***
## real.gdp.growth -0.030932 0.039759 -0.778 0.4439
## market.volatility.index..level. 0.008170 0.008383 0.975 0.3391
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4255 on 25 degrees of freedom
## Multiple R-squared: 0.8013, Adjusted R-squared: 0.7775
## F-statistic: 33.61 on 3 and 25 DF, p-value: 6.252e-09
checkresiduals(JP.noninc_model1)
##
## Breusch-Godfrey test for serial correlation of order up to 7
##
## data: Residuals from Linear regression model
## LM test = 22.999, df = 7, p-value = 0.001706
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.44041 -0.16026 -0.04025 0.17164 0.36869
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.990538 1.130927 2.644 0.0139 *
## log_house.price.index..level. 2.073219 0.219152 9.460 9.71e-10 ***
## real.gdp.growth -0.031455 0.026751 -1.176 0.2507
## market.volatility.index..level. 0.009279 0.004997 1.857 0.0751 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2371 on 25 degrees of freedom
## Multiple R-squared: 0.7891, Adjusted R-squared: 0.7638
## F-statistic: 31.18 on 3 and 25 DF, p-value: 1.311e-08
checkresiduals(ST.noninc_model1)
##
## Breusch-Godfrey test for serial correlation of order up to 7
##
## data: Residuals from Linear regression model
## LM test = 16.395, df = 7, p-value = 0.02174
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.65460 -0.30195 0.05034 0.25766 0.65361
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.401843 1.874158 -0.748 0.461
## real.gdp.growth -0.014878 0.036690 -0.406 0.689
## log_house.price.index..level. 3.500214 0.363838 9.620 6.96e-10 ***
## market.volatility.index..level. 0.010484 0.007736 1.355 0.187
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3926 on 25 degrees of freedom
## Multiple R-squared: 0.7912, Adjusted R-squared: 0.7662
## F-statistic: 31.58 on 3 and 25 DF, p-value: 1.156e-08
checkresiduals(JP.nonex_model1)
##
## Breusch-Godfrey test for serial correlation of order up to 7
##
## data: Residuals from Linear regression model
## LM test = 26.229, df = 7, p-value = 0.0004583
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.4931 -0.1875 0.0390 0.1567 0.3211
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.106628 1.125745 4.536 0.000124 ***
## log_house.price.index..level. 1.761887 0.218147 8.077 1.97e-08 ***
## real.gdp.growth -0.017865 0.026628 -0.671 0.508427
## market.volatility.index..level. 0.008572 0.004974 1.723 0.097150 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.236 on 25 degrees of freedom
## Multiple R-squared: 0.7291, Adjusted R-squared: 0.6965
## F-statistic: 22.42 on 3 and 25 DF, p-value: 2.896e-07
checkresiduals(ST.nonex_model1)
##
## Breusch-Godfrey test for serial correlation of order up to 7
##
## data: Residuals from Linear regression model
## LM test = 23.38, df = 7, p-value = 0.001463
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.9858 -0.2320 0.1107 0.5317 1.6651
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 22.4922 3.3747 6.665 6.8e-07 ***
## real.gdp.growth 0.0285 0.1272 0.224 0.82455
## log_10treasury.yield 7.3087 2.3601 3.097 0.00493 **
## log_mortgage.rate -18.4352 3.9035 -4.723 8.4e-05 ***
## log_bbb 6.8930 2.2046 3.127 0.00458 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.188 on 24 degrees of freedom
## Multiple R-squared: 0.5314, Adjusted R-squared: 0.4533
## F-statistic: 6.804 on 4 and 24 DF, p-value: 0.0008272
checkresiduals(JP.alll_model1)
##
## Breusch-Godfrey test for serial correlation of order up to 8
##
## data: Residuals from Linear regression model
## LM test = 11.043, df = 8, p-value = 0.1993
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
## -2.1976 -0.4692 0.1647 0.6139 1.0702
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 14.90894 2.64370 5.639 8.32e-06 ***
## real.gdp.growth -0.07702 0.10651 -0.723 0.47662
## log_10treasury.yield 3.22592 1.82259 1.770 0.08944 .
## log_mortgage.rate -11.31674 3.03202 -3.732 0.00103 **
## log_bbb 6.78554 1.96900 3.446 0.00210 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9102 on 24 degrees of freedom
## Multiple R-squared: 0.4656, Adjusted R-squared: 0.3766
## F-statistic: 5.228 on 4 and 24 DF, p-value: 0.003571
checkresiduals(ST.alll_model1)
##
## Breusch-Godfrey test for serial correlation of order up to 8
##
## data: Residuals from Linear regression model
## LM test = 20.323, df = 8, p-value = 0.00918
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,1), end = c(2017,4))
scenario <- as.data.table(scenario.ts)
JP.intinc_model1s_fc <- forecast(JP.intinc_model1s, newdata = scenario, h=8)
autoplot(JP.intinc_model1s_fc) +
ggtitle("Forecasting Interest Income for JPmorgan") +
ylab("Log_interest.income") +
xlab("Time")
JP_intinc_forecast <- data.frame(JP.intinc_model1s_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_model1s_fc <- forecast(ST.intinc_model1s, newdata = scenario, h=8)
autoplot(ST.intinc_model1s_fc) +
ggtitle("Forecasting Interest Income for SunTrust") +
ylab("log_interest.income") +
xlab("Time")
ST_intinc_forecast <- data.frame(ST.intinc_model1s_fc)
tsST_intinc_forecast <- ts(ST_intinc_forecast, start = c(2016,1), frequency = 4)
ST.intinc_fc <- as.data.table(tsST_intinc_forecast)
JP.intex_model1s_fc <- forecast(JP.intex_model1s, newdata = scenario, h=8)
autoplot(JP.intex_model1s_fc) +
ggtitle("Forecasting Interest Expense of JPmorgan") +
ylab("Log_interest.expense") +
xlab("Time")
JP_intex_forecast <- data.frame(JP.intex_model1s_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_model1s_fc <- forecast(ST.intex_model1s, newdata = scenario, h=8)
autoplot(ST.intex_model1s_fc) +
ggtitle("Forecasting for Interest Expense for SunTrust") +
ylab("Log_interest.expense") +
xlab("Time")
ST_intex_forecast <- data.frame(ST.intex_model1s_fc)
tsST_intex_forecast <- ts(ST_intex_forecast, start = c(2016,1), frequency = 4)
ST.intex_fc <- as.data.table(tsST_intex_forecast)
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)
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)
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)
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)[2] <- "real.gdp.growth"
colnames(jpmorgan_new)[29] <- "log_house.price.index..level."
colnames(jpmorgan_new)[17] <- "market.volatility.index..level."
colnames(jpmorgan_new)[36] <- "log_bbb"
colnames(jpmorgan_new)[31] <- "log_mortgage.rate"
colnames(jpmorgan_new)[33] <- "log_10treasury.yield"
colnames(jpmorgan_new)[34] <- "log_5treasury.yield"
colnames(suntrust_new)[2] <- "real.gdp.growth"
colnames(suntrust_new)[29] <- "log_house.price.index..level."
colnames(suntrust_new)[17] <- "market.volatility.index..level."
colnames(suntrust_new)[36] <- "log_bbb"
colnames(suntrust_new)[31] <- "log_mortgage.rate"
colnames(suntrust_new)[33] <- "log_10treasury.yield"
colnames(suntrust_new)[34] <- "log_5treasury.yield"
JP.loss_model1 <- tslm(jpmorgan_loss.ts.log_aggregate.loss ~
log_house.price.index..level. +
market.volatility.index..level.+
real.gdp.growth , data = jpmorgan_new)
summary(JP.loss_model1)
##
## Call:
## tslm(formula = jpmorgan_loss.ts.log_aggregate.loss ~ log_house.price.index..level. +
## market.volatility.index..level. + real.gdp.growth, data = jpmorgan_new)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.2444 -0.3288 0.1172 0.4880 0.8063
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 37.07221 6.59784 5.619 1.02e-05 ***
## log_house.price.index..level. -4.26832 1.28122 -3.331 0.0029 **
## market.volatility.index..level. 0.00314 0.01269 0.248 0.8067
## real.gdp.growth 0.07224 0.05739 1.259 0.2208
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5983 on 23 degrees of freedom
## Multiple R-squared: 0.3811, Adjusted R-squared: 0.3004
## F-statistic: 4.721 on 3 and 23 DF, p-value: 0.01039
checkresiduals((JP.loss_model1))
##
## Breusch-Godfrey test for serial correlation of order up to 7
##
## data: Residuals from Linear regression model
## LM test = 20.427, df = 7, p-value = 0.004717
ST.loss_model1 <- tslm(suntrust_loss.ts.log_aggregate.loss ~
log_house.price.index..level. +
market.volatility.index..level. +
real.gdp.growth , data = suntrust_new)
summary(ST.loss_model1)
##
## Call:
## tslm(formula = suntrust_loss.ts.log_aggregate.loss ~ log_house.price.index..level. +
## market.volatility.index..level. + real.gdp.growth, data = suntrust_new)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.02819 -0.37346 -0.04009 0.43319 0.99493
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 39.193235 6.384255 6.139 2.91e-06 ***
## log_house.price.index..level. -5.135155 1.238523 -4.146 0.000391 ***
## market.volatility.index..level. 0.005551 0.013111 0.423 0.675960
## real.gdp.growth 0.147298 0.067323 2.188 0.039096 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5713 on 23 degrees of freedom
## Multiple R-squared: 0.5231, Adjusted R-squared: 0.4609
## F-statistic: 8.409 on 3 and 23 DF, p-value: 0.0005929
checkresiduals((ST.loss_model1))
##
## Breusch-Godfrey test for serial correlation of order up to 7
##
## data: Residuals from Linear regression model
## LM test = 18.177, df = 7, p-value = 0.01119
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)
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")