# Posts for Tag: graph

### How do Americans Spend Money? US Household Spending Breakdown by Household Composition

Posted In: Money
##### How much do US households spend and how does it change with household composition?

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 marital status and presence of children in the household.

This visualization focuses on how spending varies with the household composition (marital status and presence of children).

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
• Single person households (and other households) – Unfortunately BLS lumps single households with other categories that don’t fit into the remaining three categories (i.e. non-married couple households).
• Single parent households
• Married couples with no children
• Married couples with children

The composition of households and income change as the marital status of and presence of children in the household 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 the larger the number of children and adults in the household. Married couples with children have the highest incomes and greatest spending, but they also save the most money.

Households with a single occupant (and also single parent households) have lower incomes than married couples and on average need to borrow or draw down on savings to live their lifestyle.

How does your overall spending compare with those that have the same household composition 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 2017 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.

### Cumulative CO2 emissions calculator

Posted In: Environment

CO2 emissions are the primary contributor to our current ‘climate crisis’. Because of buildup of heat-trapping nature of CO2 and other greenhouse gases in the atmosphere, temperatures are rising and weather and precipitation patterns are changing. Changes in climate will have profound impacts on both natural systems and our human landscapes.

Significant emissions of CO2 really started in the industrial revolution. This is when humans really started using significant quantities of non-renewable energy sources, mainly fossil fuels such as coal and later natural gas and oil. The increase in the burning of hydrocarbon energy sources for powering factories and transportation lead to growing CO2 emissions. The following graph shows the annual emissions of CO2 since 1750, before the start of the industrial revolution. In this period of 269 years, humans have emitted 1600 billion tonnes of CO2 (1600 gigatonnes). One incredible fact is that due to rapid growth in population and energy use per capita over time, we are emitting more and more CO2 each year and that humans have emitted as much in the last 28 years than in the 240 years prior to that.

#### Instructions

