R

The Fall of Silicon Valley Bank

March 10, 2023
visualization
R, ggplot2

I imagine that the fall of Silicon Valley Bank caught many of us by surprise. At the time of this writing, there’s a whole lot of uncertainty about what that means for many of us in the technology space. In the meantime, here’s a cat. library(tidyverse) library(gganimate) library(ggcats) # remotes::install_github("R-CoderDotCom/ggcats@main") library(hrbrthemes) library(tidyquant) library(gifski) symbol <- "SIVB" stock <- tidyquant::tq_get(symbol, get = "stock.prices", from = "2021-10-01", to = "2023-03-10") head(stock) ## # A tibble: 6 × 8 ## symbol date open high low close volume adjusted ## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 SIVB 2021-10-01 650 670. ...

A CATastrophic year

January 30, 2023
visualization
R, ggplot2

2022 was a rough year for the stock market. CATastrophic, one might say. library(tidyverse) library(gganimate) library(ggcats) # remotes::install_github("R-CoderDotCom/ggcats@main") library(hrbrthemes) library(tidyquant) library(gifski) symbol <- "^GSPC" stock <- tidyquant::tq_get(symbol, get = "stock.prices", from = "2022-01-01", to = "2022-12-31") head(stock) ## # A tibble: 6 × 8 ## symbol date open high low close volume adjusted ## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 ^GSPC 2022-01-03 4778. 4797. 4758. 4797. 3831020000 4797. ...

When Inflation Outpaces Real Income

January 18, 2023
visualization
R, economics

There’s a trove of rich economic data on the Federal Reserve Economic Data (FRED) website, including data on inflation and real wages over time. How well has real wages kept pace with inflation – the cost of living – over time? Let’s turn to our good old friend Data Visualization to get a grasp on the matter. As always, first, let’s load up some essential packages. library(tidyverse) library(ggplot2) library(hrbrthemes) Then, let’s grab some data, including: ...

Choropleth Plot

April 8, 2022
visualization
R, ggplot2

Overview # A choropleth plot is a map where specific areas are mapped to some sort of value. The scale of those values are often represented using a color gradient. For brevity, these are also commonly referred to ask a choropleth maps. Choropleth plots are great when the intended visual: Needs to account for geographic positions, size, or borders Includes areas where the measured field includes data for most of the areas presented on the plot ...

FBI Internet Crime Compaint Center Report

March 28, 2022
analysis
code, R, ggplot2, cybersecurity

Overview # The FBI’s Internet Crime Complaint Center (IC3) puts out an annual report that summarizes the recent year’s experiences with Internet crime. It includes analysis that hints at the availability of quantitative data (versus purely qualitative anecdotes). Here’s a copy of the IC3’s latest report. Data # The available data is embedded in the reports themselves, which are in .pdf – less than ideal. ...

Fatal Police Shootings in the United States

March 26, 2022
analysis
R

Updated March 26, 2022 Overview # The Washington Post has spent the last several years collecting details of fatal shootings by on-duty police officers. Since 2015, over 7,000 cases have been added to this dataset. For more details, check out the Washington Post article. I intend to tregularly return to review and revise the analysis on this page as the underlying data is updated. ...

Price to Rent Ratio for Multiple Regions

March 7, 2022
analysis
R, real estate, investing

Overview # A common metric that real estate investors rely on to determine where to invest is the price to rent ratio. This is a fairly simple formula: \(Price to Rent Ratio = \frac{Median Home Price}{Median Annual Rent}\). A high price to rent ratio suggests that the demand for rentals is high within a given market. The general idea is that if real estate prices within a given area are extremely high relative to rent, renting will be far more financially accessible than buying, which would drive up the demand for rentals. ...

Calendar Plot

February 28, 2022
visualization
R, ggplot2

Overview # Sometimes, it’s handy to visualize daily data in the familiar form of a calendar. The data itself is usually mapped to a color scale, so that different colors represent different values of data. Data # The data should include at least two values: A date A numerical value R # A simple way to create calendar plots in R is with the ggcal package by Jay Jacobs. ...

Pyramid Plot

February 23, 2022
visualization
R, ggplot2

Overview # A pyramid plot is a variation of a divergent bar plot where the same types of observations appear across the two classes. “Pyramid plot” sounds a bit nefarious, sort of like a “pyramid scheme”, but there’s really nothing awful about it. In fact, it’s pretty awesome as a visual. When to use # Use a pyramid plot when you want to keep the same types of observations that appear across different classes very close together. ...