Skip to main content

Visualizing GTAP in Julia

Mitch Phillipson October 03, 2025


I’ve spent the past week working on a package to load GTAP data from the provided HAR files. The good news is that I have working code to load the data into a Julia DataFrame. The bad news is that it will take a little more time to clean it up and make it user-friendly.

However, I wanted to share some initial visualizations I’ve created. I’ll be using GTAP9 data with a base year of 2011. To emphasize the year, let’s start with population data.

The current US population (as of 2024) is 340 million, or about 30 million more than in 2011. This is useful context as we move forward.

Also, these numbers are coming from data that is has been calibrated to satisfy CGE model assumptions. It should be close to the actual data, but it may not be exact.

Imports

Let’s start by looking at imports. We’ll look at several different visualizations.

Imports Household

First, let’s look at total imports purchased by households for each country.

Unsurprisingly, at $685 billion, United States households purchase almost twice as many imports as the next largest country, Germany, at $354 billion.

Imports by Firms

Rather than households, let’s look at imports purchased by firms.

Again, the United states leads the way with $2 trillion in imports purchased by firms, followed by China at $1.6 trillion and Germany at $1 trillion.

Imports by Government

Governments are not typically large purchasers of imports, but they do make some purchases.

The numbers are much lower here. Saudi Arabia imports the most at $34 billion.

Total Imports

How about we add them all together for total imports?

In 2011 the United States imported $2.7 trillion worth of goods, followed by China at $1.7 trillion and Germany at $1.4 trillion. The United States imports an astonishing quantity of goods, this number has increased to around $4 trillion in 2024. It will be interesting to see the impact tariffs have on this value in the coming years.

US Trade Partners

Finally, let’s look at the United States’ trade partners. This chart shows imports purchased by the United States from each country.

People tend to assume that everything comes from China, but in reality, our two largest trade partners are land borders, Canada and Mexico. In particular, it would be a mistake to alienate Canada as a trade partner.

But what do we import from Canada? Let’s look at the top 20 commodities imported by the United States from Canada.

Conclusion

This is just a small sample of the visualizations that can be created with GTAP data. I’ll be working on cleaning up the code and making it available as a package next week.