Introduction

The goal of this project is to analyze the impacts to a balance sheet and income statement by changing accounting ratios such as the Current Ratio, the Debt to Equity Ratio, and the PE Ratio. Normally, these ratios are calculated from figures on the balance sheet and income statements. They are meant to give investors and related parties a quick and easy way to get a rough idea of the state of a business without having to delve through the entire balance sheet. However, analysts who use said ratios may be interested in learning how a balance sheet may change given changes to the various ratios. An example of this is any adverse macro-economic event whose impact on a firm’s balance sheet may be difficult to understand, though adjusting ratios to reflect such an adverse event may be easier. This project will look specifically at Bank of America’s balance sheets and income statements.

Gathering Data

The first step in this project involves gathering relevant data and formatting it in a way that is easy to do calculations with. For this project, balanace sheet and income sheet data comes from an api by financialmodelprep.com.To learn more about this api, please visit https://financialmodelingprep.com/developer/docs/. The R code used to access the api is shown below.

library(ggplot2)
library(data.table)
library(DT)
library(ggpubr)
library(tidyverse)
library(DT)
library(jtools)
library(kableExtra)
library(knitr)
options(scipen=999)

findTicker <- function(search){
  suppressMessages(library(gtools))
  suppressMessages(library(data.table))
  suppressMessages(library(readr))
  NYSE <- suppressWarnings(suppressMessages(read_csv("https://datahub.io/core/nyse-other-listings/r/nyse-listed.csv")))
  NASDAQ <- suppressWarnings(suppressMessages(read_csv("https://pkgstore.datahub.io/core/nasdaq-listings/nasdaq-listed_csv/data/7665719fb51081ba0bd834fde71ce822/nasdaq-listed_csv.csv")))
  AMEX <- suppressWarnings(suppressMessages(read_csv("https://old.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=amex&render=download")))
  OTC <- suppressWarnings(suppressMessages(read_csv("http://www.sharecsv.com/dl/737aeb85295fd0668006d98fb59107ca/otcList.csv")))
  NYSE <- suppressWarnings(suppressMessages(data.table(Ticker = NYSE$`ACT Symbol`,Name = NYSE$`Company Name`)))
  NASDAQ <- suppressWarnings(suppressMessages(data.table(Ticker = NASDAQ$Symbol, Name = NASDAQ$`Company Name`)))
  AMEX <- suppressWarnings(suppressMessages(data.table(Ticker = AMEX$Symbol,Name = AMEX$Name)))
  OTC <- suppressWarnings(suppressMessages(data.table(Ticker = OTC$Symbol,Name = OTC$Description)))
  allTickers <- suppressWarnings(suppressMessages(data.table(smartbind(NYSE, NASDAQ,AMEX,OTC))))
  a <- suppressWarnings(suppressMessages(allTickers[allTickers$Name %ilike% search,])  )
  a <- rbind(a,suppressWarnings(suppressMessages(allTickers[allTickers$Ticker %ilike% search,])  ) )
  a
   
}


fxRates <- function(baseCurrency = "USD", compareAgainst = "JPY"){
  
  suppressMessages(library(httr))
  suppressMessages(library(jsonlite))
  suppressMessages(library(dplyr))
  suppressMessages(library(data.table))
  suppressMessages(library(bizdays))
  suppressMessages(library(lubridate))
  
  fxURL <- "https://financialmodelingprep.com/api/v3/forex"
  newFXURL <- paste0(fxURL,"/",baseCurrency,compareAgainst)
  
  jsonDwn <- suppressMessages(httr::GET(newFXURL))
  jsonText <- suppressMessages(httr::content(jsonDwn, as = "text"))
  jsonContent <- suppressMessages(jsonlite::fromJSON(jsonText))
  FXtable <- as.data.table(jsonContent)
  FXtable
}

geometricReturn <- function(vectorOfPrices,vectorOfReturns,vectorOfDates,annualizeDaily = FALSE,annualizeMonthly = FALSE ,annualizeQuarterly = FALSE){
  
  ##either vectorOfPrices or vectorOfReturns should be in date order by latest to oldest
  
  
  ##coerce
  if(!missing(vectorOfPrices)){
    vectorOfPrices <- as.numeric(vectorOfPrices)
  }
  if(!missing(vectorOfReturns)){
    vectorOfReturns <- as.numeric(vectorOfReturns)
  }
  vectorOfDates <- as.Date(vectorOfDates)
  
  ##order
   if(!missing(vectorOfPrices)){
    dat <- data.table(prices = vectorOfPrices, dates = vectorOfDates)
    dat <- dat[rev(order(as.Date(dat$dates))),]
  }
     if(!missing(vectorOfReturns)){
    dat <- data.table(prices = vectorOfReturns, dates = vectorOfDates)
    dat <- dat[rev(order(as.Date(dat$dates))),]
  }
  
  
  ##calc
  
  if(missing(vectorOfPrices)){
    returnsPlusOne <- dat$prices + 1
    multReturns <- prod(returnsPlusOne)
    retPwr <- multReturns ^ (1/(length(vectorOfReturns)+1))
    geoReturn <- retPwr - 1
  }
  
  if(missing(vectorOfReturns)){
    geoReturn <- ( (dat$prices[1] / dat$prices[length(vectorOfPrices)]) ^ (1 / length(vectorOfPrices) ) ) - 1
    
  }
 
  ## if given daily prices or returns and desired an anualized figure
  if(annualizeDaily == TRUE){
    geoReturn <- ( ( geoReturn + 1 ) ^ 253) - 1
    
  }
  ## if given monthly prices or returns and desired an anualized figure
  else if(annualizeMonthly == TRUE){
    geoReturn <- ( ( geoReturn + 1 ) ^ 12) - 1
    
  }
  ## if given quarterly prices or returns and desired an anualized figure
  else if(annualizeQuarterly == TRUE){
    geoReturn <- ( ( geoReturn + 1 ) ^ 4) - 1
    
  }
  
  return(geoReturn)
}

historicalFX <- function(baseCurrency = "USD",compareAgainst = "JPY",startDate = "2018-01-01", endDate = as.character(Sys.Date()) ){
  
  suppressMessages(library(httr))
  suppressMessages(library(jsonlite))
  suppressMessages(library(dplyr))
  suppressMessages(library(data.table))
  suppressMessages(library(bizdays))
  suppressMessages(library(lubridate))
  
  ##https://api.exchangeratesapi.io/history?start_at=2017-01-01&end_at=2018-09-01&?base=USD
  fxURL <- "https://api.exchangeratesapi.io/history?"
  newFXURL <- paste0(fxURL,"start_at=",startDate,"&end_at=",endDate,"&base=",baseCurrency)
  
  jsonDwn <- suppressMessages(httr::GET(newFXURL))
  jsonText <- suppressMessages(httr::content(jsonDwn, as = "text"))
  jsonContent <- suppressMessages(jsonlite::fromJSON(jsonText))
  fxRates <- rbindlist(jsonContent$rates,idcol = "date", fill = TRUE)
  finalFXtable <- data.table(date = fxRates$date, fxRates[,..compareAgainst])
  finalFXtable$date <- as.Date(finalFXtable$date)
  finalFXtable

}

historicalStocks <- function(ticker = "AAPL", api = "UX6D3HZK0BHUUGNW"){
  
  suppressMessages(library(httr))
  suppressMessages(library(jsonlite))
  suppressMessages(library(dplyr))
  suppressMessages(library(data.table))
  
  historicalURL <- paste0("https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=",ticker,"&outputsize=full&apikey=")
  jsonDwn <- suppressMessages(httr::GET(historicalURL, query = list(apikey = api) ))
  jsonText <- suppressMessages(httr::content(jsonDwn, as = "text"))
  jsonContent <- suppressMessages(jsonlite::fromJSON(jsonText))
  timeSeries <- suppressMessages(rbindlist(jsonContent$`Time Series (Daily)`))
  
  all_Dates <- as.Date.character(names(jsonContent$`Time Series (Daily)`))
 
  timeSeries$Date <- all_Dates
  timeSeries$ticker <- ticker
  
  timeSeries$`1. open` <- as.numeric(timeSeries$`1. open`)
  timeSeries$`2. high` <- as.numeric(timeSeries$`2. high`)
  timeSeries$`3. low` <- as.numeric(timeSeries$`3. low`)
  timeSeries$`4. close` <- as.numeric(timeSeries$`4. close`)
  timeSeries$`5. volume` <- as.numeric(timeSeries$`5. volume`)
  
  timeSeries
  
}

incomeStatement <- function(ticker = "AAPL" ){
  
  suppressMessages(library(httr))
  suppressMessages(library(jsonlite))
  suppressMessages(library(dplyr))
  suppressMessages(library(data.table))
  suppressMessages(library(bizdays))
  suppressMessages(library(lubridate))
  suppressMessages(library(formattable))
  
  balanceURL <- paste0("https://financialmodelingprep.com/api/v3/financials/income-statement/",ticker ,"?period=quarter")
  jsonDwn <- httr::GET(balanceURL) 
  jsonText <- httr::content(jsonDwn, as = "text")
  jsonContent <- jsonlite::fromJSON(jsonText)
  financial <- jsonContent$financials                       
  financial <- data.table(financial)
  financial[,2:30] <- financial[, lapply(.SD, accounting), .SDcols = 2:30]  
  financial$date <- as.Date(financial$date)
  financial
  
}

quarterlyBalanceSheet <- function(ticker = "AAPL" ){
  
  suppressMessages(library(httr))
  suppressMessages(library(jsonlite))
  suppressMessages(library(dplyr))
  suppressMessages(library(data.table))
  suppressMessages(library(bizdays))
  suppressMessages(library(lubridate))
  suppressMessages(library(formattable))
  
  balanceURL <- paste0("https://financialmodelingprep.com/api/v3/financials/balance-sheet-statement/",ticker ,"?period=quarter")
  jsonDwn <- httr::GET(balanceURL) 
  jsonText <- httr::content(jsonDwn, as = "text")
  jsonContent <- jsonlite::fromJSON(jsonText)
  financial <- jsonContent$financials                       
  financial <- data.table(financial)
  financial[,2:30] <- financial[, lapply(.SD, accounting), .SDcols = 2:30]  
  financial$date <- as.Date(financial$date)
  financial
  
}

stockSplits2 <- function(ticker = "MSFT"){
  
  suppressMessages(library(httr))
  suppressMessages(library(jsonlite))
  suppressMessages(library(dplyr))
  suppressMessages(library(data.table))
  suppressMessages(library(bizdays))
  suppressMessages(library(lubridate))
  suppressMessages(library(rvest))
  closeAllConnections()
  ticker <- as.character(ticker)
  ticker <- toupper(ticker)
  
  ##relevant function needed for later
  splitInParts <- function(string, size){
    pat <- paste0('(?<=.{',size,'})')
    strsplit(string, pat, perl=TRUE)
  }
  
  
  url <- "https://www.splithistory.com/?symbol="
  ##create unique url
  splitsURL <- paste0(url,ticker)
  
  ##scrape site
  splits <- try(suppressWarnings(read_html(splitsURL)))
  if("try-error" %in% class(splits)) return("no stock split history")
  
  txt <- splits %>% html_node("center") %>% html_text()
 
  beginningInt <- regexpr("Split History Table",txt)[[1]]
  endingInt <- gregexpr("Stock Splits",txt)[[1]]
  endingInt <- endingInt[which(endingInt > beginningInt)]
  endingInt <- min(endingInt)
  
  
  txt <- substr(txt,beginningInt,endingInt)
  txt <- gsub("[[:alpha:]]{4,}","",txt)
  txt <- gsub("[\\(\\)]","",txt)
  txt <- gsub("[\\)\\)]","",txt)
  txt <- gsub("\\s[[:alpha:]]{1,2}\\s","",txt)
  txt <- gsub("\\s","",txt)
  txt <- gsub("[[:alpha:]]{1}$","",txt)
  
  dateInts <- gregexpr("[[:digit:]]{2}/[[:digit:]]{2}/[[:digit:]]{4}",txt)[[1]]
  dateIntsEnd <- dateInts + 9
  d <- NULL
  for(i in 1:length(dateInts)){
    d <- rbind(d,substr(txt,dateInts[i],dateIntsEnd[i]))
  }
  dates <- data.table(dates = as.Date.character(d,format = "%m/%d/%Y"))
  splitEnds <- dateInts[2:length(dateInts)] - 1
  splitEnds <- append(splitEnds, nchar(txt))
  
  d <- NULL
  dateIntsEnd <- dateIntsEnd + 1
  for(i in 1:length(dateInts)){
    d <- rbind(d,substr(txt,dateIntsEnd[i],splitEnds[i]))
  }
  dates$splits <- d
  # 
  # splitData <- suppressWarnings(tstrsplit(dates$splits,"for"))
  # dates$OUT <- suppressWarnings(splitData[1])
  # dates$FOR <- suppressWarnings(splitData[2])
  # 
  # dates$ticker <- ticker
  
  closeAllConnections()
  if(nrow(dates) == 0){
    return(data.table("no stock split history"))
  }else if(is.na(dates[[1]])){
    return(data.table("no stock split history"))
  }
  else{
    splitData <- suppressWarnings(tstrsplit(dates$splits,"for"))
    dates$OUT <- suppressWarnings(splitData[1])
    dates$FOR <- suppressWarnings(splitData[2])
    
    dates$ticker <- ticker
    return (dates)
  }
  
  
}

The following is the raw data for Bank of America’s balance sheet and income statement sourced from financialmodelingprep.com.

library(knitr)
library(kableExtra)
BAC_Balance <- quarterlyBalanceSheet("BAC")
BAC_Income <- incomeStatement("BAC")