• The interactive visualization lets you enter any year between 1750 and 2017 and it will show the relative proportion of human CO2 before and after that year.
• You can also use the left and right arrow keys to change the year up and down
• If you hover over the graph you can see the annual and cumulative emission for each individual year in the graph
• If you want to share the visualization with a specific year highlighted, you can add the following to the URL “?yr=yyyy” where yyyy is the four digit year (e.g. https://engaging-data.com/most-emissions-last-30-years/?yr=1980).

The global median age is around 30 years old (i.e. half the people on earth were born after 1989). This means that more than half of the earth’s population has seen the global cumulative CO2 emissions double in their lifetime. Also very striking is that in my children’s lifetimes (around a decade), humanity has added nearly 1/5 of all human produced CO2 ever to the atmosphere.

Notes: Emissions are in units of gigatonnes of CO2. To convert to gigatons of carbon, another common unit of measuring carbon emissions, divide by 3.666.

Data source and Tools
Annual emissions data is from the Global Carbon Project. The data is processed in javascript and plotted using the open-source, javascript plotting library, Plotly.

• ### Where on Earth is all the water? From the solar system to living things

Posted In: Science | Water

Earth is known as the blue planet, because it’s covered with quite a bit of water. But do you know where all that water on Earth is located? This interactive visualization will show the various amounts of water in its many forms on Earth: Oceans, Lakes, Rivers, Ice, Groundwater, etc….

If you hover over a part of the circular, sunburst graph, it will show you the amount of water that is in each of the various forms shown. If the label for that form is bolded, you can click on it and see further subdivisions beyond that broad category. For example, if you click on Oceans, it will show you how the water in the oceans is distributed among the five main oceans on Earth. As you move towards more focused views on the graph, you can click on the center of the circle to move back out to larger categories and see the big picture again.

As you can see, most of the water on Earth is found in a salty form, and most of that is in the oceans. It can be hard to click through to see freshwater lakes and rivers, as you have to be very precise to expand the “Surface Water” wedge, when you are looking at all “Freshwater”.

Even smaller, on that same visualization, is the “Living things” wedge is basically invisible. You can further explore the details of the living things category by clicking on the button that appears on the freshwater graph.

Checking the Group Rivers and Lakes checkbox will group rivers by continent and lakes by major groups.

It is interesting to see how much water there is on Earth (about 1.4 billion cubic kilometers of water), but how little of it is non-salty, liquid freshwater at the surface (about 100,000 cubic kilometers, though that is still quite a lot) but it only makes up about 0.008% of all water on Earth. That means for every 10,000 gallons of water on Earth, only one of those gallons is freshwater in a lake or river that we can easily access.

It is also believed that there is more water deep in the Earth’s interior (i.e. the mantle) than on the surface or near-subsurface, but estimates of that are highly uncertain and are not included in this graph.

If you click out past Earth’s water to look at water in the solar system, the estimates shown in this visualization are only including liquid water and do not include estimates of ice (which I haven’t been able to find estimates of). The amount of water in living things is estimated assuming that the ratio of organic carbon to liquid water is more or less the same across all different types of living things (i.e. viruses, bacteria, fungi, plants, animals, etc.). This isn’t a great assumption but the estimates, which come from estimates of the dry carbon weight of these organisms, vary across many orders of magnitude so being off in liquid water weight/volume by a factor of two or so isn’t a huge problem.

Tools and Data Sources
The sunburst chart is made using the open source, javascript Plot.ly graphing library. Data on water distributions is primarily from Wikipedia – Distribution of WaterList of Rivers by DischargeList of Lakes Weight of Living BiomassExtra-terrestrial water estimates

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

Posted In: Financial Independence | Money

#### 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.

#### If 4% is a conservative rate, what is the maximum withdrawal rate?

The future is unlikely to be identical to any of the set of historical cycles that are used in this simulation. And yet, there are enough years of data that there are a fairly large set of possible outcomes from running a simulation with this input data. One way to understand this variation is to see in the main graph above that the ending balance can potentially vary by more than $5 million dollars on an inflation adjusted basis on a starting balance of$1 million.

Another way to see this same variation in market returns is by looking at maximum withdrawal rate. This is the highest amount that you could withdraw annually over your retirement and (just barely) not run out of money by the end of your retirement.

This graph shows the maximum withdrawal rate for a given historical cycle (i.e. 1871 to 1901). For example, in the 1871 to 1901 30 year historical cycle, you could have used an 8.8% withdrawal rate (inflation adjusted $80,000 withdrawal annually on a$1 million initial investment balance) and not run out of money. This is because the sequence of market (stock and bond) returns in this historical cycle were able to (barely) outpace the rate of withdrawals at the end of the 30 year retirement period. Many other cycles show lower successful withdrawal rates, because those cycles had poorer sequences of returns, while some had higher maximum withdrawal rates.
The graph also highlights those cycles that show a maximum withdrawal rate below 4% in red, while all others are shown in green. Most of these withdrawal rates are well over 4%, with some quite a bit higher. This again shows that if the future is somewhat like one of these historical cycles, most likely a 4% withdrawal rate will be enough for you to retire without running out of money and that it is likely that you could end up with more money than you started.

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.

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

Posted In: Money
##### 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.

### What are the highest mountains on Earth? Measuring from sea level vs center of earth

Posted In: Geography

#### The Highest Mountains On Earth Depend On How You Measure “High”

Mount Everest is famous for being the highest mountain on Earth. The peak is an incredible 8,848 meters (29,029 ft) above sea level. But that is only one way to measure the height of a mountain. Chimborazo, a mountain in Ecuador, holds the distinction for the mountain whose peak is the furthest from the center of the Earth. How is that possible? This is because the Earth is not a perfect sphere. Rather, due to the spinning of the Earth around it’s axis, the centrifugal force causes the equator to bulge out slightly. This flattened shape is called an oblate spheroid and makes the radius of the earth at the equator about 22 km (about 0.3%) larger than the radius to the poles. Mountains close to the equator will “start” further away from the center of the earth, than those at higher latitudes.

This graph plots over 800 of the highest mountains on Earth with their peak height above sea level on the x-axis and their peak distance from the center of the earth on the y-axis. Each point represents one mountain. The colors of the plots correspond to the latitude of the mountain. These mountains range from 3000 meters in height to 9000 meters in height. You can hover over a data point (or click on mobile) to get more information about the mountain. You can also switch from metric to imperial units with the button on the graph.

For a given mountain range at a certain latitude, you can see that as the mountain heights above sea level increases, so does their distance from the center of the Earth. Mountains in the southern hemisphere are colored in blue, those around the equator are green and yellow, and those in the northern hemisphere are red and orange. The mountains with the highest peaks above sea level are shown on the right side of the graph in red and orange (mostly in the Himalaya), with Mt Everest as the right most point on the graph (nearly 9000 meters tall).

Mountains with peaks the greatest distance from the center of the earth are found near the equator in light green/yellow and are found at the top of the graph. You’ll notice that a number of these mountains are higher than Mt Everest when looking at the distance from the center of the earth.

The Himalayas are the “highest” mountains on earth if you are measuring height from sea level, while the Andes are the “highest” if you measure from the center of the earth.

#### Calculating Distance from Earth’s Center to Mountain Peak

The distance from the center of the Earth is calculated from the following formula:
$$D_{mountain} = H_{mountain} + R_{lat}$$
where $D_{mountain}$ is the distance from center of earth to the top of the mountain, $H_{mountain}$ is the mountain height above sea-level and $R_{lat}$ is the radius of earth at the mountain’s latitude. The height is data that was downloaded from a list of mountain heights.

and the radius of the earth for a given latitude is calculated using the formula:
$$R_{lat}=\sqrt{a^2cos(lat)^2+b^2sin(lat)^2\over acos(lat)^2+bsin(lat)^2)}$$
where $a$ and $b$ are the equatorial and polar radii (6378.137 km and 6356.752 km respectively).

#### Earth Radius Calculator

Here is a calculator for determining the radius of Earth at a given latitude:

You can use this to calculate the distance from the center of the earth to sea level at your latitude.

Data and Tools:
Data on the heights of over 800 mountain peaks over 3000 meters in height was downloaded from Wikipedia. There ended up being alot of google searching and data cleaning to get it into suitable format for plotting. The calculations were made with javascript and plotted using plotly, the open source javascript graphing library.