Posts for Tag: interactive

National Park Service Voronoi Map

Posted In: Maps
National Park Voronoi Map
Facebooktwittergoogle_plusredditpinterestlinkedinmail

This map divides up the Continental United States into different regions depending on which National Park (or other National Park Service site) is closest to it. It is based on a straight-line (‘as the crow flies’) distance between locations rather than along road networks. It is an example of a Voronoi Diagram, which is subdivided into different regions based upon the distance between points of interest. Everything within a subregion is closer to the point defining the region than any other point.

Hover over the circle points to see the name of the park. The map has a dropdown menu that lets you choose between the following types of locations in the National Park Service:

  • National Parks
  • National Historic Sites
  • National Memorial Sites
  • National Monuments
  • National Seashores/Lakeshores
  • National Recreation Areas
  • National Battlefields
  • National Military Sites
  • National Scenic Areas

For National Parks, there is a high concentration of National Parks in the Western US, especially around the Southwestern US and running up the Pacific Coast. As a result, in these areas, the Voronoi regions are fairly small. The Southwest is also home to a high concentration of National Monuments. There are only few parks in the Eastern US and so the Voronoi regions are correspondingly large. Looking at National Historic Sites, the situation is flipped somewhat, with a high concentration of historic sites in the eastern US, and specifically the Northeast.

Let me know in the comments which park you are closest to and which park you last visited.

Tools and Data Sources
Locations of each of the National Park Service sites comes from the National Park Service. The map was created using the Leaflet javascript mapping library and the Voronoi diagram using the Turfjs javascript, geospatial analysis library.

National Park Voronoi Map

Zip Code Map of the United States

Posted In: Maps
US zip code map
Facebooktwittergoogle_plusredditpinterestlinkedinmail

This zip code map of the United States visualizes over 42,000 zip codes in the 50 states. Zip codes are five digit postal codes used for mail delivery in the US. The points on the map show the geographic center of each zip code. The interactive visualization lets you type in a zip code and will show you where that zip code lies on the map. As you begin to type in the zip code, the map will highlight all the zip codes that begin with those numbers.

For example, if you type in “0”, you will highlight all zip codes that start with the zero in the Northeastern US. This will represent about 10% of the zip codes in the US. When you type in another number, it will narrow down the zip codes that begin with those two digits (approximately 1% of zip codes). It will progressively narrow down the number of zip codes as you type in more numbers, until you get to a full 5 digit zip code that represents 1 out of almost 43,000 zip codes (0.002% of zip codes). The map will then tell you the name of the city that that zip code is in.

You can explore how zip codes are distributed across the US by typing in different 1 and 2 digit numbers. You can also click on the check box to show or hide the outlines of the states.

Sources and Tools:

Zip code data was downloaded from opendatasoft.com. And the visualization was created using javascript and the open source leaflet javascript mapping library.

US zip code map

Greenhouse gas emissions from airplane flights

Posted In: Environment | Transportation

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Traveling by airplane produces significant greenhouse gas emissions

Flying in an airplane is likely the most greenhouse gas intensive activity you can do.  In a few short hours, you can can travel thousands of miles across the country or ocean.  It takes a large amount of fossil-fuel energy (oil) to lift an 80+ ton airplane off the ground and propel it at 600 miles per hour through the air.  Every hour of travel (in a Boeing 737) consumes around 750 gallons of jet fuel.

Even when dividing the fuel usage across all of the passengers (and cargo) of an aircraft, airplane travel consumes a significant amount of fuel per passenger.  The fuel economy is estimated to be about the same as a fairly efficient hybrid car driven by one person (60-70 passenger miles per gallon).  However, because you can go 10 times faster and much further more easily than you would in a car, airline travel can, on an absolute basis, emit larger amounts of greenhouse gases. In fact, an individual passenger’s share of emissions from a single airplane flight can exceed the annual average greenhouse gas emissions per capita from a number of countries (and the global average).

The following flight calculator and data visualization shows the miles and emissions produced per passenger by a airplane trip that you can specify.  Choose two airports that you are interested in and click the “Calculate Flight Emissions” button to see the emissions associated with a round-trip flight between these two cities.  The map will show you the flight route and also shows you the countries in the world where this one single round-trip flight produces more emissions per passenger than the average resident does in one year from all sources (annual per capita emissions).


In addition to individual countries, the tool also compares the flight’s per passenger emissions to the global average emissions per capita in 2017 (4.91 tonnes) and the emissions required to achieve a 22℃ climate stabilization in 2030 (3.08 tonnes) and in 2050 (1.37 tonnes). These 2030 and 2050 numbers are based on an International Energy Agency scenario.

Calculations of Airplane Emissions

