Monday, November 21, 2011

Revenue and Outlays 1980-1989

As the visualization indicates, revenues grew during the 1980's after cuts in marginal income tax rates, while spending also increased outpacing revenues and driving deficits.
The default charts were produced from default output (html and flash) generated by the R-code that follows.

I added one tweak, as described in the google visualization documentation here:
http://code.google.com/apis/chart/interactive/docs/gallery/motionchart.html which essentially saves the modifications to the settings in the chart. For more info regarding the data format, see my earlier post here.

Note- there are 3 visualization options - bubbles, dynamic bar chart, and a static line graph . These can be selected using the tabs at the top of the graph.

Created Using R- GoogleVis Package
Flash Enable Browser Required!



Data: budget • Chart ID: MotionChartID32de6867
R version 2.13.1 (2011-07-08) • googleVis-0.2.11
Google Terms of UseData Policy

We also saw patterns of increasing revenues during the Bush years following cuts in marginal tax rates, and a period from 2003-2007 where revenues were increasing and deficits were falling.  After the financial crisis, notice how revenues plunged while the deficit exploded.

Revenues and Outlays 2003-2009

(if preloaded labels and settings are not immediately applied, please use direct link for this post here.)


The data source is the CBO Budget/Historical Tables. I'd provide a link but it moves around constantly. A Google search should direct you to the most recent data.

R-Code:(for the first visualization)

#  ----------------------------------------------------------------------------------
# |PROGRAM NAME: budget_vis_R
# |DATE: 11/21/11
# |CREATED BY: MATT BOGARD 
# |PROJECT FILE:              
# |----------------------------------------------------------------------------------
# | PURPOSE: visualization of revenues and outlays in relation to 
# |          cuts in marginal tax rates 1980-89        
# | 
#  ---------------------------------------------------------------------------------
 
# see http://stackoverflow.com/questions/4646779/embedding-googlevis-charts-into-a-web-site/4649753#4649753
# for original R code reference
 
install.packages('googleVis') # install package if first time
 
library(googleVis) # load package
 
#  set R working directory- this is where your data file will go
#  with the script for creating the visualization
 
setwd("C:\\Users\\Documents\\Briefcase\\R Code and Data")
 
# read pre-formated  data
 
budget <- read.csv("budget.csv", na.strings=c(".", "NA", "", "?"), encoding="UTF-8")
names(budget)
 
M <- gvisMotionChart(budget, "ITEM","YEAR")
 
#  look at data object- this includes the script that
#  will be used if you want to publish on your web page/blog
 
print(M) 
 
# open your browser and display the visualization
 
plot(M)
Created by Pretty R at inside-R.org

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.