scroll_box(kable(BAC_Balance, caption = "Bank of America Balance Sheet Data") %>% kable_styling("bordered"), height = "500px", width = "1100px"  )
Bank of America Balance Sheet Data
date Cash and cash equivalents Short-term investments Cash and short-term investments Receivables Inventories Total current assets Property, Plant & Equipment Net Goodwill and Intangible Assets Long-term investments Tax assets Total non-current assets Total assets Payables Short-term debt Total current liabilities Long-term debt Total debt Deferred revenue Tax Liabilities Deposit Liabilities Total non-current liabilities Total liabilities Other comprehensive income Retained earnings (deficit) Total shareholders equity Investments Net Debt Other Assets Other Liabilities
2019-09-30 157,094,000,000.00000 444,594,000,000.00000 601,688,000,000.00000 52,560,000,000.0 0.0 654,248,000,000.00000 10,493,000,000.0 70,551,000,000.0 444,594,000,000.00000 0.0 1,772,082,000,000.000000 2,426,330,000,000.000000 0.0 3,458,000,000.0 3,458,000,000.0 243,405,000,000.00000 246,863,000,000.00000 0.0 0.0 1,392,836,000,000.000000 243,405,000,000.00000 2,157,943,000,000.000000 122,820,999,999.99 151,183,000,000.00000 268,387,000,000.00000 889,188,000,000.00000 89,769,000,000.00000 0.0 1,911,080,000,000.000000
2019-06-30 171,394,000,000.00000 446,075,000,000.00000 617,469,000,000.00000 53,329,000,000.0 0.0 670,798,000,000.00000 10,426,000,000.0 70,551,000,000.0 446,075,000,000.00000 0.0 1,725,094,000,000.000000 2,395,892,000,000.000000 0.0 2,403,000,000.0 2,403,000,000.0 238,011,000,000.00000 240,414,000,000.00000 0.0 0.0 1,375,093,000,000.000000 238,011,000,000.00000 2,124,484,000,000.000000 131,307,999,999.99 147,577,000,000.00000 271,408,000,000.00000 892,150,000,000.00000 69,020,000,000.00000 0.0 1,884,070,000,000.000000
2019-03-31 171,623,000,000.00000 440,674,000,000.00000 612,297,000,000.00000 53,496,000,000.0 0.0 665,793,000,000.00000 10,251,000,000.0 70,551,000,000.0 440,674,000,000.00000 0.0 1,711,371,000,000.000000 2,377,164,000,000.000000 0.0 1,895,000,000.0 1,895,000,000.0 233,929,000,000.00000 235,824,000,000.00000 0.0 0.0 1,379,337,000,000.000000 233,929,000,000.00000 2,110,154,000,000.000000 135,163,999,999.99 141,888,000,000.00000 267,010,000,000.00000 881,348,000,000.00000 64,201,000,000.00000 0.0 1,874,330,000,000.000000
2018-12-31 177,404,000,000.00000 441,753,000,000.00000 619,157,000,000.00000 65,814,000,000.0 0.0 684,971,000,000.00000 9,906,000,000.0 70,551,000,000.0 441,753,000,000.00000 17,595,000,000.0 1,669,536,000,000.000000 2,354,507,000,000.000000 0.0 1,648,000,000.0 3,845,000,000.0 229,340,000,000.00000 230,988,000,000.00000 0.0 2,197,000,000.0 1,381,476,000,000.000000 236,194,000,000.00000 2,089,182,000,000.000000 141,221,999,999.99 136,314,000,000.00000 265,325,000,000.00000 883,506,000,000.00000 53,584,000,000.00000 0.0 1,849,143,000,000.000000
2018-09-30 184,858,000,000.00000 446,107,000,000.00000 630,965,000,000.00000 56,962,000,000.0 0.0 687,927,000,000.00000 9,680,000,000.0 70,551,000,000.0 446,107,000,000.00000 0.0 1,650,906,000,000.000000 2,338,833,000,000.000000 0.0 1,789,000,000.0 1,789,000,000.0 234,100,000,000.00000 235,889,000,000.00000 0.0 0.0 1,345,649,000,000.000000 234,100,000,000.00000 2,076,675,000,000.000000 146,246,999,999.99 130,747,000,000.00000 262,158,000,000.00000 892,214,000,000.00000 51,031,000,000.00000 0.0 1,840,786,000,000.000000
2018-06-30 171,199,000,000.00000 438,269,000,000.00000 609,468,000,000.00000 57,813,000,000.0 0.0 667,281,000,000.00000 9,537,000,000.0 70,551,000,000.0 438,269,000,000.00000 0.0 1,624,389,000,000.000000 2,291,670,000,000.000000 0.0 3,396,000,000.0 3,396,000,000.0 226,595,000,000.00000 229,991,000,000.00000 0.0 0.0 1,309,691,000,000.000000 226,595,000,000.00000 2,027,454,000,000.000000 152,002,999,999.99 125,546,000,000.00000 264,216,000,000.00000 876,538,000,000.00000 58,792,000,000.00000 0.0 1,797,463,000,000.000000
2018-03-31 204,241,000,000.00000 426,837,000,000.00000 631,078,000,000.00000 58,127,000,000.0 0.0 689,205,000,000.00000 9,399,000,000.0 70,551,000,000.0 426,837,000,000.00000 0.0 1,639,273,000,000.000000 2,328,478,000,000.000000 0.0 2,284,000,000.0 2,284,000,000.0 232,256,000,000.00000 234,540,000,000.00000 0.0 0.0 1,328,664,000,000.000000 232,256,000,000.00000 2,062,254,000,000.000000 158,203,999,999.99 120,298,000,000.00000 266,224,000,000.00000 853,674,000,000.00000 30,299,000,000.00000 0.0 1,827,714,000,000.000000
2017-12-31 157,434,000,000.00000 440,130,000,000.00000 597,564,000,000.00000 61,623,000,000.0 0.0 659,187,000,000.00000 9,247,000,000.0 70,551,000,000.0 440,130,000,000.00000 19,462,000,000.0 1,622,047,000,000.000000 2,281,234,000,000.000000 0.0 1,494,000,000.0 3,267,000,000.0 227,402,000,000.00000 228,896,000,000.00000 0.0 1,773,000,000.0 1,309,545,000,000.000000 234,239,000,000.00000 2,014,088,000,000.000000 160,411,999,999.99 113,816,000,000.00000 267,146,000,000.00000 880,260,000,000.00000 71,462,000,000.00000 0.0 1,776,582,000,000.000000
2017-09-30 172,381,000,000.00000 439,209,000,000.00000 611,590,000,000.00000 55,855,000,000.0 0.0 667,445,000,000.00000 8,971,000,000.0 71,427,000,000.0 439,209,000,000.00000 0.0 1,616,451,000,000.000000 2,283,896,000,000.000000 0.0 1,904,000,000.0 1,904,000,000.0 228,666,000,000.00000 230,570,000,000.00000 0.0 0.0 1,284,417,000,000.000000 228,666,000,000.00000 2,011,437,000,000.000000 165,140,999,999.99 113,486,000,000.00000 272,459,000,000.00000 878,418,000,000.00000 58,189,000,000.00000 0.0 1,780,867,000,000.000000
2017-06-30 158,704,000,000.00000 434,517,000,000.00000 593,221,000,000.00000 59,342,000,000.0 0.0 652,563,000,000.00000 8,904,000,000.0 71,579,000,000.0 434,517,000,000.00000 0.0 1,601,966,000,000.000000 2,254,529,000,000.000000 0.0 1,572,000,000.0 1,572,000,000.0 223,923,000,000.00000 225,495,000,000.00000 0.0 0.0 1,262,980,000,000.000000 223,923,000,000.00000 1,983,542,000,000.000000 167,963,999,999.99 109,628,000,000.00000 270,987,000,000.00000 869,034,000,000.00000 66,791,000,000.00000 0.0 1,758,047,000,000.000000
2017-03-31 168,025,000,000.00000 428,045,000,000.00000 596,070,000,000.00000 59,534,000,000.0 0.0 655,604,000,000.00000 9,319,000,000.0 71,735,000,000.0 428,045,000,000.00000 0.0 1,592,097,000,000.000000 2,247,701,000,000.000000 0.0 1,041,000,000.0 1,041,000,000.0 221,385,000,000.00000 222,426,000,000.00000 0.0 0.0 1,272,141,000,000.000000 221,385,000,000.00000 1,979,548,000,000.000000 170,001,999,999.99 105,467,000,000.00000 268,153,000,000.00000 856,090,000,000.00000 54,401,000,000.00000 0.0 1,757,122,000,000.000000
2016-12-31 147,738,000,000.00000 430,731,000,000.00000 578,469,000,000.00000 58,759,000,000.0 0.0 637,228,000,000.00000 9,139,000,000.0 71,891,000,000.0 430,731,000,000.00000 28,371,000,000.0 1,550,474,000,000.000000 2,187,702,000,000.000000 0.0 2,024,000,000.0 2,899,000,000.0 216,823,000,000.00000 218,847,000,000.00000 0.0 875,000,000.0 1,260,934,000,000.000000 225,968,000,000.00000 1,920,862,000,000.000000 172,257,999,999.99 101,870,000,000.00000 266,840,000,000.00000 861,462,000,000.00000 71,109,000,000.00000 0.0 1,691,995,000,000.000000
2016-09-30 143,434,000,000.00000 434,914,000,000.00000 578,348,000,000.00000 54,116,000,000.0 0.0 632,464,000,000.00000 9,133,000,000.0 72,912,000,000.0 434,914,000,000.00000 0.0 1,562,850,000,000.000000 2,195,314,000,000.000000 0.0 1,055,000,000.0 1,055,000,000.0 225,136,000,000.00000 226,191,000,000.00000 0.0 0.0 1,232,895,000,000.000000 225,136,000,000.00000 1,925,231,000,000.000000 173,480,999,999.99 98,303,000,000.00000 270,083,000,000.00000 869,828,000,000.00000 82,757,000,000.00000 0.0 1,699,040,000,000.000000
2016-06-30 171,207,000,000.00000 411,949,000,000.00000 583,156,000,000.00000 58,150,000,000.0 0.0 641,306,000,000.00000 9,150,000,000.0 73,096,000,000.0 411,949,000,000.00000 0.0 1,545,303,000,000.000000 2,186,609,000,000.000000 0.0 1,860,000,000.0 1,860,000,000.0 229,617,000,000.00000 231,477,000,000.00000 0.0 0.0 1,216,091,000,000.000000 229,617,000,000.00000 1,919,540,000,000.000000 174,773,999,999.99 93,623,000,000.00000 267,069,000,000.00000 823,898,000,000.00000 60,270,000,000.00000 0.0 1,688,063,000,000.000000
2016-03-31 179,610,000,000.00000 400,311,000,000.00000 579,921,000,000.00000 56,838,000,000.0 0.0 636,759,000,000.00000 9,358,000,000.0 73,339,000,000.0 400,311,000,000.00000 0.0 1,548,739,000,000.000000 2,185,498,000,000.000000 0.0 1,482,000,000.0 1,482,000,000.0 232,849,000,000.00000 234,331,000,000.00000 0.0 0.0 1,217,261,000,000.000000 232,849,000,000.00000 1,922,722,000,000.000000 175,115,999,999.99 90,270,000,000.00000 262,776,000,000.00000 800,622,000,000.00000 54,721,000,000.00000 0.0 1,688,391,000,000.000000
2015-12-31 159,353,000,000.00000 407,005,000,000.00000 566,358,000,000.00000 58,312,000,000.0 0.0 624,670,000,000.00000 9,485,000,000.0 73,529,000,000.0 407,005,000,000.00000 32,195,000,000.0 1,519,646,000,000.000000 2,144,316,000,000.000000 0.0 1,325,000,000.0 2,420,000,000.0 236,764,000,000.00000 238,089,000,000.00000 0.0 1,095,000,000.0 1,197,259,000,000.000000 244,495,000,000.00000 1,888,111,000,000.000000 173,314,999,999.99 88,564,000,000.00000 256,205,000,000.00000 814,010,000,000.00000 78,736,000,000.00000 0.0 1,641,196,000,000.000000
2015-09-30 170,426,000,000.00000 391,651,000,000.00000 562,077,000,000.00000 63,443,000,000.0 0.0 625,520,000,000.00000 9,554,000,000.0 73,734,000,000.0 391,651,000,000.00000 0.0 1,527,486,000,000.000000 2,153,006,000,000.000000 0.0 1,869,000,000.0 1,869,000,000.0 237,288,000,000.00000 239,157,000,000.00000 0.0 0.0 1,162,009,000,000.000000 237,288,000,000.00000 1,897,101,000,000.000000 174,113,999,999.99 85,485,000,000.00000 255,905,000,000.00000 783,302,000,000.00000 68,731,000,000.00000 0.0 1,657,944,000,000.000000
2015-06-30 163,514,000,000.00000 392,379,000,000.00000 555,893,000,000.00000 64,505,000,000.0 0.0 620,398,000,000.00000 9,700,000,000.0 73,963,000,000.0 392,379,000,000.00000 0.0 1,528,636,000,000.000000 2,149,034,000,000.000000 0.0 1,841,000,000.0 1,841,000,000.0 243,414,000,000.00000 245,255,000,000.00000 0.0 0.0 1,149,560,000,000.000000 243,414,000,000.00000 1,897,375,000,000.000000 174,910,999,999.99 81,938,000,000.00000 251,659,000,000.00000 784,758,000,000.00000 81,741,000,000.00000 0.0 1,652,120,000,000.000000
2015-03-31 162,543,000,000.00000 383,989,000,000.00000 546,532,000,000.00000 63,716,000,000.0 0.0 610,248,000,000.00000 9,833,000,000.0 74,167,000,000.0 383,989,000,000.00000 0.0 1,533,297,000,000.000000 2,143,545,000,000.000000 0.0 2,893,000,000.0 2,893,000,000.0 237,858,000,000.00000 240,751,000,000.00000 0.0 0.0 1,153,168,000,000.000000 237,858,000,000.00000 1,893,357,000,000.000000 175,682,999,999.99 77,472,000,000.00000 250,188,000,000.00000 767,978,000,000.00000 78,208,000,000.00000 0.0 1,652,606,000,000.000000
2014-12-31 138,589,000,000.00000 380,461,000,000.00000 519,050,000,000.00000 61,845,000,000.0 0.0 580,895,000,000.00000 10,049,000,000.0 74,389,000,000.0 380,461,000,000.00000 37,830,000,000.0 1,523,639,000,000.000000 2,104,534,000,000.000000 0.0 2,697,000,000.0 3,765,000,000.0 243,139,000,000.00000 245,836,000,000.00000 0.0 1,068,000,000.0 1,118,936,000,000.000000 252,715,000,000.00000 1,861,063,000,000.000000 172,766,999,999.99 75,024,000,000.00000 243,471,000,000.00000 760,922,000,000.00000 107,247,000,000.00000 0.0 1,604,583,000,000.000000
2014-09-30 128,659,000,000.00000 368,124,000,000.00000 496,783,000,000.00000 67,092,000,000.0 0.0 563,875,000,000.00000 9,987,000,000.0 74,633,000,000.0 368,124,000,000.00000 0.0 1,559,738,000,000.000000 2,123,613,000,000.000000 0.0 2,418,000,000.0 3,418,000,000.0 250,115,000,000.00000 252,533,000,000.00000 0.0 1,000,000,000.0 1,111,981,000,000.000000 250,115,000,000.00000 1,884,932,000,000.000000 171,384,999,999.99 72,811,000,000.00000 238,681,000,000.00000 736,248,000,000.00000 123,874,000,000.00000 0.0 1,631,399,000,000.000000
2014-06-30 152,899,000,000.00000 352,883,000,000.00000 505,782,000,000.00000 65,475,000,000.0 0.0 571,257,000,000.00000 10,145,000,000.0 74,909,000,000.0 352,883,000,000.00000 0.0 1,599,300,000,000.000000 2,170,557,000,000.000000 0.0 45,873,000,000.0 45,873,000,000.0 257,071,000,000.00000 302,944,000,000.00000 0.0 0.0 1,134,329,000,000.000000 257,071,000,000.00000 1,933,146,000,000.000000 168,313,999,999.99 73,808,000,000.00000 237,411,000,000.00000 705,766,000,000.00000 150,045,000,000.00000 0.0 1,630,202,000,000.000000
2014-03-31 151,645,000,000.00000 249,981,000,000.00000 401,626,000,000.00000 64,135,000,000.0 0.0 465,761,000,000.00000 10,351,000,000.0 75,179,000,000.0 120,546,000,000.00000 0.0 1,684,090,000,000.000000 2,149,851,000,000.000000 0.0 51,409,000,000.0 51,409,000,000.0 254,785,000,000.00000 306,194,000,000.00000 0.0 0.0 1,133,650,000,000.000000 254,785,000,000.00000 1,917,963,000,000.000000 154,248,000,000.00 71,877,000,000.00000 231,888,000,000.00000 370,527,000,000.00000 154,549,000,000.00000 0.0 1,611,769,000,000.000000
2013-12-31 131,322,000,000.00000 268,795,000,000.00000 400,117,000,000.00000 59,448,000,000.0 0.0 459,565,000,000.00000 10,475,000,000.0 75,418,000,000.0 11,540,000,000.00000 43,841,000,000.0 1,642,708,000,000.000000 2,102,273,000,000.000000 0.0 45,999,000,000.0 49,067,000,000.0 249,674,000,000.00000 295,673,000,000.00000 0.0 3,068,000,000.0 1,119,271,000,000.000000 261,159,000,000.00000 1,869,588,000,000.000000 155,845,000,000.00 72,497,000,000.00000 232,685,000,000.00000 280,335,000,000.00000 164,351,000,000.00000 0.0 1,559,362,000,000.000000
2013-09-30 121,233,000,000.00000 234,896,000,000.00000 356,129,000,000.00000 60,065,000,000.0 0.0 416,194,000,000.00000 10,703,000,000.0 75,734,000,000.0 14,449,000,000.00000 0.0 1,710,459,000,000.000000 2,126,653,000,000.000000 0.0 40,769,000,000.0 40,769,000,000.0 255,331,000,000.00000 296,100,000,000.00000 0.0 0.0 1,110,118,000,000.000000 255,331,000,000.00000 1,894,371,000,000.000000 156,886,000,000.00 69,419,000,000.00000 232,282,000,000.00000 249,345,000,000.00000 174,867,000,000.00000 0.0 1,598,271,000,000.000000
2013-06-30 98,828,000,000.00000 240,154,000,000.00000 338,982,000,000.00000 67,526,000,000.0 0.0 406,508,000,000.00000 10,836,000,000.0 76,034,000,000.0 12,916,000,000.00000 0.0 1,716,812,000,000.000000 2,123,320,000,000.000000 0.0 46,470,000,000.0 46,470,000,000.0 262,480,000,000.00000 308,950,000,000.00000 0.0 0.0 1,080,783,000,000.000000 262,480,000,000.00000 1,892,288,000,000.000000 158,633,000,000.00 67,308,000,000.00000 231,032,000,000.00000 253,070,000,000.00000 210,122,000,000.00000 0.0 1,583,338,000,000.000000
2013-03-31 100,980,000,000.00000 261,850,000,000.00000 362,830,000,000.00000 70,981,000,000.0 0.0 433,811,000,000.00000 11,085,000,000.0 76,309,000,000.0 12,740,000,000.00000 0.0 1,741,008,000,000.000000 2,174,819,000,000.000000 0.0 42,148,000,000.0 42,148,000,000.0 279,641,000,000.00000 321,789,000,000.00000 0.0 0.0 1,095,183,000,000.000000 279,641,000,000.00000 1,937,526,000,000.000000 164,137,000,000.00 63,844,000,000.00000 237,293,000,000.00000 274,590,000,000.00000 220,809,000,000.00000 0.0 1,615,737,000,000.000000
2012-12-31 110,752,000,000.00000 286,906,000,000.00000 397,658,000,000.00000 71,467,000,000.0 0.0 469,125,000,000.00000 11,858,000,000.0 76,660,000,000.0 18,694,000,000.00000 48,558,000,000.0 1,740,849,000,000.000000 2,209,974,000,000.000000 0.0 30,731,000,000.0 34,408,000,000.0 275,585,000,000.00000 306,316,000,000.00000 0.0 3,677,000,000.0 1,105,261,000,000.000000 291,105,000,000.00000 1,973,018,000,000.000000 164,110,000,000.00 62,843,000,000.00000 236,956,000,000.00000 305,600,000,000.00000 195,564,000,000.00000 0.0 1,647,505,000,000.000000
2012-09-30 106,415,000,000.00000 305,949,000,000.00000 412,364,000,000.00000 66,341,000,000.0 0.0 478,705,000,000.00000 12,436,000,000.0 77,006,000,000.0 15,950,000,000.00000 0.0 1,687,457,000,000.000000 2,166,162,000,000.000000 0.0 35,291,000,000.0 35,291,000,000.0 286,534,000,000.00000 321,825,000,000.00000 0.0 0.0 1,063,307,000,000.000000 286,534,000,000.00000 1,927,556,000,000.000000 164,034,000,000.00 62,583,000,000.00000 238,606,000,000.00000 321,899,000,000.00000 215,410,000,000.00000 0.0 1,605,731,000,000.000000
2012-06-30 123,717,000,000.00000 300,049,000,000.00000 423,766,000,000.00000 71,458,000,000.0 0.0 495,224,000,000.00000 12,653,000,000.0 77,311,000,000.0 22,350,000,000.00000 0.0 1,665,630,000,000.000000 2,160,854,000,000.000000 0.0 39,019,000,000.0 39,019,000,000.0 301,848,000,000.00000 340,867,000,000.00000 0.0 0.0 1,035,225,000,000.000000 301,848,000,000.00000 1,924,879,000,000.000000 163,963,000,000.00 62,712,000,000.00000 235,975,000,000.00000 322,399,000,000.00000 217,150,000,000.00000 0.0 1,584,012,000,000.000000
2012-03-31 128,792,000,000.00000 297,040,000,000.00000 425,832,000,000.00000 74,358,000,000.0 0.0 500,190,000,000.00000 13,104,000,000.0 77,672,000,000.0 20,479,000,000.00000 0.0 1,681,259,000,000.000000 2,181,449,000,000.000000 0.0 39,254,000,000.0 39,254,000,000.0 354,912,000,000.00000 394,166,000,000.00000 0.0 0.0 1,041,311,000,000.000000 354,912,000,000.00000 1,948,950,000,000.000000 163,961,000,000.00 60,734,000,000.00000 232,499,000,000.00000 317,519,000,000.00000 265,374,000,000.00000 0.0 1,554,784,000,000.000000
2011-12-31 120,102,000,000.00000 276,151,000,000.00000 396,253,000,000.00000 66,999,000,000.0 0.0 463,252,000,000.00000 13,637,000,000.0 77,988,000,000.0 26,004,000,000.00000 47,211,000,000.0 1,665,794,000,000.000000 2,129,046,000,000.000000 0.0 35,698,000,000.0 39,901,000,000.0 372,265,000,000.00000 407,963,000,000.00000 0.0 4,203,000,000.0 1,033,041,000,000.000000 387,477,000,000.00000 1,898,945,000,000.000000 162,218,000,000.00 60,520,000,000.00000 230,101,000,000.00000 302,155,000,000.00000 287,861,000,000.00000 0.0 1,471,567,000,000.000000
2011-09-30 82,865,000,000.00000 324,267,000,000.00000 407,132,000,000.00000 89,302,000,000.0 0.0 496,434,000,000.00000 13,552,000,000.0 79,596,000,000.0 18,330,000,000.00000 0.0 1,723,194,000,000.000000 2,219,628,000,000.000000 0.0 33,869,000,000.0 33,869,000,000.0 398,965,000,000.00000 432,834,000,000.00000 0.0 0.0 1,041,353,000,000.000000 398,965,000,000.00000 1,989,376,000,000.000000 160,480,000,000.00 59,043,000,000.00000 230,252,000,000.00000 342,597,000,000.00000 349,969,000,000.00000 0.0 1,556,542,000,000.000000
2011-06-30 0.00000 0.00000 0.00000 0.0 0.0 0.00000 0.0 0.0 0.00000 0.0 0.000000 0.000000 0.0 0.0 0.0 0.00000 0.00000 0.0 0.0 0.000000 0.00000 0.000000 0.00 793,000,000.00000 0.00000 0.00000 0.00000 0.0 0.000000
2011-03-31 0.00000 0.00000 0.00000 0.0 0.0 0.00000 0.0 0.0 0.00000 0.0 0.000000 0.000000 0.0 0.0 0.0 0.00000 0.00000 0.0 0.0 0.000000 0.00000 0.000000 0.00 0.00000 0.00000 0.00000 0.00000 0.0 0.000000
2010-12-31 0.00000 0.00000 0.00000 0.0 0.0 0.00000 0.0 0.0 0.00000 0.0 0.000000 0.000000 0.0 0.0 0.0 0.00000 0.00000 0.0 0.0 0.000000 0.00000 0.000000 0.00 0.00000 0.00000 0.00000 0.00000 0.0 0.000000
2010-09-30 0.00000 0.00000 0.00000 0.0 0.0 0.00000 0.0 0.0 0.00000 0.0 0.000000 0.000000 0.0 0.0 0.0 0.00000 0.00000 0.0 0.0 0.000000 0.00000 0.000000 0.00 0.00000 0.00000 0.00000 0.00000 0.0 0.000000
2010-06-30 0.00000 0.00000 0.00000 0.0 0.0 0.00000 0.0 0.0 0.00000 0.0 0.000000 0.000000 0.0 0.0 0.0 490,083,000,000.00000 490,083,000,000.00000 0.0 0.0 0.000000 490,083,000,000.00000 490,083,000,000.000000 0.00 (4,447,000,000.00000) (490,083,000,000.00000) 0.00000 490,083,000,000.00000 0.0 0.000000
2010-03-31 144,794,000,000.00000 316,020,000,000.00000 460,814,000,000.00000 83,636,000,000.0 0.0 544,450,000,000.00000 15,147,000,000.0 97,853,000,000.0 20,256,000,000.00000 0.0 1,794,250,000,000.000000 2,338,700,000,000.000000 0.0 85,406,000,000.0 85,406,000,000.0 511,653,000,000.00000 597,059,000,000.00000 0.0 0.0 976,102,000,000.000000 511,653,000,000.00000 2,108,877,000,000.000000 155,641,000,000.00 67,811,000,000.00000 229,823,000,000.00000 336,276,000,000.00000 452,265,000,000.00000 0.0 1,511,818,000,000.000000
2009-12-31 335,474,000,000.00000 NA NA 81,996,000,000.0 0.0 NA 15,500,000,000.0 118,114,000,000.0 NA 0.0 NA 2,230,232,000,000.000000 0.0 NA NA NA 763,230,000,000.00000 0.0 0.0 991,611,000,000.000000 NA 1,998,788,000,000.000000 (5,619,000,000.00) 71,233,000,000.00000 231,444,000,000.00000 1,305,865,000,000.00000 NA NA NA
2009-09-30 363,165,000,000.00000 NA NA 0.0 0.0 NA 15,373,000,000.0 116,574,000,000.0 NA 0.0 NA 2,251,043,000,000.000000 0.0 NA NA NA 768,146,000,000.00000 0.0 0.0 974,899,000,000.000000 NA 1,993,360,000,000.000000 (6,705,000,000.00) 76,881,000,000.00000 257,683,000,000.00000 1,270,158,000,000.00000 NA NA NA
scroll_box(kable(BAC_Income, caption = "Bank of America Income Statement Data") %>% kable_styling("bordered"), height = "500px", width = "1100px" )
Bank of America Income Statement Data
date Revenue Revenue Growth Cost of Revenue Gross Profit R&D Expenses SG&A Expense Operating Expenses Operating Income Interest Expense Earnings before Tax Income Tax Expense Net Income - Non-Controlling int Net Income - Discontinued ops Net Income Preferred Dividends Net Income Com EPS EPS Diluted Weighted Average Shs Out Weighted Average Shs Out (Dil) Dividend per Share Gross Margin EBITDA Margin EBIT Margin Profit Margin Free Cash Flow margin EBITDA EBIT Consolidated Income Earnings Before Tax Margin Net Profit Margin
2019-09-30 22,807,000,000.0 (0.01199965343961190) 0.0 0.0 1,163,000,000.0 7,779,000,000.0 8,942,000,000.0 6,859,000,000.0 5,729,000,000.0 6,859,000,000.0 1,082,000,000.0 0.0 0.0 5,777,000,000.0 505,000,000.0 5,777,000,000.0 0.57 0.56 9,516,200,000.0 9,565,700,000.0 0.17343215865000 0.0 0.31994563072700 0.30074100057000 0.25329942561500 (0.2500109615470) 7,297,000,000.0 6,859,000,000.0 5,777,000,000.0 0.30074100057 0.253299425615
2019-06-30 23,084,000,000.0 0.00347765605981568 0.0 0.0 1,157,000,000.0 7,972,000,000.0 9,129,000,000.0 8,959,000,000.0 6,035,000,000.0 8,959,000,000.0 1,611,000,000.0 0.0 0.0 7,348,000,000.0 239,000,000.0 7,348,000,000.0 0.74 0.75 9,624,000,000.0 9,672,400,000.0 0.14680947851600 0.0 0.40690521573400 0.38810431467700 0.31831571651400 (0.2913273262870) 9,393,000,000.0 8,959,000,000.0 7,348,000,000.0 0.388104314677 0.318315716514
2019-03-31 23,004,000,000.0 0.01178747361013370 0.0 0.0 1,164,000,000.0 8,249,000,000.0 9,413,000,000.0 8,767,000,000.0 5,795,000,000.0 8,767,000,000.0 1,456,000,000.0 0.0 0.0 7,311,000,000.0 442,000,000.0 7,311,000,000.0 0.71 0.70 9,725,900,000.0 9,787,300,000.0 0.14876421485000 0.0 0.39927838636800 0.38110763345500 0.31781429316600 0.6564510519910 9,185,000,000.0 8,767,000,000.0 7,311,000,000.0 0.381107633455 0.317814293166
2018-12-31 22,736,000,000.0 (0.00180006146551346) 0.0 0.0 0.0 7,735,000,000.0 7,735,000,000.0 8,698,000,000.0 5,532,000,000.0 8,698,000,000.0 1,420,000,000.0 0.0 0.0 7,278,000,000.0 239,000,000.0 7,278,000,000.0 0.71 0.70 10,096,500,000.0 10,236,900,000.0 0.14379353124500 0.0 0.46767241379300 0.38256509500400 0.32010907811400 (0.6123328641800) 10,633,000,000.0 8,698,000,000.0 7,278,000,000.0 0.382565095004 0.320109078114
2018-09-30 22,777,000,000.0 0.00743066920252997 0.0 0.0 0.0 7,721,000,000.0 7,721,000,000.0 8,994,000,000.0 5,095,000,000.0 8,994,000,000.0 1,827,000,000.0 0.0 0.0 7,167,000,000.0 466,000,000.0 7,167,000,000.0 0.67 0.66 10,177,500,000.0 10,317,900,000.0 0.14508766318700 0.0 0.39544277121700 0.39487202002000 0.31465952495900 0.8607806120210 9,007,000,000.0 8,994,000,000.0 7,167,000,000.0 0.39487202002 0.314659524959
2018-06-30 22,609,000,000.0 (0.02231351351351350) 0.0 0.0 0.0 7,944,000,000.0 7,944,000,000.0 8,498,000,000.0 4,719,000,000.0 8,498,000,000.0 1,714,000,000.0 0.0 0.0 6,784,000,000.0 318,000,000.0 6,784,000,000.0 0.63 0.63 10,251,700,000.0 10,389,900,000.0 0.11722923223500 0.0 0.37936220089300 0.37586801716100 0.30005749922600 (0.2882922729890) 8,577,000,000.0 8,498,000,000.0 6,784,000,000.0 0.375868017161 0.300057499226
2018-03-31 23,125,000,000.0 0.13158152280289701 0.0 0.0 0.0 8,480,000,000.0 8,480,000,000.0 8,394,000,000.0 3,991,000,000.0 8,394,000,000.0 1,476,000,000.0 0.0 0.0 6,918,000,000.0 428,000,000.0 6,918,000,000.0 0.63 0.62 10,322,400,000.0 10,472,700,000.0 0.11811662704000 0.0 0.36454054054100 0.36298378378400 0.29915675675700 1.7450378378400 8,430,000,000.0 8,394,000,000.0 6,918,000,000.0 0.362983783784 0.299156756757
2017-12-31 20,436,000,000.0 (0.06424286826319890) 0.0 0.0 0.0 7,289,000,000.0 6,816,000,000.0 6,405,000,000.0 3,604,000,000.0 6,405,000,000.0 3,885,000,000.0 0.0 0.0 2,520,000,000.0 286,000,000.0 2,520,000,000.0 0.21 0.21 10,195,646,000.0 10,778,428,000.0 0.11680738601200 0.0 0.30906243883300 0.31341749853200 0.12331180270100 (0.3448815815230) 6,316,000,000.0 6,405,000,000.0 2,520,000,000.0 0.313417498532 0.123311802701
2017-09-30 21,839,000,000.0 (0.04336589425730430) 0.0 0.0 0.0 7,483,000,000.0 7,634,000,000.0 7,866,000,000.0 3,496,000,000.0 7,866,000,000.0 2,279,000,000.0 0.0 0.0 5,587,000,000.0 465,000,000.0 5,587,000,000.0 0.50 0.48 10,103,386,000.0 10,820,425,000.0 0.11681611397000 0.0 0.35747973808300 0.36018132698400 0.25582673199300 0.9373597692200 7,807,000,000.0 7,866,000,000.0 5,587,000,000.0 0.360181326984 0.255826731993
2017-06-30 22,829,000,000.0 0.02611470693994970 0.0 0.0 0.0 7,712,000,000.0 7,872,000,000.0 8,377,000,000.0 3,160,000,000.0 8,377,000,000.0 3,108,000,000.0 0.0 0.0 5,269,000,000.0 361,000,000.0 5,269,000,000.0 0.49 0.46 10,056,111,000.0 10,868,431,000.0 0.06873117196030 0.0 0.36738359104600 0.36694555171100 0.23080292610300 0.4304174514870 8,387,000,000.0 8,377,000,000.0 5,269,000,000.0 0.366945551711 0.230802926103
2017-03-31 22,248,000,000.0 0.11295647823912000 0.0 0.0 0.0 9,158,000,000.0 9,320,000,000.0 6,565,000,000.0 2,652,000,000.0 6,565,000,000.0 1,709,000,000.0 0.0 0.0 4,856,000,000.0 502,000,000.0 4,856,000,000.0 0.43 0.41 10,099,557,000.0 10,914,815,000.0 0.06935527537570 0.0 0.29463322545800 0.29508270406300 0.21826681050000 (0.5774002157500) 6,555,000,000.0 6,565,000,000.0 4,856,000,000.0 0.295082704063 0.2182668105
2016-12-31 19,990,000,000.0 (0.16011932271753301) 0.0 0.0 0.0 7,338,000,000.0 6,784,000,000.0 6,055,000,000.0 2,573,000,000.0 6,055,000,000.0 1,359,000,000.0 0.0 0.0 4,696,000,000.0 361,000,000.0 4,696,000,000.0 0.43 0.40 10,284,147,000.0 11,035,657,000.0 0.06959259426060 0.0 0.28379189594800 0.30290145072500 0.23491745872900 (0.4180090045020) 5,673,000,000.0 6,055,000,000.0 4,696,000,000.0 0.302901450725 0.234917458729
2016-09-30 23,801,000,000.0 0.16683008138052699 0.0 0.0 0.0 7,704,000,000.0 7,885,000,000.0 9,470,000,000.0 2,409,000,000.0 9,470,000,000.0 3,172,000,000.0 0.0 0.0 6,298,000,000.0 503,000,000.0 6,298,000,000.0 0.56 0.54 10,312,878,000.0 11,046,807,000.0 0.06970339936240 0.0 0.48262678038700 0.39788244191400 0.26461073064200 0.0220999117684 11,487,000,000.0 9,470,000,000.0 6,298,000,000.0 0.397882441914 0.264610730642
2016-06-30 20,398,000,000.0 0.04540795407954080 0.0 0.0 0.0 7,722,000,000.0 7,908,000,000.0 5,929,000,000.0 2,455,000,000.0 5,929,000,000.0 1,697,000,000.0 0.0 0.0 4,232,000,000.0 361,000,000.0 4,232,000,000.0 0.38 0.35 10,296,652,000.0 11,079,939,000.0 0.04675115991160 0.0 0.22732620845200 0.29066575154400 0.20747132071800 0.7497303657220 4,637,000,000.0 5,929,000,000.0 4,232,000,000.0 0.290665751544 0.207471320718
2016-03-31 19,512,000,000.0 0.05436074786555710 0.0 0.0 0.0 8,852,000,000.0 9,039,000,000.0 3,699,000,000.0 2,524,000,000.0 3,699,000,000.0 1,019,000,000.0 0.0 0.0 2,680,000,000.0 457,000,000.0 2,680,000,000.0 0.21 0.21 10,339,731,000.0 11,100,067,000.0 0.04657629544040 0.0 0.12623001230000 0.18957564575600 0.13735137351400 0.5557093070930 2,463,000,000.0 3,699,000,000.0 2,680,000,000.0 0.189575645756 0.137351373514
2015-12-31 18,506,000,000.0 (0.10521226187022500) 0.0 0.0 0.0 7,535,000,000.0 6,903,000,000.0 3,824,000,000.0 2,897,000,000.0 3,824,000,000.0 1,121,000,000.0 0.0 0.0 2,703,000,000.0 330,000,000.0 2,703,000,000.0 0.23 0.22 10,462,282,000.0 11,213,992,000.0 0.04637064124890 0.0 0.17848265427400 0.20663568572400 0.14606073705800 0.2956338484820 3,303,000,000.0 3,824,000,000.0 2,703,000,000.0 0.206635685724 0.146060737058
2015-09-30 20,682,000,000.0 (0.06488221729891031) 0.0 0.0 0.0 7,829,000,000.0 8,036,000,000.0 6,069,000,000.0 2,496,000,000.0 6,069,000,000.0 1,561,000,000.0 0.0 0.0 4,508,000,000.0 441,000,000.0 4,508,000,000.0 0.39 0.37 10,483,466,000.0 11,234,125,000.0 0.04628753908290 0.0 0.27903490958300 0.29344357412200 0.21796731457300 1.6875543951300 5,771,000,000.0 6,069,000,000.0 4,508,000,000.0 0.293443574122 0.217967314573
2015-06-30 22,117,000,000.0 0.04315630600886710 0.0 0.0 0.0 7,890,000,000.0 8,102,000,000.0 7,519,000,000.0 2,644,000,000.0 7,519,000,000.0 2,199,000,000.0 0.0 0.0 5,320,000,000.0 330,000,000.0 5,320,000,000.0 0.48 0.45 10,503,379,000.0 11,252,417,000.0 0.04656777295050 0.0 0.38997151512400 0.33996473301100 0.24053895193700 (0.3594972193340) 8,625,000,000.0 7,519,000,000.0 5,320,000,000.0 0.339964733011 0.240538951937
2015-03-31 21,202,000,000.0 0.13228304405874500 0.0 0.0 0.0 9,614,000,000.0 9,827,000,000.0 4,742,000,000.0 2,512,000,000.0 4,742,000,000.0 1,385,000,000.0 0.0 0.0 3,357,000,000.0 382,000,000.0 3,357,000,000.0 0.28 0.27 10,518,790,000.0 11,266,511,000.0 0.04677579420990 0.0 0.20620696160700 0.22365814545800 0.15833411942300 (0.2212998773700) 4,372,000,000.0 4,742,000,000.0 3,357,000,000.0 0.223658145458 0.158334119423
2014-12-31 18,725,000,000.0 (0.11712009052760600) 0.0 0.0 0.0 7,693,000,000.0 6,985,000,000.0 4,310,000,000.0 2,517,000,000.0 4,310,000,000.0 1,260,000,000.0 0.0 0.0 3,050,000,000.0 312,000,000.0 3,050,000,000.0 0.26 0.26 10,527,818,000.0 10,584,535,000.0 0.04960066738880 0.0 0.12090787717000 0.23017356475300 0.16288384512700 (0.0166622162884) 2,264,000,000.0 4,310,000,000.0 3,050,000,000.0 0.230173564753 0.162883845127
2014-09-30 21,209,000,000.0 (0.02473904446590330) 0.0 0.0 0.0 8,039,000,000.0 8,273,000,000.0 431,000,000.0 2,639,000,000.0 431,000,000.0 663,000,000.0 0.0 0.0 (232,000,000.0) 238,000,000.0 (232,000,000.0) (0.04) (0.04) 10,531,688,000.0 10,587,841,000.0 0.00311678273219 0.0 0.04979018341270 0.02032156160120 (0.01093875241640) (0.0212174077043) 1,056,000,000.0 431,000,000.0 (232,000,000.0) 0.0203215616012 -0.0109387524164
2014-06-30 21,747,000,000.0 (0.03629353895240630) 0.0 0.0 0.0 8,306,000,000.0 8,541,000,000.0 2,795,000,000.0 2,928,000,000.0 2,795,000,000.0 504,000,000.0 0.0 0.0 2,291,000,000.0 256,000,000.0 2,291,000,000.0 0.19 0.19 10,539,769,000.0 10,599,641,000.0 0.03396341442130 0.0 0.15730905412200 0.12852347450200 0.10534786407300 0.2197084655350 3,421,000,000.0 2,795,000,000.0 2,291,000,000.0 0.128523474502 0.105347864073
2014-03-31 22,566,000,000.0 0.05016753536857780 0.0 0.0 0.0 9,749,000,000.0 9,988,000,000.0 (681,000,000.0) 2,850,000,000.0 (681,000,000.0) (405,000,000.0) 0.0 0.0 (276,000,000.0) 238,000,000.0 (276,000,000.0) (0.05) (0.05) 10,560,518,000.0 10,560,518,000.0 0.03257415971450 0.0 (0.00230435167952) (0.03017814411060) (0.01223078968360) 1.0069573694900 (52,000,000.0) (681,000,000.0) (276,000,000.0) -0.0301781441106 -0.0122307896836
2013-12-31 21,488,000,000.0 (0.00195076637250348) 0.0 0.0 0.0 7,987,000,000.0 8,253,000,000.0 8,180,000,000.0 2,926,000,000.0 16,172,000,000.0 406,000,000.0 0.0 0.0 3,439,000,000.0 256,000,000.0 3,439,000,000.0 0.30 0.28 10,731,165,000.0 11,491,418,000.0 0.03141474794490 0.0 0.41148548026800 0.38067758749100 0.16004281459400 0.5581720029780 8,842,000,000.0 8,180,000,000.0 3,439,000,000.0 0.752606105733 0.160042814594
2013-09-30 21,530,000,000.0 (0.05266863202358430) 0.0 0.0 0.0 8,310,000,000.0 8,580,000,000.0 2,497,000,000.0 3,116,000,000.0 0.0 2,348,000,000.0 0.0 0.0 2,497,000,000.0 279,000,000.0 2,497,000,000.0 0.21 0.20 10,764,216,000.0 11,523,649,000.0 0.03141366072500 0.0 0.14653971203000 0.11597770552700 0.11597770552700 0.3821179749190 3,155,000,000.0 2,497,000,000.0 2,497,000,000.0 0.0 0.115977705527
2013-06-30 22,727,000,000.0 (0.02026124067767380) 0.0 0.0 0.0 8,531,000,000.0 8,805,000,000.0 4,012,000,000.0 3,276,000,000.0 0.0 1,486,000,000.0 0.0 0.0 4,012,000,000.0 441,000,000.0 4,012,000,000.0 0.33 0.32 10,787,357,000.0 11,549,693,000.0 0.04086688711120 0.0 0.20627447529400 0.17653011836100 0.17653011836100 2.0296563558800 4,688,000,000.0 4,012,000,000.0 4,012,000,000.0 0.0 0.176530118361
2013-03-31 23,197,000,000.0 0.24314040728831701 0.0 0.0 0.0 9,891,000,000.0 10,167,000,000.0 1,483,000,000.0 3,437,000,000.0 0.0 501,000,000.0 0.0 0.0 1,483,000,000.0 373,000,000.0 1,483,000,000.0 0.10 0.10 10,798,975,000.0 11,154,778,000.0 0.04321018311610 0.0 0.09354657929900 0.06393068069150 0.06393068069150 1.1410096133100 2,170,000,000.0 1,483,000,000.0 1,483,000,000.0 0.0 0.0639306806915
2012-12-31 18,660,000,000.0 (0.08654787546504800) 0.0 0.0 0.0 8,300,000,000.0 8,609,000,000.0 (1,904,000,000.0) 3,647,000,000.0 (1,904,000,000.0) (2,636,000,000.0) 0.0 0.0 732,000,000.0 365,000,000.0 732,000,000.0 0.04 0.03 10,746,028,000.0 10,840,854,000.0 0.04353900532190 0.0 (0.06259378349410) (0.10203644158600) 0.03922829581990 (1.3884780278700) (1,168,000,000.0) (1,904,000,000.0) 732,000,000.0 -0.102036441586 0.0392282958199
2012-09-30 20,428,000,000.0 (0.07010196649672250) 0.0 0.0 0.0 8,431,000,000.0 8,746,000,000.0 1,110,000,000.0 4,038,000,000.0 1,110,000,000.0 770,000,000.0 0.0 0.0 340,000,000.0 373,000,000.0 340,000,000.0 (0.01) 0.00 10,735,461,000.0 10,826,503,000.0 0.04350435223640 0.0 0.09114940278050 0.05433718425690 0.01664382220480 0.4551595848830 1,862,000,000.0 1,110,000,000.0 340,000,000.0 0.0543371842569 0.0166438222048
2012-06-30 21,968,000,000.0 (0.01391507316635250) 0.0 0.0 0.0 8,729,000,000.0 9,050,000,000.0 3,147,000,000.0 4,444,000,000.0 3,147,000,000.0 684,000,000.0 0.0 0.0 2,463,000,000.0 365,000,000.0 2,463,000,000.0 0.20 0.19 10,714,881,000.0 11,509,945,000.0 0.04196371051300 0.0 0.17798616169000 0.14325382374400 0.11211762563700 0.8355790240350 3,910,000,000.0 3,147,000,000.0 2,463,000,000.0 0.143253823744 0.112117625637
2012-03-31 22,278,000,000.0 (0.10486981677917100) 0.0 0.0 0.0 10,188,000,000.0 10,507,000,000.0 719,000,000.0 4,615,000,000.0 719,000,000.0 66,000,000.0 0.0 0.0 653,000,000.0 325,000,000.0 653,000,000.0 0.03 0.03 10,651,367,000.0 10,761,917,000.0 0.04488047993680 0.0 0.06760032318880 0.03227399227940 0.02931142831490 (0.7003770535950) 1,506,000,000.0 719,000,000.0 653,000,000.0 0.0322739922794 0.0293114283149
2011-12-31 24,888,000,000.0 (0.64104709021417705) 0.0 0.0 0.0 8,761,000,000.0 9,126,000,000.0 315,000,000.0 4,712,000,000.0 1,718,000,000.0 441,000,000.0 0.0 0.0 1,991,000,000.0 407,000,000.0 1,991,000,000.0 0.16 0.16 10,142,625,000.0 10,254,824,000.0 0.04631966379920 0.0 0.04660880745740 0.01265670202510 0.07999839279970 0.9902362584380 1,160,000,000.0 315,000,000.0 1,991,000,000.0 0.0690292510447 0.0799983927997
2011-09-30 69,335,000,000.0 (53.44704992435700319) 0.0 0.0 0.0 28,204,000,000.0 29,348,000,000.0 (545,000,000.0) 16,908,000,000.0 (1,948,000,000.0) (2,117,000,000.0) 0.0 0.0 (545,000,000.0) 954,000,000.0 (545,000,000.0) (0.15) (0.15) 10,095,859,000.0 10,095,859,000.0 0.12510079627700 0.0 0.03021561981680 (0.00786038797144) (0.00786038797144) 0.5746736857290 2,095,000,000.0 (545,000,000.0) (545,000,000.0) -0.0280954784741 -0.00786038797144
2011-06-30 (1,322,000,000.0) (3.39059674502711994) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00 0.00 0.0 0.0 0.00000000000000 0.0 0.00000000000000 0.00000000000000 0.00000000000000 0.0000000000000 0.0 0.0 0.0 -0.0 -0.0
2011-03-31 553,000,000.0 (1.42181540808542994) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00 0.00 0.0 0.0 0.00000000000000 0.0 0.00000000000000 0.00000000000000 0.00000000000000 0.0000000000000 0.0 0.0 0.0 0.0 0.0
2010-12-31 (1,311,000,000.0) (3.29999999999999982) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00 0.00 0.0 0.0 0.00000000000000 0.0 0.00000000000000 0.00000000000000 0.00000000000000 0.0000000000000 0.0 0.0 0.0 -0.0 -0.0
2010-09-30 570,000,000.0 (1.01862075724412993) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00 0.00 0.0 0.0 0.00000000000000 0.0 0.00000000000000 0.00000000000000 0.00000000000000 0.0000000000000 0.0 0.0 0.0 0.0 0.0
2010-06-30 (30,611,000,000.0) (1.95752134880666007) 0.0 0.0 0.0 (9,158,000,000.0) (9,604,000,000.0) (4,389,000,000.0) (6,130,000,000.0) (4,389,000,000.0) (1,207,000,000.0) 0.0 0.0 (3,182,000,000.0) (348,000,000.0) (3,182,000,000.0) (0.28) (0.28) 0.0 0.0 0.00000000000000 0.0 0.17643984188700 0.14337983078000 0.10394956061500 0.7799810525630 (5,401,000,000.0) (4,389,000,000.0) (3,182,000,000.0) 0.14337983078 0.103949560615
2010-03-31 31,969,000,000.0 0.27488435157122298 0.0 0.0 0.0 9,158,000,000.0 9,604,000,000.0 4,389,000,000.0 6,130,000,000.0 4,389,000,000.0 1,207,000,000.0 0.0 0.0 3,182,000,000.0 348,000,000.0 3,182,000,000.0 0.28 0.28 9,177,468,000.0 10,005,254,000.0 0.04497636941550 0.0 0.16894491538700 0.13728924896000 0.09953392348840 0.7468485094940 5,401,000,000.0 4,389,000,000.0 3,182,000,000.0 0.13728924896 0.0995339234884
2009-12-31 25,076,000,000.0 (0.03683502976762050) 0.0 25,076,000,000.0 0.0 15,420,000,000.0 16,385,000,000.0 8,691,000,000.0 0.0 (1,419,000,000.0) (1,225,000,000.0) 0.0 0.0 (194,000,000.0) 5,002,000,000.0 (5,196,000,000.0) (0.68) (0.68) 8,650,759,836.0 8,644,257,000.0 0.01000000000000 1.0 (0.01600000000000) (0.05660000000000) (0.20700000000000) 1.2500000000000 (406,000,000.0) (1,419,000,000.0) (194,000,000.0) -0.0566 -0.0077
2009-09-30 26,035,000,000.0 (0.20562030878135101) 0.0 26,035,000,000.0 0.0 15,202,000,000.0 16,306,000,000.0 9,729,000,000.0 0.0 (1,976,000,000.0) (975,000,000.0) 0.0 0.0 (1,001,000,000.0) 1,240,000,000.0 (2,241,000,000.0) (0.26) (0.26) 8,651,594,786.0 8,633,834,000.0 0.01000000000000 1.0 (0.03400000000000) (0.07590000000000) (0.08600000000000) 0.8686000000000 (880,000,000.0) (1,976,000,000.0) (1,001,000,000.0) -0.0759 -0.0384
2009-06-30 32,774,000,000.0 0.60580000000000001 0.0 32,774,000,000.0 0.0 15,675,000,000.0 17,020,000,000.0 15,754,000,000.0 0.0 2,379,000,000.0 (845,000,000.0) 0.0 0.0 3,224,000,000.0 805,000,000.0 2,419,000,000.0 0.33 0.33 7,241,515,000.0 7,269,518,000.0 0.01000000000000 1.0 0.10600000000000 0.07260000000000 0.07400000000000 0.5878000000000 3,486,000,000.0 2,379,000,000.0 3,224,000,000.0 0.0726 0.0984
Accounting Ratios Being Analyzed

