Blog Archives

Modeling Contagion Using Airline Networks in R

May 30, 2015
By
Modeling Contagion Using Airline Networks in R

I first became interested in networks when reading Matthew O’Jackson’s 2010 paper describing networks in economics. At some point during the 2014 ebola outbreak, I became interested in how the disease could actually come to the U.S. I was caught up with work/classes at the time, but decided to use airline flight data to at least explore the … Continue reading...

Read more »

NYC Motor Vehicle Collisions – Street-Level Heat Map

March 10, 2015
By
NYC Motor Vehicle Collisions – Street-Level Heat Map

In this post I will extend a previous analysis creating a borough-level heat map of NYC motor vehicle collisions. The data is from NYC Open Data. In particular, I will go from borough-level to street-level collisions. The processing of the code is very similar to the previous analysis, with a few more functions that map streets to colors. … Continue reading...

Read more »

Econometrics Sim – 1: Endogeneity

March 9, 2015
By
Econometrics Sim – 1: Endogeneity

Introduction This is the first post in a series devoted to explaining basic econometric concepts using R simulations. The topic in this post is endogeneity, which can severely bias regression estimates. I will specifically simulate endogeneity caused by an omitted variable. In future posts in this series, I’ll simulate other specification issues such as heteroskedasticity, multicollinearity, and collider … Continue reading...

Read more »

Motor Vehicle Collision Density in NYC

March 6, 2015
By
Motor Vehicle Collision Density in NYC

In a previous post, I visualized crime density in Boston using R’s ggmap package. In this post, I use ggmap to visualize vehicle accidents in New York City. R code and data are included in this post. The data comes from NYC Open Data. My data cut ranges from 2012 to 2015. The data tracks the type of … Continue reading...

Read more »

Visualizing Hubway Trips in Boston

February 21, 2015
By
Visualizing Hubway Trips in Boston

Most Popular Hubway Stations (in order): Post Office Sq. – located in the heart of the financial district. Charles St. & Cambridge – the first Hubway stop after crossing from Cambridge over Longfellow Bridge. Tremont St & West – East side of the Boston Common South Station Cross St. & Hannover – entrance to North End combing from financial … Continue reading...

Read more »

Drug Crime Density in Boston

January 15, 2015
By
Drug Crime Density in Boston

The original map can be found in my previous post, Spatial Data Visualization with R. As a review, I use get_map function in the ggmap package to grab a map of Boston from Google Maps. The “crime report” data can be found at https://data.cityofboston.gov/. In the code below, I bring in crime data as a csv file. The data … Continue reading...

Read more »

Interactive Cobb-Douglas Web App with R

November 4, 2014
By
Interactive Cobb-Douglas Web App with R

I used Shiny to make an interactive cobb-douglass production surface in R. It reacts to user’s share of labor and capital inputs and allows the user to rotate the surface. The contour plot (isoquants) is also dynamic. Shiny works using two R codes stored in the same folder. One R code works on the user interface (UI) … Continue reading...

Read more »

Iterative OLS Regression Using Gauss-Seidel

October 24, 2014
By
Iterative OLS Regression Using Gauss-Seidel

I just finished covering a few numerical techniques for solving systems of equations, which can be applied to find best-fit lines through a give set of data points. The four points  are arranged into an inconsistent system of four equations and two unknowns: The system can be represented in matrix form: The least-squares solution vector can be … Continue reading...

Read more »

Spatial Data Visualization with R

August 31, 2014
By
Spatial Data Visualization with R

I’ve been fooling around with spatial data lately. As it turns out, there are some great R packages for visualizing this kind of data. Below is a set of charts I put together. It’s a good sample of the possibilities. Motherjones.com keeps a dataset with characteristics of every mass shooting since 1983. The location of each shooting is marked on the map … Continue reading...

Read more »

Using Markov Chains to Model Mortgage Defaults in R

April 18, 2014
By
Using Markov Chains to Model Mortgage Defaults in R

The goal of this post is to blend the material I’ve been learning in my night class with my day-job and R. If we have some object that switches between states over time according to fixed probabilities, we can model the long-term behavior of this object using Markov chains*. A good example is a mortgage. … Continue reading...

Read more »

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)