The emissions calculated by this calculator are based on calculations from myclimate.org, a non-profit environmental organization.
The fuel consumption of a jet depends on the size of the aircraft and distance traveled, but takeoff and climbing to cruising altitude are particularly fuel-intensive. On shorter flights, the takeoff and initial climb will constitute a greater proportion of the total flight time so fuel consumption per mile will be higher than on longer (e.g. international) flights.

The detailed methodology is described in more detail in this document.

In addition to emissions of CO2 from the burning of jet fuel, jets also emit other gases (including methane, NOx, and water vapor) which can also contribute to warming (also known as “radiative forcing”). Because the emissions are occurring at high altitude, these gases can have different impacts than those at lower altitude. A number of studies have estimated the impact of these other gases can significantly contribute to the overall radiative forcing and have somewhere between 1.5 and 3 times the impact that the CO2 alone would. A number of studies, including the myclimate calculator use a factor of 2 to account for these non-CO2 gases and their warming impact, and that is what is used in this calculator as well.

Unlike cars, trucks and trains, it is much harder to power airplanes with batteries and electricity and producing low-carbon jet fuels from biomass is proving very challenging.

In order to achieve climate stabilization at 2 degrees C, global emissions need to basically go to zero over the next 40 years. With a growing global population, this means that the allowable emissions per person will shrink rapidly over these coming decades.

Ultimately, while aviation is a small part of global greenhouse gas emissions, it is a larger part of emissions in richer countries (i.e. if you are reading/viewing this post). And there are many in these richer countries who fly a disproportionate amount and therefore contribute a disproportionate amount of emissions. Hopefully, putting airplane travel in this context can help us better understand the impact of our actions and choices and maybe even change behavior for some.

Tools and Data Sources
The calculator estimates flight emissions based on the myclimate carbon footprint calculator. Data for CO2 emissions by country was downloaded from the European Commissions’s Emissions Database for Global Atmospheric Research. The map was built using the leaflet open-source mapping library in javascript.

airplane emissions

Assembling the USA state-by-state with state-level statistics

Posted In: Maps

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Watch the United States assemble state by state based on statistics of interest

