Monthly Archives: September 2014

USA Monthly Trade Balance, 2000-2014

I nearly didn't get to a post today, so it's going to be a brief one. It's another Census Bureau dataset, this time from their Foreign Trade section. Specifically, I grabbed the U.S. International Trade in Goods and Services data, and plotted the monthly balance over the last 14 years. There's a lot more that could be done with this, but it's Friday, and I'm pretty sleepy. Like many charts that track the economic status of America in some way, the results of the recession appear to be visible here. However, another possibility in this case is that the glut of much cheaper natural gas pulled some energy-intensive manufacturing back to American industrial areas that had either been operating below capacity or simply idle. A third factor is the rise of consumer culture in emerging economies, China in particular, which could have served to stabilize the monthly imbalance in recent years between $30,000 and $50,000 (in millions).



2012 Public School Funding and Expenditures (Elementary-Secondary)

The US Census Bureau publishes a set of public school funding and expenditure data, breaking it down by source (federal, state, local), as well as type for spending (current spending and capital outlays). The numbers are broken down by state, so here are a few descriptive graphics on the published numbers.

First, the top ten revenue states, along with their expenditures. Dollars are in thousands, so that $80 million at the top of the y-axis is actually $80 billion.

top revenue states

Next, I found the ratio of Revenue/Expenditure for each state, and the United States as a whole. I also grabbed the % difference for each state's ratio from the USA as a whole, which is plotted on the secondary y-axis.

top ten highest ratio top ten lowest ratio

Finally, here's the highest and lowest per capita revenue, with a line showing their % difference from the national average. Dollars here are dollars, not thousands of dollars.

per capita revenue highest per capita revenue lowest

Decadal Histograms of Monthly Yosemite Temperatures

Following up on the look at Yosemite's precipitation trends on Monday, here's a glance into the Park's temperature trends. I created 3 histograms each for four decades. The 70s, 80s, 90s, and 2000s. Together, these give a small glimpse into a changing temperature regime. As always, these are quick and dirty graphs. Today, they're produced via ggplot2 in R. All bins are set to a range of 3 degrees.

Throughout all of these histograms, it's important to watch the x axis along with the shape. It's pretty easy to miss a shift because the eye is drawn to the shape, but even a smaller peak on the right could indicate higher temperatures overall if the entire set has shifted in that direction.

First, a set of monthly minimum temperature histograms.

tmin_70s tmin_80s tmin_90s


Next, a set of monthly mean temperatures.

tmean_70s tmean_80s tmean_90stmean_00sAnd finally, a set of monthly max temperatures.

70s 80s 90s00s

Consumer Complaints about Financial Products

The Consumer Financial Protection Bureau (CFPB) has been collecting consumer complaints for 3 years, and has apparently been collecting them into one of the most usable government databases I've ever seen. This is particularly neat given the qualitative nature of many of these complaints. The CFPB was only created in 2011 after the 2010 passage of the Dodd–Frank Wall Street Reform and Consumer Protection Act, which might explain why its website appears far more modern than most federal endeavors. The data has a lot of potential, but here are a few tidbits I grabbed right away.

First, I noticed that each complaint was entered with a zipcode, and I wondered which had seen the most complaints. Here's the top ten, along with their actual location (first town name result based on a quick google search).


Florida and California are both well-represented, although I was surprised to see a Michigan zip code take the top spot. Perhaps these are areas with high concentrations of retired individuals?

In a similar vein, here are the top ten "Issues" reported in the database.


Precipitation in Yosemite Valley, 1894-2013

California's severe, state-wide drought owes a significant chunk of its origins to reduced snowfall in the Sierra Nevadas. Much of the state is semi-arid, and over the last century an extensive series of dams, canals, and pipes was put into place to service the water needs of both agriculture and urban centers. The Carbon Dioxide Information Analysis Center maintains and hosts a great database of temperature and precipitation data from stations across the United States. Many of these stations have records which go back over a hundred years, and it's a phenomenal resource to quickly eyeball trends or confirm/deny a Saturday afternoon's idle theorizing.

First, here's an 18-month rolling average of precipitation from 1894-2013.

yosemite rolling average precip


From glancing at that, you might notice that the right-side tail looks a bit odd, let's zoom in on the records since 1980 and add a linear trendline (auto-calculated by Excel).

yosemite rolling average precip 30 years


This provides a more detailed picture of the reduced recent snowpack, but it's important to remember that this is only a single location and barely scratches the surface of the complete story.