to your HTML Add class="sortable" to any table you'd like to make sortable Click on the headers to sort Thanks to many, many people for contributions and suggestions. Licenced as X11: http://www.kryogenix.org/code/browser/licence.html This basically means: do what you want with it. */ var stIsIE = /*@cc_on!@*/false; sorttable = { init: function() { // quit if this function has already been called if (arguments.callee.done) return; // flag this function so we don't do the same thing twice arguments.callee.done = true; // kill the timer if (_timer) clearInterval(_timer); if (!document.createElement || !document.getElementsByTagName) return; sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; forEach(document.getElementsByTagName('table'), function(table) { if (table.className.search(/\bsortable\b/) != -1) { sorttable.makeSortable(table); } }); }, makeSortable: function(table) { if (table.getElementsByTagName('thead').length == 0) { // table doesn't have a tHead. Since it should have, create one and // put the first table row in it. the = document.createElement('thead'); the.appendChild(table.rows[0]); table.insertBefore(the,table.firstChild); } // Safari doesn't support table.tHead, sigh if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; if (table.tHead.rows.length != 1) return; // can't cope with two header rows // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as // "total" rows, for example). This is B&R, since what you're supposed // to do is put them in a tfoot. So, if there are sortbottom rows, // for backwards compatibility, move them to tfoot (creating it if needed). sortbottomrows = []; for (var i=0; i
Each year, millions of Americans engage in trillions of transactions. But did you ever wonder where the money goes? And if you did, did you ever wonder what affects where the money goes?
We have and we did, so we went data mining in the Bureau of Labor Statistics' Consumer Expenditure Survey for 2008, which has only been available since 6 October 2009. Since we've previously looked at how income is distributed by age group in the U.S., it was natural for us to start by considering spending based on this criteria.
So we went through the data and used it to create the chart to the right, which shows the relative percentage of each average major expenditure category for each identified age group with respect to their total expenditures, including the amount of taxes they paid. Given the number of individual expenditure categories, we made the following modifications to make the chart less congested, which hopefully makes sense to group as we have:
We then ranked the expenditures from high to low value according to each category's percentage of total expenditures, leaving the "All Other Expenditures" category at the end.
The neat thing about this approach is that we can get a very good sense of not just relatively how much money goes where in the U.S., but also what factors drive Americans' spending. We can do that by looking more closely at the size of the spread of the data points for each category and the order in which they're ranked.
Here, for example, we see that age is a primary driver of expenditures for both Health Care and Cash Contributions (see the BLS' definition for each of these categories here), which we see both a wide spread in the data and that the percentage of total expenditures is ranked in order from youngest to oldest.
Meanwhile, we see that spending on education is also age driven, but not in the same way. Here, we see that those under Age 25 and the Age 45-54 group are widely separated from all the others, which fall into an otherwise very narrow spread. What we're most likely seeing here is the impact of education spending incurred by students (those under Age 25) and their parents (Age 45-54). The education expenditures of all the other age groups is much less significant in comparison.
Speaking of narrow spreads, we see in both the narrowness of spreads and apparent random order of the data points for the categories of Entertainment, Apparel and Services and All Other Expenditures that these factors may be almost be simply taken as a straight percentage of total expenditures for each age group.
Now here's something cool - the age data also gives us a hint of another factor that drives American spending: income. Because we've previously looked at how income is distributed by age (as well as by age and educational attainment), we know for instance that those in the Age 45-54 group have the highest average incomes of all age groups as well as the relative rankings of the other age groups.
Knowing that ranking, we can see by the spreads in the data points for the categories of Personal Taxes and Housing would appear to be highly influenced by income. Retirement Savings is also highly affected by income, but also by age. Here, we see the relative ranking of age groups by income from young to old, but we also see those age groups who are taking retirement rather than saving for it at the very bottom, which makes sense.
We'll take a closer look at the spending by Americans that would seem to be driven by their income next.
Bureau of Labor Statistics. "Table 3. Age of reference person: Average annual expenditures and characteristics, Consumer Expenditure Survey 2008". ftp://ftp.bls.gov/pub/special.requests/ce/standard/2008/age.txt. Accessed 16 November 2009.
Labels: data visualization, demographics, income distribution
Welcome to the blogosphere's toolchest! Here, unlike other blogs dedicated to analyzing current events, we create easy-to-use, simple tools to do the math related to them so you can get in on the action too! If you would like to learn more about these tools, or if you would like to contribute ideas to develop for this blog, please e-mail us at:
ironman at politicalcalculations
Thanks in advance!
Closing values for previous trading day.
This site is primarily powered by:
The tools on this site are built using JavaScript. If you would like to learn more, one of the best free resources on the web is available at W3Schools.com.