Based on earlier popularity of the country-by-country animation, this map lets you watch as the world is built-up one state at a time. This can be done along a large range of statistical dimensions:

  • Name (alphabetical)
  • abbreviation
  • Date of entry to the United States
  • State Population (2018)
  • Population per Electoral Vote (2018)
  • Population per House Seat (2018)
  • Land Area (square miles)
  • Population Density (ppl per sq mi) (2018)
  • State’s Highest Point
  • Highest Elevation (ft)
  • Mean Elevation (ft)
  • State’s Lowest Point
  • Lowest Point (ft)
  • Life Expectancy at Birth (yrs)
  • Median Age (yrs)
  • Percent with High School Education
  • Percent with Bachelor’s Degree
  • Residential Electricity Price (cents per kWh) (2018)
  • Gasoline Price ($/gal) Regular unleaded (2019)
  • State Gross Domestic Product GDP ($Million) (2018)
  • GDP per capita ($/capita)
  • Number of Counties (or subdivisions)
  • Average Daily Solar Radiation (kWh/m2)
  • Birth rate (per thousand population)
  • Avg Age of Mother at Birth
  • Annual Precipitation (in/yr)
  • Average Temperature (deg F)
  • These statistics can be sorted from small to large or vice versa to get a view of the US and its constituent states plus DC in a unique and interesting way. It’s a bit hypnotic to watch as the states appear and add to the country one by one.

    You can use this map to display all the states that have higher life expectancy than the Texas:
    select “Life expectancy”, sort from “high to low” and use the scroll bar to move to the Texax and you’ll get a picture like this:
    States with higher life expectancy than Texas

    or this map to display all the states that have higher population density than California:
    select “Population density, sort from “high to low” and use the scroll bar to move to the United States and you’ll get a picture like this:
    States with higher population density than California

    I hope you enjoy exploring the United States through a number of different demographic, economic and physical characteristics through this data viz tool. And if you have ideas for other statistics to add, I will try to do so.

    Data and tools: Data was downloaded from a variety of sources:

    • Population https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States_by_population
    • Admission to union https://simple.wikipedia.org/wiki/List_of_U.S._states_by_date_of_admission_to_the_Union
    • Educational attainment https://nces.ed.gov/programs/digest/d18/tables/dt18_104.88.asp
    • Highest points https://geology.com/state-high-points.shtml
    • Life expectancy https://en.wikipedia.org/wiki/List_of_U.S._states_and_territories_by_life_expectancy
    • Median Age http://www.statemaster.com/graph/peo_med_age-people-median-age
    • Land area https://statesymbolsusa.org/symbol-official-item/national-us/uncategorized/states-size
    • Mean elevation https://www.census.gov/library/publications/2011/compendia/statab/131ed/geography-environment.html
    • Electricity price https://www.chooseenergy.com/electricity-rates-by-state/
    • Gasoline price https://gasprices.aaa.com/state-gas-price-averages/
    • GDP https://www.bea.gov/data/gdp/gdp-state
    • Sunlight North America Land Data Assimilation System (NLDAS) Daily Sunlight (insolation) for years 1979-2011 on CDC WONDER Online Database, released 2013. Accessed at http://wonder.cdc.gov/NASA-INSOLAR.html on Jun 14, 2019 1:37:15 PM
    • Births United States Department of Health and Human Services (US DHHS), Centers for Disease Control and Prevention (CDC), National Center for Health Statistics (NCHS), Division of Vital Statistics, Natality public-use data 2007-2017, on CDC WONDER Online Database, October 2018. Accessed at http://wonder.cdc.gov/natality-current.html on Jun 14, 2019 1:53:58 PM
    • Precipitation North America Land Data Assimilation System (NLDAS) Daily Precipitation for years 1979-2011 on CDC WONDER Online Database, released 2013. Accessed at http://wonder.cdc.gov/NASA-Precipitation.html on Jun 26, 2019 3:30:40 PM
    • Temperature http://www.usa.com/rank/us–average-temperature–state-rank.htm

    The map was created with the help of the open source leaflet javascript mapping library



    Visualizing the 4% Rule, Trinity Study and Safe Withdrawal Rates

    Posted In: Financial Independence | Money

    Facebooktwittergoogle_plusredditpinterestlinkedinmail

    Instructions for using the calculator:

    This calculator is designed to let you learn as you play with it. Tweaking inputs and assumptions and hovering and clicking on results will help you to really gain a feel for how withdrawal rates and market returns affect your chance of retirement success (i.e. making it through without running out of money).

    Inputs You Can Adjust:

    • Spending and initial balance – This will affect your withdrawal rate.  The withdrawal rate is really the only thing that is important (doubling spending and retirement savings will still yield the same success rate).
    • Asset allocation – Raise or lower your risk tolerance by holding more or less stock vs bonds
    • Adjust retirement length – This affects the number of historical cycles that are used in the simulation, but also increases risk of failure.
    • Add tax rates and investment fees – these will put a drag (i.e. lower) market returns and lower success rates

    Options for Visualization:

    • Display all cycles – this is the mess of spaghetti like curves that show all historical cycle simulations
    • Display percentiles – this aggregates the simulations into percentiles to show most likely outcomes
    • Hover/Click on legend years – this will allow you to highlight a single historical cycle (you can also use the arrow keys to step through historical cycles)
    • Bottom graph can show either the sequence of returns (with average returns in 5 year periods) for a single historical cycle or distributions of returns in our historical data (1871 to 2016) and a single historical cycle.  You can choose to look at returns for stocks, bonds or your specific asset allocation.
    • The graph on the right shows a histogram of the ending balance of each historical cycle and color codes them to show percentiles.


     

    What is the 4% Rule?


    The 4% rule is a “rule of thumb” relating to safe retirement withdrawals.  It states that if 4% of your retirement savings can cover one years worth of retirement spending (an alternative way to phrase it is if you have saved up 25 times your annual retirement spending), you have a high likelihood of having enough money to last a 30+ year retirement. A key point is that the probabilities shown here are just historical frequencies and not a guarantee of the future. However, if your plan has a high success rate (95+%) in these simulations, this implies that retirement plan should be okay unless future returns are on par with some of the worst in history.

    The overall goal of this rule and analysis is identifying a “safe withdrawal rate” or SWR for retirement.  A withdrawal rate is the percentage of your money that you withdraw from your retirement savings each year.  If you’ve saved up $1 million and withdraw $100,000 each year, that is a 10% withdrawal rate.

    The “safe” part of the withdrawal rate relates to the fact that if your investments generally grow by more than your annual spending, then your retirement savings should last over the length of your retirement.  But average returns do not tell the whole story as the sequence of returns also plays a very important role, as will be discussed later.

    One way to test this is through a backtesting simulation which forms the basis for the “Trinity Study”.

    What is the Trinity Study?

    The “Trinity Study” is a paper and analysis of this topic entitled “Retirement Spending: Choosing a Sustainable Withdrawal Rate,” by Philip L. Cooley, Carl M. Hubbard, and Daniel T. Walz, three professors at Trinity University. This study is a backtesting simulation that uses historical data to see if a retirement plan (i.e. a withdrawal rate) would have survived under past economic conditions.  The approach is to take a “historical cycle”, i.e. a series of years from the past and test your retirement plan and see if it runs out of money (“fails”) or not (“survives”).

    How do you test withdrawal rate?

    Given modern equity and bond market data only stretches back about 150 years, there is some, but not a huge amount of data to use in this simulation.  One example of a 30 year historical cycle would be 1900 to 1930, and another is 1970 to 2000.  The Trinity study and this calculator tests withdrawal rates against all historical periods from 1871 until the present (e.g. 1871 to 1901, 1872 to 1902, 1873 to 1903, . . . . 1986 to 2016).  Then across this 115 different historical cycles, it determines how many of these survived and how many failed.

    The thinking is that if your retirement plan can survive periods that include recessions, depressions, world wars, and periods of high inflation, then perhaps it can survive the next 30-50 years.

    The 4% rule that comes out of these studies basically states that a 4% withdrawal rate (e.g. $40,000 annual spending on a $1,000,000 retirement portfolio) will survive the vast majority of historical cycles (~96%).  If you raise your withdrawal rate, the rate of failure increases, while if you lower your withdrawal rate, your rate of failure decreases.

    The goal of this tool is to help you understand the mechanics of the a historical cycle simulation like was used in the Trinity Study and how the 4% rule came to be. This understanding can help you better plan for retirement with the uncertainty that goes along with planning 30+ years into the future. If you want to also see how longevity and life expectancy play a role in retirement planning, you can take a look at the Rich, Broke and Dead calculator.

    This post and tool is a work in progress. I have a number of ideas that I will implement and add to it to help improve the visualization and clarity of these concepts.

    Data source and Tools Historical Stock/Bond and Inflation data comes from Prof. Robert Shiller. Javascript is used to create the interactive calculator tool and the create the code in the simulations to test each historical cycle and aggregate the results, and graphed using Plot.ly open-source, javascript graphing library.

    4% rule trinity study

    How do Americans Spend Money? US Household Spending Breakdown by Education Level

    Posted In: Money

    Facebooktwittergoogle_plusredditpinterestlinkedinmail

    How much do US households spend and how does it change with education level?

    This visualization is one of a series of visualizations that present US household spending data from the US Bureau of Labor Statistics. This one looks at the education level of the primary resident.

    This visualization focuses on the education level of the primary resident. This is defined in the BLS documentation as the person who is first mentioned when the survey respondent is asked who in the household rents or owns the home.

    I obtained data from the US Bureau of Labor Statistics (BLS), based upon a survey of consumer households and their spending habits. This data breaks down spending and income into many categories that are aggregated and plotted in a Sankey graph.

    One of the key factors in financial health of an individual or household is making sure that household spending is equal to or below household income. If your spending is higher than income, you will be drawing down your savings (if you have any) or borrowing money. If your spending is lower than your income, you will presumably be saving money which can provide flexibility in the future, fund your retirement (maybe even early) and generally give you peace of mind.

    Instructions:

    • Hover (or on mobile click) on a link to get more information on the definition of a particular spending or income category.
    • Use the dropdown menu to look at averages for different groups of households based on the education level of the primary resident. This data breaks households into the following groups:
      • All
      • Less than HS graduate
      • High school graduate
      • HS grad + some college
      • Associate’s degree
      • Bachelor’s degree
      • Master’s, professional, doctoral degree

      The composition of households and income change as the education level of the primary resident changes, which in turn affects spending totals and individual categories.

    As stated before, one of the keys to financial security is spending less than your income. We can see that on average, income tends to increase with education level. Those with the highest incomes and greatest spending have advanced degrees, but they also save the most money.

    The group with the lowest education level (not finishing high school) have the lowest income and on average needs to borrow or draw down on savings to live their lifestyle.

    How does your overall spending compare with those that have the same education level as you? How about spending in individual categories like housing, vehicles, food, clothing, etc…?

    Probably one of the best things you can do from a financial perspective is to go through your spending and understand where your money is going. These sankey diagrams are one way to do it and see it visually, but of course, you can also make a table or pie chart (Honestly, whatever gets you to look at your income and expenses is a good thing).

    The main thing is to understand where your money is going. Once you’ve done this you can be more conscious of what you are spending your money on, and then decide if you are spending too much (or too little) in certain categories. Having context of what other people spend money on is helpful as well, and why it is useful to compare to these averages, even though the income level, regional cost of living, and household composition won’t look exactly the same as your household.

    **Click Here to view other financial-related tools and data visualizations from engaging-data**

    Here is more information about the Consumer Expenditure Surveys from the BLS website:

    The Consumer Expenditure Surveys (CE) collect information from the US households and families on their spending habits (expenditures), income, and household characteristics. The strength of the surveys is that it allows data users to relate the expenditures and income of consumers to the characteristics of those consumers. The surveys consist of two components, a quarterly Interview Survey and a weekly Diary Survey, each with its own questionnaire and sample.

    Data and Tools:
    Data on consumer spending was obtained from the BLS Consumer Expenditure Surveys, and aggregation and calculations were done using javascript and code modified from the Sankeymatic plotting website. I aggregated many of the survey output categories so as to make the graph legible, otherwise there’d be 4x as many spending categories and all very small and difficult to read.

    household spending