Accounting ratio data such as current ratios1, debt-equity ratio2, and PE ratio3 comes from web-scraping macrotrends.com. See below the code used to scrape the data.

Current Ratio:

\(Current\:Ratio = \frac{Current\:Assets}{Current\:Liabilities}\)

The Current Ratio is a metric used to measure a company’s short-term liquidity with respect to its available assets and pending liablities. A lower Current Ratio (under 1) may indicate that a liquidity problem within the company, whereas a high Current Ratio (above 3) indicates idle assets that are not being efficiently used to generate revenues.

Debt to Equity Ratio:

\(D/E\:Ratio = \frac{Total\:Liabilities}{Total\:Shareholders'\:Equity}\)

The Debt to Equity Ratio is a metric used to measure how much of the company’s operations are being funded by financing means. The Debt to Equity Ratio reflects the ability of shareholder equity to cover all outstanding debts in the event of a business downturn. A high debt/equity ratio is associated with high risk as it means a company has taken on a large amount of debt vs it’s own cash to fund growth. Businesses who engage in this method to fund growth must be sure that the returns of their growth are greater than the cost of financing, else it would have not been worth it to take on debt.

Price to Earnings Ratio:

\(P/E\:Ratio = \frac{Market\:Value\:per\:Share}{Earnings\:per\:Share}\)

The Price to Earning Ratio is the ratio for valueing a company that measures current share price relative to its Earnings per Share. The P/E ratio is useful for comparing a company’s shares to others on a level field, taking into account the varying number of shares outstanding for different companies. Companies that have no earnings or are losing money have no P/E ratio.

library(rvest)
library(readr)

url <- "https://www.macrotrends.net/stocks/charts/BAC/bank-of-america/current-ratio"

data <- url %>%
    html() %>%
      html_nodes("#main_content") %>%
        html_text()
        
startInt <- regexpr("Bank Of America Current Ratio Historical Data", data)

endInt <- regexpr("Sector", data)

txt <- substr(data,startInt-45,endInt)

rm(data)
rm(startInt)
rm(endInt)
rm(url)

fileConn2 <- file("output2.txt")
writeLines(txt,fileConn2)
close(fileConn2)
rm(txt)

dat1 <- read_table("./output2.txt")
dat1 <- data.table(dat1)
dat1 <- dat1[!1:7,]
dat2 <- data.table(Dates = dat1[seq(1,249,by = 4),] , `Current Assets` = dat1[seq(2,249,by = 4),] , `Current Liabilities` = dat1[seq(3,249,by = 4),], `Current Ratio` = dat1[seq(4,249,by = 4),] )

rm(dat1)

colnames(dat2) <- as.character(dat2[1,])
dat2 <- dat2[-1,]
dat2 <- dat2[-c(61,62),]

rm(fileConn2)

currentRatio <- dat2
rm(dat2)

scroll_box(kable(currentRatio, caption = "Bank of America Current Ratio") %>% kable_styling("striped"), height = "700px", width = "500px" )
Bank of America Current Ratio
Date Current Assets Current Liabilities Current Ratio
2019-12-31 $1,712.20B $1,890.18B 0.91
2019-09-30 $1,725.78B $1,876.51B 0.92
2019-06-30 $1,693.17B $1,848.09B 0.92
2019-03-31 $1,683.01B $1,839.89B 0.92
2018-12-31 $1,673.85B $1,821.90B 0.92
2018-09-30 $1,642.68B $1,806.39B 0.91
2018-06-30 $1,599.42B $1,767.25B 0.91
2018-03-31 $1,646.59B $1,796.10B 0.92
2017-12-31 $1,590.10B $1,752.39B 0.91
2017-09-30 $1,594.93B $1,750.99B 0.91
2017-06-30 $1,573.44B $1,724.74B 0.91
2017-03-31 $1,569.18B $1,721.74B 0.91
2016-12-31 $1,499.30B $1,665.57B 0.90
2016-09-30 $1,516.62B $1,656.61B 0.92
2016-06-30 $1,526.18B $1,642.36B 0.93
2016-03-31 $1,537.69B $1,648.81B 0.93
2015-12-31 $1,486.62B $1,612.90B 0.92
2015-09-30 $1,510.93B $1,613.95B 0.94
2015-06-30 $1,505.32B $1,610.38B 0.94
2015-03-31 $1,501.26B $1,603.27B 0.94
2014-12-31 $1,471.36B $1,571.02B 0.94
2014-09-30 $1,499.53B $1,590.58B 0.94
2014-06-30 $1,558.71B $1,637.43B 0.95
2014-03-31 $1,551.74B $1,626.27B 0.95
2013-12-31 $1,515.80B $1,582.51B 0.96
2013-09-30 $1,538.92B $1,594.47B 0.97
2013-06-30 $1,509.56B $1,581.28B 0.96
2013-03-31 $1,536.78B $1,610.06B 0.95
2012-12-31 $1,551.67B $1,651.42B 0.94
2012-09-30 $1,517.07B $1,589.65B 0.95
2012-06-30 $1,523.68B $1,571.52B 0.97
2012-03-31 $1,542.24B $1,544.87B 1.00
2011-12-31 $1,499.79B $1,467.16B 1.02
2011-09-30 $1,537.43B $1,531.11B 1.00
2011-06-30 $1,582.53B $1,558.07B 1.02
2011-03-31 $1,578.97B $1,555.72B 1.02
2010-12-31 $1,558.46B $1,532.32B 1.02
2010-09-30 $1,631.78B $1,568.65B 1.04
2010-06-30 $1,652.23B $1,577.83B 1.05
2010-03-31 $1,616.34B $1,550.30B 1.04
2009-12-31 $1,506.48B $1,509.61B 1.00
2009-09-30 $1,486.56B $1,484.45B 1.00
2009-06-30 $1,509.69B $1,500.76B 1.01
2009-03-31 $1,541.94B $1,565.08B 0.99
2008-12-31 $1,236.66B $1,341.89B 0.92
2008-09-30 $1,262.69B $1,385.96B 0.91
2008-06-30 $1,175.02B $1,326.48B 0.89
2008-03-31 $1,194.28B $1,348.22B 0.89
2007-12-31 $1,245.10B $1,349.01B 0.92
2007-09-30 $1,142.30B $1,235.76B 0.92
2007-06-30 $1,112.29B $1,204.15B 0.92
2007-03-31 $1,071.35B $1,196.79B 0.90
2006-12-31 $1,036.39B $1,162.13B 0.89
2006-09-30 $980.33B $1,162.48B 0.84
2006-06-30 $979.42B $1,169.66B 0.84
2006-03-31 $908.45B $1,106.94B 0.82
2005-12-31 $897.04B $1,074.42B 0.84
2005-09-30 $846.95B $1,035.41B 0.82
2005-06-30 $840.66B $1,033.27B 0.81
2005-03-31 $825.43B $999.59B 0.83
library(rvest)
library(readr)

url <- "https://www.macrotrends.net/stocks/charts/BAC/bank-of-america/debt-equity-ratio"

data <- url %>%
    html() %>%
      html_nodes("#main_content") %>%
        html_text()
        
startInt <- regexpr("Bank Of America Debt/Equity Ratio Historical Data", data)

endInt <- regexpr("Sector", data)

txt <- substr(data,startInt-45,endInt)

rm(data)
rm(startInt)
rm(endInt)
rm(url)

fileConn2 <- file("output2.txt")
writeLines(txt,fileConn2)
close(fileConn2)
rm(txt)

dat1 <- read_table("./output2.txt")
dat1 <- data.table(dat1)
dat1 <- dat1[!1:7,]
dat1 <- na.omit(dat1)
dat2 <- data.table(Dates = dat1[seq(1,249,by = 4),] , `Long Term Debt` = dat1[seq(2,249,by = 4),] , `Shareholder's Equity` = dat1[seq(3,249,by = 4),], `Debt to Equity Ratio` = dat1[seq(4,249,by = 4),] )

rm(dat1)

colnames(dat2) <- as.character(dat2[1,])
dat2 <- dat2[-1,]
dat2 <- dat2[-c(61,62),]

rm(fileConn2)

DebtToEquityRatio <- dat2
rm(dat2)

scroll_box(kable(DebtToEquityRatio, caption = "Bank of America Debt To Equity Ratio") %>% kable_styling("striped") , height = "700px", width = "500px" )
Bank of America Debt To Equity Ratio
Date Long Term Debt Shareholder’s Equity Debt to Equity Ratio
2019-12-31 $240.86B $241.41B 1.00
2019-09-30 $243.41B $244.78B 0.99
2019-06-30 $238.01B $246.72B 0.97
2019-03-31 $233.93B $244.68B 0.96
2018-12-31 $229.39B $243.00B 0.94
2018-09-30 $234.10B $239.83B 0.98
2018-06-30 $226.60B $241.04B 0.94
2018-03-31 $232.26B $241.55B 0.96
2017-12-31 $227.40B $244.82B 0.93
2017-09-30 $228.67B $250.14B 0.91
2017-06-30 $223.92B $245.77B 0.91
2017-03-31 $221.39B $242.93B 0.91
2016-12-31 $216.82B $240.98B 0.90
2016-09-30 $225.14B $244.86B 0.92
2016-06-30 $229.62B $241.85B 0.95
2016-03-31 $232.85B $238.43B 0.98
2015-12-31 $236.76B $233.90B 1.01
2015-09-30 $237.29B $233.63B 1.02
2015-06-30 $243.41B $229.39B 1.06
2015-03-31 $237.86B $227.92B 1.04
2014-12-31 $243.14B $224.16B 1.09
2014-09-30 $250.12B $220.77B 1.13
2014-06-30 $257.07B $222.57B 1.16
2014-03-31 $254.79B $218.54B 1.17
2013-12-31 $249.67B $219.33B 1.14
2013-09-30 $255.33B $218.97B 1.17
2013-06-30 $262.48B $216.79B 1.21
2013-03-31 $279.64B $218.51B 1.28
2012-12-31 $275.59B $218.19B 1.26
2012-09-30 $286.53B $219.84B 1.30
2012-06-30 $301.85B $217.21B 1.39
2012-03-31 $354.91B $213.71B 1.66
2011-12-31 $372.27B $211.70B 1.76
2011-09-30 $398.97B $210.77B 1.89
2011-06-30 $426.66B $205.61B 2.08
2011-03-31 $434.44B $214.31B 2.03
2010-12-31 $448.43B $211.69B 2.12
2010-09-30 $478.86B $212.39B 2.26
2010-06-30 $490.08B $215.18B 2.28
2010-03-31 $511.65B $211.86B 2.42
2009-12-31 $438.52B $194.24B 2.26
2009-09-30 $456.29B $198.84B 2.30
2009-06-30 $447.19B $196.49B 2.28
2009-03-31 $440.75B $166.27B 2.65
2008-12-31 $268.29B $139.35B 1.93
2008-09-30 $257.71B $136.89B 1.88
2008-06-30 $206.61B $138.54B 1.49
2008-03-31 $202.80B $139.00B 1.46
2007-12-31 $197.51B $142.39B 1.39
2007-09-30 $185.48B $135.11B 1.37
2007-06-30 $169.32B $132.90B 1.27
2007-03-31 $152.56B $132.01B 1.16
2006-12-31 $146.00B $132.42B 1.10
2006-09-30 $137.74B $132.77B 1.04
2006-06-30 $129.06B $127.57B 1.01
2006-03-31 $123.18B $129.16B 0.95
2005-12-31 $100.85B $101.26B 1.00
2005-09-30 $99.89B $100.99B 0.99
2005-06-30 $96.89B $100.27B 0.97
2005-03-31 $98.76B $98.25B 1.01
library(rvest)
library(readr)

url <- "https://www.macrotrends.net/stocks/charts/BAC/bank-of-america/pe-ratio"

data <- url %>%
    html() %>%
      html_nodes("#main_content") %>%
        html_text()
        
startInt <- regexpr("Bank Of America PE Ratio Historical Data", data)

endInt <- regexpr("Sector", data)

txt <- substr(data,startInt-45,endInt)

rm(data)
rm(startInt)
rm(endInt)
rm(url)

fileConn2 <- file("output2.txt")
writeLines(txt,fileConn2)
close(fileConn2)
rm(txt)

dat1 <- read_table("./output2.txt")
dat1 <- data.table(dat1)
dat1 <- dat1[!1:7,]
dat1 <- na.omit(dat1)
dat2 <- data.table(Dates = dat1[seq(1,249,by = 4),] , `Stock Price` = dat1[seq(2,249,by = 4),] , `TTM Net EPS` = dat1[seq(3,249,by = 4),], `PE Ratio` = dat1[seq(4,249,by = 4),] )

rm(dat1)

colnames(dat2) <- as.character(dat2[1,])
dat2 <- dat2[-1,]

dat2 <- dat2[-(55:62),]

rm(fileConn2)

PERatios <- dat2
rm(dat2)

scroll_box(kable(PERatios, caption = "Bank of America Price to Earning Ratio") %>% kable_styling("striped") , height = "700px", width = "500px" )
Bank of America Price to Earning Ratio
Date Stock Price TTM Net EPS PE Ratio
2020-02-14 34.85 12.72
2019-12-31 35.22 $2.74 12.85
2019-09-30 29.17 $2.70 10.80
2019-06-30 29.00 $2.80 10.36
2019-03-31 27.59 $2.69 10.26
2018-12-31 24.64 $2.61 9.44
2018-09-30 29.29 $2.11 13.88
2018-06-30 27.89 $1.93 14.45
2018-03-31 29.55 $1.76 16.79
2017-12-31 28.98 $1.55 18.70
2017-09-30 24.77 $1.75 14.15
2017-06-30 23.60 $1.68 14.05
2017-03-31 22.87 $1.58 14.47
2016-12-31 21.36 $1.38 15.48
2016-09-30 15.07 $1.26 11.96
2016-06-30 12.72 $1.22 10.43
2016-03-31 12.92 $1.31 9.86
2015-12-31 16.02 $1.37 11.69
2015-09-30 14.79 $1.34 11.04
2015-06-30 16.11 $0.96 16.78
2015-03-31 14.52 $0.70 20.74
2014-12-31 16.83 $0.38 44.28
2014-09-30 15.99 $0.42 38.07
2014-06-30 14.37 $0.63 22.81
2014-03-31 16.07 $0.76 21.14
2013-12-31 14.54 $1.01 14.39
2013-09-30 12.88 $0.75 17.17
2013-06-30 11.99 $0.55 21.80
2013-03-31 11.35 $0.42 27.02
2012-12-31 10.81 $0.25 43.23
2012-09-30 8.21 $0.37 22.20
2012-06-30 7.60 $0.95 8.00
2012-03-31 8.88 $-0.14 0.00
2011-12-31 5.15 $-0.00 0.00
2011-09-30 5.66 $-0.31 0.00
2011-06-30 10.12 $-1.66 0.00
2011-03-31 12.30 $-0.49 0.00
2010-12-31 12.30 $-0.38 0.00
2010-09-30 12.07 $-0.82 0.00
2010-06-30 13.23 $-0.31 0.00
2010-03-31 16.42 $-0.25 0.00
2009-12-31 13.85 $-0.09 0.00
2009-09-30 15.55 $0.03 518.24
2009-06-30 12.12 $0.44 27.55
2009-03-31 6.26 $0.83 7.54
2008-12-31 12.88 $0.62 20.78
2008-09-30 31.36 $1.15 27.27
2008-06-30 20.98 $1.82 11.53
2008-03-31 32.66 $2.38 13.72
2007-12-31 34.95 $3.31 10.56
2007-09-30 41.99 $4.42 9.50
2007-06-30 40.32 $4.78 8.44
2007-03-31 41.62 $4.69 8.87
2006-12-31 43.08 $4.60 9.37

Data Transformations

In order to analyze all the data, it is important to aggregate it together into a format that makes analysis convenient while also preserving all relevant meta-data. The following code merges the balance sheet, income statement, and various accounting ratio data into a single dataset that makes analyzing the variables against each other easy. Primarily, the various datasets are being matched to each other by using the date as a “primary key” for matching. Earlier data prior to 2011 was omitted to due data sufficiency reasons.

BAC_balance_sht <- quarterlyBalanceSheet("BAC")
##merge current ratio
colnames(currentRatio) <- c("date","crr assets","Crr liabilities", "current Ratio")
currentRatio$date <- as.Date.character(currentRatio$date)
BAC_balance_sht <- merge.data.table(BAC_balance_sht,currentRatio, by.x = "date", by.y = "date", all.x = TRUE, all.y = FALSE)
BAC_balance_sht$`crr assets` <- gsub("B","",BAC_balance_sht$`crr assets`)
BAC_balance_sht$`Crr liabilities` <- gsub("B","",BAC_balance_sht$`Crr liabilities`)
BAC_balance_sht$`crr assets` <- gsub("[[:punct:]]","",BAC_balance_sht$`crr assets`)
BAC_balance_sht$`Crr liabilities` <- gsub("[[:punct:]]","",BAC_balance_sht$`Crr liabilities`)
BAC_balance_sht$`crr assets` <- as.numeric(BAC_balance_sht$`crr assets`) * 10000000
BAC_balance_sht$`Crr liabilities` <- as.numeric(BAC_balance_sht$`Crr liabilities`) * 10000000
BAC_balance_sht$`crr assets` <- accounting(BAC_balance_sht$`crr assets`)
BAC_balance_sht$`Crr liabilities` <- accounting(BAC_balance_sht$`Crr liabilities`)
BAC_balance_sht$`current Ratio` <- as.numeric(BAC_balance_sht$`current Ratio`)

##merge debt to equity
colnames(DebtToEquityRatio) <- c("date","longTermDebt","shareholdersEquity", "debtToEquity")
DebtToEquityRatio$date <- as.Date.character(DebtToEquityRatio$date)
BAC_balance_sht <- merge.data.table(BAC_balance_sht,DebtToEquityRatio, by.x = "date", by.y = "date", all.x = TRUE, all.y = FALSE)
BAC_balance_sht$`longTermDebt` <- gsub("B","",BAC_balance_sht$`longTermDebt`)
BAC_balance_sht$`shareholdersEquity` <- gsub("B","",BAC_balance_sht$`shareholdersEquity`)
BAC_balance_sht$`longTermDebt` <- gsub("[[:punct:]]","",BAC_balance_sht$`longTermDebt`)
BAC_balance_sht$`shareholdersEquity` <- gsub("[[:punct:]]","",BAC_balance_sht$`shareholdersEquity`)
BAC_balance_sht$`longTermDebt` <- as.numeric(BAC_balance_sht$`longTermDebt`) * 10000000
BAC_balance_sht$`shareholdersEquity` <- as.numeric(BAC_balance_sht$`shareholdersEquity`) * 10000000
BAC_balance_sht$`longTermDebt` <- accounting(BAC_balance_sht$`longTermDebt`)
BAC_balance_sht$`shareholdersEquity` <- accounting(BAC_balance_sht$`shareholdersEquity`)
BAC_balance_sht$`debtToEquity` <- as.numeric(BAC_balance_sht$`debtToEquity`)

##merge pe ratio

PERatios$Date <- as.Date.character(PERatios$Date)
BAC_balance_sht <- merge.data.table(BAC_balance_sht,PERatios, by.x = "date", by.y = "Date", all.x = TRUE, all.y = FALSE)
BAC_balance_sht$`PE Ratio` <- as.numeric(BAC_balance_sht$`PE Ratio`)
BAC_balance_sht$`Stock Price` <- as.numeric(BAC_balance_sht$`Stock Price`)
BAC_balance_sht$`TTM Net EPS` <- gsub("\\$", "", BAC_balance_sht$`TTM Net EPS`)
BAC_balance_sht$`TTM Net EPS` <- as.numeric(BAC_balance_sht$`TTM Net EPS`)

##omitting earlier data as some info is missing
BAC_balance_sht <- BAC_balance_sht[-(1:8),]

#removing some variables as are irrelevant
BAC_balance_sht[,c("Inventories","Payables","Deferred revenue","Other Assets") := NULL]

#pulling in income statement
BAC_income_statement <- incomeStatement("BAC")
BAC_income_statement[,c("Cost of Revenue","Gross Profit","R&D Expenses","Net Income - Non-Controlling int", "Net Income - Discontinued ops", "Gross Margin") := NULL]

##merging income statement with balance sheet for convenience

BAC_All_Statement <- merge.data.table(BAC_balance_sht,BAC_income_statement,by = "date", all.x = TRUE, all.y = FALSE)
BAC_All_Statement$`Earnings Before Tax Margin` <- as.numeric(BAC_All_Statement$`Earnings Before Tax Margin`)
BAC_All_Statement$`Net Profit Margin` <- as.numeric(BAC_All_Statement$`Net Profit Margin`)

##kable(BAC_All_Statement, caption = "Bank of America Consolidated Accounting Data") %>% kable_styling("condensed")
formatCurrency(datatable(BAC_All_Statement,
          extensions = 'Buttons', 
          options = list(
    scrollX = TRUE,
    dom = 'Bfrtip',
    buttons = c('copy', 'print')
  )
                 ), columns = colnames(BAC_All_Statement)[-which(names(BAC_All_Statement) %in% c("date", "current Ratio", "debtToEquity", "PE Ratio"))],

  )

Correlation Matrix

When treating each entry on the balance sheet as a seperate variable and each ratio as a variable, there are 60 variables. It is important to understand the relationships between all the different variables. Below is a correlation matrix heat map that provides a visualization on how different variables are correlated with each other.

library(knitr)
library(kableExtra)
library(scales)
library(ggplot2)
library(RColorBrewer)
library(plotly)
library(ggrepel)
correlationMatrix <- cor(BAC_All_Statement[,2:60])
# heatmap(correlationMatrix,Colv = NA, Rowv = NA ,scale="column", cexRow=0.8, col= colorRampPalette(brewer.pal(8, "Blues"))(25))

 correlationMatrix2 <- data.table(correlationMatrix,keep.rownames = TRUE)
 
 correlationMatrix2 <- melt.data.table(correlationMatrix2, id.vars = 1,measure.vars = 2:60)
 
 ggplotly(ggplot(correlationMatrix2, aes(rn, variable) ) +
    geom_tile(aes(fill = value)) + 
    geom_text(aes(label = round(value, 2))) +
    scale_fill_gradient(low = "white", high = "lightblue") 
    )

The following are variables with strongly positively correlated relationships with each other.

k <- which(correlationMatrix > 0.80, arr.ind = TRUE)

positiveRelations <- data.table( variable1 = rownames(correlationMatrix)[k[,1]], variable2 = colnames(correlationMatrix)[k[,2]], correlation = correlationMatrix[k])
##omit correlations of 1

positiveRelations <- positiveRelations[!correlation == 1,]

positiveRelations <- positiveRelations[!duplicated(positiveRelations$correlation),]
setorder(positiveRelations, -correlation)

datatable(positiveRelations)

Correlations that involve the accouning ratios we are interested in include the following. There appears to be NO strongly positive relations between the price to earning ratio and any other element on the balance sheet or income statement.

positiveCurrentRatioCorrel <- positiveRelations[variable1 %like% "current Ratio",]

kable(positiveCurrentRatioCorrel, caption = "Positive Correlations with the Current Ratio") %>% kable_styling("striped")
Positive Correlations with the Current Ratio
variable1 variable2 correlation
current Ratio Total debt 0.9314173
current Ratio Long-term debt 0.9008346
current Ratio Net Debt 0.8988680
current Ratio Total non-current liabilities 0.8977222
current Ratio Goodwill and Intangible Assets 0.8889521
current Ratio Property, Plant & Equipment Net 0.8646112
positiveDebtToEquityCorrel <- positiveRelations[variable1 %like% "debtToEquity",]

kable(positiveDebtToEquityCorrel, caption = "Positive Correlations with the Debt to Equity Ratio") %>% kable_styling("striped")
Positive Correlations with the Debt to Equity Ratio
variable1 variable2 correlation
debtToEquity Long-term debt 0.9907085
debtToEquity longTermDebt 0.9907026
debtToEquity Total non-current liabilities 0.9877031
debtToEquity Total debt 0.9811738
debtToEquity Net Debt 0.9532704
debtToEquity Property, Plant & Equipment Net 0.9401397
debtToEquity current Ratio 0.9337540
debtToEquity Goodwill and Intangible Assets 0.8746961
debtToEquity Receivables 0.8304065

To dive further into the relationships between ratios and the variables they are positively correlated to, it helps to plot them on a graph to visualize the relationship. First, a look at variables positively correlated with the Current Ratio.

Linear Regression Plots Against Current Ratio; Positive Correlations

CurrentRatioData <- data.table(Date = BAC_All_Statement$date, `current Ratio` = as.numeric(BAC_All_Statement$`current Ratio`), `Total debt` = BAC_All_Statement$`Total debt`, `Long-term debt` = BAC_All_Statement$`Long-term debt`, `Net Debt` = BAC_All_Statement$`Net Debt`, `Total non-current liabilities` = BAC_All_Statement$`Total non-current liabilities`, `Goodwill and Intangible Assets` = BAC_All_Statement$`Goodwill and Intangible Assets`, Property = BAC_All_Statement$`Property, Plant & Equipment Net`)

ggplot(CurrentRatioData) +
 aes(x = `current Ratio`, y = `Total debt`) +
 geom_point(size = 3L, colour = "#4292c6") +
 scale_y_continuous(labels = comma) +
 geom_smooth(method = "lm") +
 stat_cor(label.x = 0.9, label.y = 140000000000) +
 stat_regline_equation(label.x = 0.9, label.y = 170000000000)  +
 ggthemes::theme_economist_white() +
 ggtitle("Total Debt is Highly Correlated with Current Ratio", subtitle = "This is because Total Liabilities is a part of the equation for the current ratio;\nthus when estimating a future current ratio, \nwe should expect a direct impact on all liabilities including debt.")

CurrentRatioDataMelt <- melt.data.table(CurrentRatioData, measure.vars = c("Total debt", "Long-term debt", "Net Debt", "Total non-current liabilities"))


library(dplyr)
library(ggplot2)

CurrentRatioDataMelt %>%
 filter(!(`Goodwill and Intangible Assets` %in% c("79,596,000,000.0", 
"77,988,000,000.0", "77,672,000,000.0", "77,311,000,000.0", "77,006,000,000.0", "76,660,000,000.0", 
"76,309,000,000.0", "76,034,000,000.0", "75,734,000,000.0", "75,418,000,000.0", "75,179,000,000.0", 
"74,909,000,000.0", "74,633,000,000.0", "74,389,000,000.0", "74,167,000,000.0", "73,963,000,000.0", 
"73,734,000,000.0", "73,529,000,000.0", "73,339,000,000.0", "73,096,000,000.0", "72,912,000,000.0", 
"71,891,000,000.0", "71,735,000,000.0", "71,579,000,000.0", "71,427,000,000.0", "70,551,000,000.0"
)) & !is.na(`Goodwill and Intangible Assets`)) %>%
 filter(!(Property %in% c("13,552,000,000.0", 
"13,637,000,000.0", "13,104,000,000.0", "12,653,000,000.0", "12,436,000,000.0", "11,858,000,000.0", 
"11,085,000,000.0", "10,836,000,000.0", "10,703,000,000.0", "10,475,000,000.0", "10,351,000,000.0", 
"10,145,000,000.0", "9,987,000,000.0", "10,049,000,000.0", "9,833,000,000.0", "9,700,000,000.0", 
"9,554,000,000.0", "9,485,000,000.0", "9,358,000,000.0", "9,150,000,000.0", "9,133,000,000.0", 
"9,139,000,000.0", "9,319,000,000.0", "8,904,000,000.0", "8,971,000,000.0", "9,247,000,000.0", 
"9,399,000,000.0", "9,537,000,000.0", "9,680,000,000.0", "9,906,000,000.0", "10,251,000,000.0", 
"10,426,000,000.0", "10,493,000,000.0")) & !is.na(Property)) %>%
 ggplot() +
 aes(x = `current Ratio`, y = value) +
 geom_point(size = 2.5, colour = "#31688e") +
 geom_smooth(method = "lm") +
 labs(title = "Current Ratio Against All Types of Liabilities", subtitle = "As expected, the Current Ratio is strongly correlated to all types of liabilities. The reasoning to this is eluded to above.") +
 ggthemes::theme_economist_white() +
 facet_wrap(vars(variable), scales = "free_y") + scale_y_continuous(labels = comma) + stat_cor(label.x = 0.9, label.y = 140000000000) + stat_regline_equation(label.x = 0.9, label.y = 170000000000)

When looking at positive correlations of variables with the Debt-to-Equity ratio, we see many of the same varibles as seen in with the Current Ratio. It is also important to note a couple things. First, that the current ratio and debt-to-equity ratio variables are themselves strongly postively correlated. Second, all the relations that have we have looked at thusfar have been statistically signficant. Because of this, when attempting to estimate impacts on a balance sheet based on changes to one of these accounting ratios, it maybe best to omit one in favour of another.

Linear Regression Plots Against Debt-to-Equity Ratio; Positive Correlations

DebtEquityData <- data.table(Date = BAC_All_Statement$date,
                             `DebtEquityRatio` = as.numeric(BAC_All_Statement$debtToEquity),
                             `Long-term debt` = as.numeric(BAC_All_Statement$`Long-term debt`),
                             `Total debt` = as.numeric(BAC_All_Statement$`Total debt`),
                             `Net Debt` = as.numeric(BAC_All_Statement$`Net Debt`),
                             Receivables = as.numeric(BAC_All_Statement$Receivables),
                             `Total non-current liabilities` = as.numeric(BAC_All_Statement$`Total non-current liabilities`),
                             `Goodwill and Intangible Assets` = as.numeric(BAC_All_Statement$`Goodwill and Intangible Assets`),
                             Property = as.numeric(BAC_All_Statement$`Property, Plant & Equipment Net`))

DebtEquityDataMelt <- melt.data.table(DebtEquityData, measure.vars = c("Long-term debt", "Total debt","Long-term debt","Net Debt", "Receivables", "Total non-current liabilities", "Goodwill and Intangible Assets", "Property"))

ggplot(DebtEquityDataMelt) +
 aes(x = DebtEquityRatio, y = value) +
 geom_point(size = 1.5, colour = "#0c4c8a") +
 geom_smooth(method = "lm") +
 labs(title = "Positively Correlated Variables with Debt-to-Equity Ratio", subtitle = "There are strong positive correlations between the D/E Ratio and Debt. This is because similar to the Current Ratio, debt on the balance sheet factors into the calculation \n for the D/E Ratio.") +
 theme_light() +
 facet_wrap(vars(variable), scales = "free") + scale_y_continuous(labels = comma) + stat_cor(label.x = 0.9, label.y = 140000000000) + stat_regline_equation(label.x = 0.9, label.y = 170000000000)

Negative Correlations

In addition to looking at positively correlated relations, it is also important to look at negatively correlated relations.

k <- which(correlationMatrix < -0.80, arr.ind = TRUE)

negativeRelations <- data.table( variable1 = rownames(correlationMatrix)[k[,1]], variable2 = colnames(correlationMatrix)[k[,2]], correlation = correlationMatrix[k])
##omit correlations of 1

negativeRelations <- negativeRelations[!correlation == 1,]

negativeRelations <- negativeRelations[!duplicated(negativeRelations$correlation),]
setorder(negativeRelations, -correlation)

datatable(negativeRelations)
negativeCurrentRatioCorrel <- negativeRelations[variable1 %like% "current Ratio",]

kable(negativeCurrentRatioCorrel, caption = "Negative Correlations with the Current Ratio") %>% kable_styling("striped")
Negative Correlations with the Current Ratio
variable1 variable2 correlation
current Ratio Deposit Liabilities -0.8165375
current Ratio Long-term investments -0.8170001
current Ratio Investments -0.8178709
current Ratio Total shareholders equity -0.8515319
negativeDebtToEquityCorrel <- negativeRelations[variable1 %like% "debtToEquity",]

kable(negativeDebtToEquityCorrel, caption = "Negative Correlations with the Debt to Equity Ratio") %>% kable_styling("striped")
Negative Correlations with the Debt to Equity Ratio
variable1 variable2 correlation
debtToEquity shareholdersEquity -0.8353062

The Debt-to-Equity ratio is only negatively correlated with one other variable. Given this, in addition to the fact that the positive correlations are similar to that of the current ratio and that this project is more interested in impacts on the balanace sheet based on liquidity events, it seems appropriate to omit the Debt-to Equity ratio and focus more on the Current Ratio.

Just as before, it helps to plot variables that appear to be negatively correlated with the Current Ratio to visualize the relationship.

Linear Regression Plots Against Current Ratio; Negative Correlations

negativeCurrentRatioData <- data.table(Date = BAC_All_Statement$date, `current Ratio` = BAC_All_Statement$`current Ratio`, `Deposit Liabilities` = BAC_All_Statement$`Deposit Liabilities`, Investments = BAC_All_Statement$Investments, `Total shareholders equity` = BAC_All_Statement$`Total shareholders equity`)

negativeCurrentRatioDataMelt <- melt.data.table(negativeCurrentRatioData, measure.vars = c("Deposit Liabilities", "Investments", "Total shareholders equity"))

ggplot(negativeCurrentRatioDataMelt) +
 aes(x = `current Ratio`, y = value, size = Date) +
 geom_point(colour = "#0c4c8a") +
 geom_smooth(method = "lm") +
 geom_smooth(span = 1L) +
 labs(title = "Strong Negative Correlations with Current Ratio", subtitle = "Unlike what was seen with the positive correlated plots;\nwith the variables that are negatively correlated, the  trends seen are less consistant. There are inconsistencies\nwhere we see some variables rise despite an increase in the Current Ratio. The P-values are still very low, indicating a statistically significant relationship.\nThough it may be interesting to look at other types of regression such as exponential. There also appears to be a relation with the date as more recent data\nis associated with higher levels of Liabilities, Investments, and Shareholders' Equity. That is most probably an indicator of Bank of America expanding it's business.") +
 ggthemes::theme_gdocs() +
 facet_wrap(vars(variable), scales = "free") + scale_y_continuous(labels = comma) + stat_cor(label.x = 0.9, label.y = 130000000000) + stat_regline_equation(label.x = 0.9, label.y = 190000000000)

The exploratory analysis helps determine which variables on the balance sheet will be effected by movements by the current ratio and by how much. All the regressions have low P-Values indicating statistically significant results. The R-Squared values for Total Debt, Long-Term Debt, and Total non-current liabilities are above 80%, indicating that movements in the Current Ratio are able to explain at least 80% of the movements in the dependent variables. For Goodwill, Property, Deoposit Liabilities, Lont-term Investments, Investments, and Total shareholder’s equity, the R-Squared is under 80%, indicating that including other variables in the regression may be needed to explain more of the movement.

Regression Summary Statistics against Current Ratio

Variable Correlation Y-Intercept Coefficient P-Value R-squared
Total Debt 0.93 -1,467,424,955,946 1,852,647,112,531 0.00000000000000375 0.8675
Long-Term Debt 0.90 -1,018,755,301,301 1,357,651,095,640 0.000000000000917 0.8115
Net Debt 0.90 -2,258,443,522,255 2,537,431,899,110 0.00000000000123 0.808
Total non-current liabilities 0.90 -1,040,439,653,047 1,383,407,829,263 0.00000000000145 0.8059
Goodwill and Intangible Assets 0.89 -2,767,212,737 81,534,409,952 0.00000000000487 0.7902
Property, Plant & Equipment Net 0.86 -27,462,295,138 40,303,800,502 0.0000000000882 0.7476
Deposit Liabilities -0.82 4,236,378,079,434 -3,239,048,470,669 0.00000000688164 0.6667
Long-term investments -0.82 5,324,441,695,960 -5,365,783,439,854 0.00000000664 0.6675
Investments -0.82 7,563,665,709,199 -7,356,349,851,632 0.000000006207 0.6582
Total shareholders equity -0.85 690,155,140,607 -466,810,511,299 0.00000000033476732 0.7251

Other Correlations

Though the current ratio itself only significantly impacts 9 other variables on the balance sheet, those 9 variables may effect other variables on the balance sheet as well. Below is a table of correlations for the auxiliary variables.

auxPositiveRelations <- positiveRelations[variable1 %in% c("Total Debt", "Long-Term Debt","Net Debt", "Total non-current liabilities", "Goodwill and Intangible Assets" , "Property, Plant & Equipment Net") | variable2 %in% c("Total Debt", "Long-Term Debt","Net Debt", "Total non-current liabilities", "Goodwill and Intangible Assets" , "Property, Plant & Equipment Net"),]

auxPositiveRelations <- auxPositiveRelations[variable1 != "Current Ratio" | variable2 != "Current Ratio", ]

kable(auxPositiveRelations, caption = "Positive Correlations with the Variables that are Positively Correlated with Current Ratio") %>% kable_styling("striped")
Positive Correlations with the Variables that are Positively Correlated with Current Ratio
variable1 variable2 correlation
longTermDebt Total non-current liabilities 0.9943523
Total non-current liabilities Long-term debt 0.9943493
debtToEquity Total non-current liabilities 0.9877031
Net Debt Total debt 0.9741387
Total non-current liabilities Total debt 0.9598042
debtToEquity Net Debt 0.9532704
Total debt Property, Plant & Equipment Net 0.9404925
debtToEquity Property, Plant & Equipment Net 0.9401397
Total non-current liabilities Property, Plant & Equipment Net 0.9386269
longTermDebt Property, Plant & Equipment Net 0.9374526
Long-term debt Property, Plant & Equipment Net 0.9374477
Net Debt Long-term debt 0.9239168
longTermDebt Net Debt 0.9238992
Net Debt Total non-current liabilities 0.9231342
Net Debt Property, Plant & Equipment Net 0.9206659
Net Debt Goodwill and Intangible Assets 0.9161831
current Ratio Net Debt 0.8988680
current Ratio Total non-current liabilities 0.8977222
current Ratio Goodwill and Intangible Assets 0.8889521
Total debt Goodwill and Intangible Assets 0.8783257
debtToEquity Goodwill and Intangible Assets 0.8746961
current Ratio Property, Plant & Equipment Net 0.8646112
Net Debt Total current liabilities 0.8243514
Net Debt Short-term debt 0.8193955
Net Debt Receivables 0.8164714
Total non-current liabilities Goodwill and Intangible Assets 0.8164448
Long-term debt Goodwill and Intangible Assets 0.8156820
longTermDebt Goodwill and Intangible Assets 0.8156473
Goodwill and Intangible Assets Property, Plant & Equipment Net 0.8020187
Goodwill and Intangible Assets Receivables 0.8009194
auxNegativeRelations <- negativeRelations[variable1 %in% c("Total Debt", "Long-Term Debt","Net Debt", "Total non-current liabilities", "Goodwill and Intangible Assets" , "Property, Plant & Equipment Net") | variable2 %in% c("Total Debt", "Long-Term Debt","Net Debt", "Total non-current liabilities", "Goodwill and Intangible Assets" , "Property, Plant & Equipment Net"),]

auxNegativeRelations <- auxNegativeRelations[variable1 != "Current Ratio" | variable2 != "Current Ratio", ]

kable(auxNegativeRelations, caption = "Negative Correlations with the Variables that are Negatively Correlated with Current Ratio") %>% kable_styling("striped")
Negative Correlations with the Variables that are Negatively Correlated with Current Ratio
variable1 variable2 correlation
Net Debt Deposit Liabilities -0.8096540
Net Debt Short-term investments -0.8114304
Long-term investments Property, Plant & Equipment Net -0.8168505
Net Income Goodwill and Intangible Assets -0.8233511
EBIT Margin Goodwill and Intangible Assets -0.8278289
Profit Margin Goodwill and Intangible Assets -0.8310122
Operating Income Goodwill and Intangible Assets -0.8312241
EPS Goodwill and Intangible Assets -0.8379777
EPS Diluted Goodwill and Intangible Assets -0.8391685
Goodwill and Intangible Assets Cash and cash equivalents -0.8453159
Net Debt Total current assets -0.8533579
Net Debt Total shareholders equity -0.8554443
Goodwill and Intangible Assets Short-term investments -0.8574609
Net Debt Cash and short-term investments -0.8745239
Goodwill and Intangible Assets Total current assets -0.8766236
Long-term investments Goodwill and Intangible Assets -0.8789820
shareholdersEquity Net Debt -0.8791396
Investments Goodwill and Intangible Assets -0.8826940
Net Debt Investments -0.8874466
Net Debt Cash and cash equivalents -0.8916782
Crr liabilities Goodwill and Intangible Assets -0.8916919
Goodwill and Intangible Assets Cash and short-term investments -0.8954594
Net Debt Long-term investments -0.9031995
Total shareholders equity Goodwill and Intangible Assets -0.9073629
TTM Net EPS Goodwill and Intangible Assets -0.9088636
Other Liabilities Goodwill and Intangible Assets -0.9152228
Retained earnings (deficit) Goodwill and Intangible Assets -0.9279262
shareholdersEquity Goodwill and Intangible Assets -0.9397745
Stock Price Goodwill and Intangible Assets -0.9439021
Deposit Liabilities Goodwill and Intangible Assets -0.9617530

From a quick look at what variables are correlated with variables that are strongly correlated with the Current Ratio, we can see that for the most part, these variable are correlated to each other. For example, Net Debt is correlated with Desposit Liabilities and Short-term investments; however we already have current ratio explaining all three of these variables.

Filtering out variables that have already been explained.

auxPositiveRelations2 <- positiveRelations[variable1 %in% c("Total Debt", "Long-Term Debt","Net Debt", "Total non-current liabilities", "Goodwill and Intangible Assets" , "Property, Plant & Equipment Net") & !(variable2 %in% c("Total Debt", "Long-Term Debt","Net Debt", "Total non-current liabilities", "Goodwill and Intangible Assets" , "Property, Plant & Equipment Net", "Long-term debt", "Total debt", "Total current liabilities")),]


kable(auxPositiveRelations2, caption = "Positive Correlations with Variable Left Unexplained") %>% kable_styling("striped")
Positive Correlations with Variable Left Unexplained
variable1 variable2 correlation
Net Debt Short-term debt 0.8193955
Net Debt Receivables 0.8164714
Goodwill and Intangible Assets Receivables 0.8009194
auxNegativeRelations2 <- negativeRelations[variable1 %in% c("Total Debt", "Long-Term Debt","Net Debt", "Total non-current liabilities", "Goodwill and Intangible Assets" , "Property, Plant & Equipment Net") & !(variable2 %in% c("Total Debt", "Long-Term Debt","Net Debt", "Total non-current liabilities", "Goodwill and Intangible Assets" , "Property, Plant & Equipment Net" , "Deposit Liabilities" , "Total shareholders equity","Investments", "Long-term investments", "Total current assets")),]

kable(auxNegativeRelations2, caption = "Negative Correlations with Variable Left Unexplained") %>% kable_styling("striped")
Negative Correlations with Variable Left Unexplained
variable1 variable2 correlation
Net Debt Short-term investments -0.8114304
Goodwill and Intangible Assets Cash and cash equivalents -0.8453159
Goodwill and Intangible Assets Short-term investments -0.8574609
Net Debt Cash and short-term investments -0.8745239
Net Debt Cash and cash equivalents -0.8916782
Goodwill and Intangible Assets Cash and short-term investments -0.8954594

Plotting Other Correlations

According to the above table, Net Debt might be able to be used to explain Short-term debt, Receivables, Short-term investments, and Cash and cash equivalents. Once again, plotting the variables against net Debt will help gain a better picture of the relationship.

library(kableExtra)

NetDebtData <- data.table(`Date` = BAC_All_Statement$date, `Net Debt` = BAC_All_Statement$`Net Debt`, 
                          `Short-term debt` = BAC_All_Statement$`Short-term debt`,
                          `Receivables` = BAC_All_Statement$Receivables,
                          `Short-term investments` = BAC_All_Statement$`Short-term investments`,
                          `Cash and cash equivalents` = BAC_All_Statement$`Cash and cash equivalents` )

NetDebtDataMelt <- melt.data.table(NetDebtData, measure.vars = c("Short-term debt",
                                                                 "Receivables",
                                                                 "Short-term investments",
                                                                 "Cash and cash equivalents"))

ggplot(NetDebtDataMelt) +
 aes(x = `Net Debt`, y = value) +
 geom_point(size = 2.5, colour = "#cb181d") +
 labs(title = "Net Debt Used to Model Other Unexplained Variables", subtitle = "There appears to be a large degree of variance") +
 ggthemes::theme_gdocs() +
 facet_wrap(vars(variable), scales = "free") + scale_y_continuous(labels = comma) + stat_cor(label.x = 0.9, label.y = 140000000000) + stat_regline_equation(label.x = 0.9, label.y = 170000000000) 

netDebtvsRec <- lm(as.numeric(NetDebtData$Receivables) ~ as.numeric(NetDebtData$`Net Debt`)   )

#summ(netDebtvsRec)

netDebtvsShortinv <- lm(as.numeric(NetDebtData$`Short-term investments` ) ~ as.numeric(NetDebtData$`Net Debt`)   )

#summ(netDebtvsShortinv)

netDebtvsshortDebt <- lm(as.numeric(NetDebtData$`Short-term debt` ) ~ as.numeric(NetDebtData$`Net Debt`)   )

#summ(netDebtvsshortDebt)

netDebtvscash <- lm(as.numeric(NetDebtData$`Cash and cash equivalents` ) ~ as.numeric(NetDebtData$`Net Debt`)   )

#summ(netDebtvscash)

Regression Summary Statistics; Other Variables

Reveivables ~ Net Debt Regression

MODEL INFO:
Observations: 33
Dependent Variable: as.numeric(NetDebtData$Receivables)
Type: OLS linear regression
MODEL FIT:
F(1,31) = 61.99 p = 0.00
R² = 0.67
Adj. R² = 0.66

Standard errors: OLS

Est. S.E. t val. p
(Intercept) 53459394607.95 1396772704.16 38.27 0.00
as.numeric(NetDebtData$Net Debt) 0.07 0.01 7.87 0.00

Short-Term Investments ~ Net Debt Regression

MODEL INFO:
Observations: 33
Dependent Variable: as.numeric(NetDebtData$Short-term investments)
Type: OLS linear regression
MODEL FIT:
F(1,31) = 59.75 p = 0.00
R² = 0.66
Adj. R² = 0.65

Standard errors: OLS

Est. S.E. t val. p
(Intercept) 460321453654.93 13842095442.22 33.26 0.00
as.numeric(NetDebtData$Net Debt) -0.73 0.09 -7.73 0.00

Short Term Debt ~ Net Debt Regression

MODEL INFO:
Observations: 33
Dependent Variable: as.numeric(NetDebtData$Short-term debt)
Type: OLS linear regression
MODEL FIT:
F(1,31) = 63.34 p = 0.00
R² = 0.67
Adj. R² = 0.66

Standard errors: OLS

Est. S.E. t val. p
(Intercept) -7856897412.45 3575031897.74 -2.20 0.04
as.numeric(NetDebtData$Net Debt) 0.19 0.02 7.96 0.00

Cash and Cash Equivalents ~ Net Debt Regression

MODEL INFO:
Observations: 33
Dependent Variable: as.numeric(NetDebtData$Cash and cash equivalents)
Type: OLS linear regression
MODEL FIT:
F(1,31) = 120.29 p = 0.00
R² = 0.80
Adj. R² = 0.79

Standard errors: OLS

Est. S.E. t val. p
(Intercept) 186934091713.61 4212738770.38 44.37 0.00
as.numeric(NetDebtData$Net Debt) -0.31 0.03 -10.97 0.00

After analyzing the linear statistics for the various regressions of correlated variables against Net Debt, all values appear to be statistically significant. Furthermore, one variable; Cash and Cash Equivalents, has an R-Squared of almost 80%. This means that movements in Net Debt can explain approximately 80% of the movement in Cash and Cash Equivalents. Considering the fact that Net Debt able to be estimated using the Current Ratio, we are able to indirectly approximate Cash and Cash Equivalents using the Current Ratio.

Conclusion

With the limited data available to this project as well as the limited scope (only looking at three ratios), we see that we can estimate certain elements of the balance sheet with a reasonable degree of accuracy using the Current Ratio. Furthermore, variables that can be estimated using the current ratio can further be used to estimate other variables on the balance sheet. Given more ratios and metrics, more aspects of the balance sheet can be estimated resulting in a fully estimated balance sheet. This is useful because it is often easier to consider the impacts on a business from adverse business conditions and inclimate economic environment in terms of metrics and ratios. From that point, building a theoretical balance sheet that could exist in a simulated or theoretical senario gives risk analysts foresight on potential risks to the business.


  1. https://www.macrotrends.net/stocks/charts/BAC/bank-of-america/current-ratio

  2. https://www.macrotrends.net/stocks/charts/BAC/bank-of-america/debt-equity-ratio

  3. https://www.macrotrends.net/stocks/charts/BAC/bank-of-america/pe-ratio