Site icon R-bloggers

Philadelphia loses a TIGER — Bad omen or statistical inevitability?

[This article was first published on Normally Skewed, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
< section class=" section--body">

Lions, TIGERs, US DOT Funding, oh my.
For the first time in seven years, Philly has lost a TIGER. WHAT?! Not to worry, there are no escapees from the Philadelphia Zoo. No, TIGER has nothing to do with the animal, or the baseball team from Detroit, or the US Census Bureau’s geographic shapefiles. Today we’ll be talking about Transportation Investment Generating Economic Recovery (TIGER). As WHYY’s Newsworks reports, Philadelphia’s winning streak ended this year, coinciding with the recent change in mayoral administrations.

< section class=" section--body">

Quick Background on TIGER Grants
TIGER grants are distributed by the US Department of Transportation every year to US cities and municipalities to make — you’ve probably guessed it! — transportation and infrastructural improvements. As the name might imply, the grant was started in response to the Great Recession of ‘07-’09, as a way to generate jobs (hence, there is a stated preference for “shovel-ready” projects) as well as reduce US cities’ energy dependence. For much more detail and history on the grant, see the grant’s website and Wikipedia. The grants are quite competitive. As Newsworks.org reports, about $9.3 billion in applications are submitted, with half a billion dollars ultimately distributed.

< section class=" section--body">

Data!
Well, thanks to the open data revolution, the US DOT has kindly published a dataset of all winning projects since the grant’s inception. I’ve taken the dataset and run a quick analysis to see what these grants look like, and where Philadelphia stacks up against other localities. For those in the analytic weeds, I’m using the R programming language for this analysis and will post in some of the relevant code throughout the post. If you’re not interested, skip over the gray code boxes. My full code is in this github repo.

First, let’s look at where Philly stacks up in terms of its award amounts. The graph below shows the distribution of award amounts, and where Philadelphia specifically stands.

## Load in required packages
mods=c('data.table','raster','&amp;amp;amp;amp;lt;span class=&amp;amp;quot;mceItemHidden&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;rgeos&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;','&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;ggplot2&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;','&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;ggthemes&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;','&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;ggmap&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;','sp','leaflet','&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;maptools&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;')
invisible(&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;lapply&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;(mods, function(x) require(x,character.only=TRUE,quietly = TRUE)))

## Load in TIGER grant dataset
tg=fread('https://www.transportation.gov/sites/dot.gov/files/docs/tiger_allUpdate.csv')

## note to self, tweet &amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;tweet &amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;USDOT&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt; &amp;amp;amp;amp;amp;amp; tell them not to put spaces in column headings...
&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;setnames&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;(tg, tg[,&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;gsub&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;('[^[:&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;alnum&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;:]]','',names(tg))])

## Create a column for year of award
tg[,Year := as.integer(gsub(&amp;amp;quot;[^0-9]&amp;amp;quot;,&amp;amp;quot;&amp;amp;quot;,Round))]

#&amp;amp;amp;amp;lt;span style=&amp;amp;quot;line-height: 1.7;&amp;amp;quot; data-mce-style=&amp;amp;quot;line-height: 1.7;&amp;amp;quot;&amp;amp;amp;amp;gt;# change award amount to numeric
&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;tg[,Amount:=as.numeric(gsub(&amp;amp;quot;[\\$,]&amp;amp;quot;,&amp;amp;quot;&amp;amp;quot;,Amount))]

# And a column to show whether we're us or not
tg[,Phila:=&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;ifelse&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;(&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;grepl&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;(&amp;amp;quot;*[Pp]hila*|Southeastern Pennsylvania Transportation Authority|*SEPTA*|Center City District&amp;amp;quot;,Applicant)==TRUE,1,0)]

# Create indicator for Philadelphia
tg_p=tg[Phila==1,]

## Plot the data
&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;ggplot&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;(data=tg, aes(x=as.character(Year),y=Amount/&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;1e6&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;,fill=as.character(Year))) +
  geom_boxplot() + geom_point(data=tg_p, aes(x=as.character(Year), y=Amount/1e6), size=3,color=&amp;amp;quot;darkred&amp;amp;quot;)+
geom_text(data=tg_p,aes(x=as.character(Year),y=Amount/1e6,label=paste0('$',round(Amount/1e6,1),'M')),vjust=-1,&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;face&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;=('bold.italic'))+
scale_y_continuous(labels = scales::dollar_format(prefix=&amp;amp;quot;$&amp;amp;quot;,suffix=&amp;amp;quot;M&amp;amp;quot;))+
labs(x=&amp;amp;quot;Funding Year&amp;amp;quot;,&amp;amp;amp;amp;amp;nbsp;y=&amp;amp;quot;Distribution of Amounts in Millions&amp;amp;quot;,&amp;amp;amp;amp;amp;nbsp;title=&amp;amp;quot;Philly's award amounts vs. all other applicants&amp;amp;quot;)+
guides(fill=FALSE)

These boxplots show the range of amounts that applicants won each year. Philadelphia’s wins are labeled with a red dot and its award amount.

Since 2010, Philly has earned on average a cool $10.1M per funding round.

By the way, here are Philly’s project names and the project types they fell under:

amt=tg[Phila==1,list(Year,&amp;amp;amp;amp;lt;span class=&amp;amp;quot;mceItemHidden&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;Year &amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;ProjectName&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;,&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;ProjectName &amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;ProjectType&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;,Amount=paste0('$',Amount/&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;1e6&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;,'M'))]
amt[order(Year),]

Year | ProjectName | ProjectType | Amount
2009 | Philadelphia Area Pedestrian and Bicycle Network (PA and NJ)          
                   | Bicycle and Pedestrian | $23M
2010 | Dilworth Plaza and Concourse Improvements | Transit | $15M
2011 | IMPaCT Philadelphia | Transit | $10M
2012 | Wayne Junction Substation Replacement | Transit | $12.9M
2013 | SEPTA-CSX Separation Project | Rail | $10M
2014 | Roosevelt Boulevard Multimodal Study | Regional Planning | $2.5M
2015 | Closing the Gaps | Road | $10.3M

And the total number of awards distributed each year:

# count number of awards by year
yr = tg[,.N,Year]

# plot
&amp;amp;amp;amp;lt;span class=&amp;amp;quot;mceItemHidden&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;ggplot&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;(data=yr,aes(x=as.character(Year),y=N)) +
 geom_bar(stat=’identity’,fill=’gray40') +
 geom_text(aes(y=N,label=N),vjust=1.5,color=’white’,face=’bold’)+
 labs(x=”Funding Year”
 ,y=”Number of Applications Awarded”
 ,title=”Number of successful applications by funding year”)
< section class=" section--body">

Okay, Philadelphia has been consistent, but what does it mean that the new Office of Transport and Infrastructure (OTIS) didn’t win an award? It’s a let-down, but does it really reflect poorly on the new mayoral administration? As the article states, although the high-level leadership changed, most of the grant-writing staff probably stuck around. To answer this question, it’s worth looking at how (a)typical it is to win 7 times.

This was a little bit tricky from a data perspective. Applicants can be either municipalities (e.g. the City of Philadelphia), agencies (e.g. SEPTA, PENNDOT), or states (e.g. — yeah…). So identifying the “unique” winners, is kind of confusing. And as the Newsworks article mentions, Philadelphia won in a way, through SEPTA’s relationship with the Delaware Transit Corporation (DTC, which won an award, reimburses SEPTA for certain operating costs). To get a clean and consistent dataset, I overlayed the latitude/longitude points of each award site on a county-level map of the US, which brings the analysis to the county level. The next graph assumes that if a project site landed in a particular county, the award is attributed to or otherwise purposed for that county. The approximation should be close enough for, you know, government work…

## Download the Census county file
&amp;amp;amp;amp;lt;span class=&amp;amp;quot;mceItemHidden&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;&amp;amp;amp;amp;lt;span&amp;amp;amp;amp;gt;&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;download.file('ftp://ftp2.census.gov/geo/tiger/&amp;amp;amp;amp;lt;span class=&amp;amp;quot;mceItemHidden&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;&amp;amp;amp;amp;lt;span class=&amp;amp;quot;hiddenSpellError&amp;amp;quot; pre=&amp;amp;quot;&amp;amp;quot; data-mce-bogus=&amp;amp;quot;1&amp;amp;quot;&amp;amp;amp;amp;gt;TIGER2016&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;/COUNTY/tl_2016_us_county.zip','cty_shp.zip')&amp;amp;amp;amp;lt;/span&amp;amp;amp;amp;gt;

# Create a folder

shp &amp;amp;amp;amp;amp;lt;- readOGR('C:/Users/danieladdyson/Desktop/cty_shp',layer='tl_2016_us_county') # Census county shapefile

# turn TIGER lat/long data to spatial points
crs = shp@proj4string@projargs
pts=SpatialPointsDataFrame(coords=tg[,list(Longitude,Latitude)], data=tg, proj4string=CRS(crs) )

# overlay grant sites on map of US counties
sj = data.table(over(pts,shp))
sj=cbind(tg,sj)
sj[,NAME:=as.character(NAME)]
cty_wins = as.data.table(sj[,table(GEOID)])
wins_summary = cty_wins[,list(freq=.N),by=list(n_events=N)]
wins_summary[,rate:=n_events*freq] # marginal probabilities

# rate of wins per county
cty_wins = as.data.table(sj[,table(GEOID)]) # Number of wins by county -- the counties may be slightly off due to map overlay errors
# cty_wins[!duplicated(GEOID),.N] 269 unique counties
wins_summary = cty_wins[,list(freq=.N),by=list(n_events=N)] # Number of counties (269) X number of wins (381)
wins_summary[,rate:=n_events*freq] # marginal probabilities

# mean number of wins
mu_wins = wins_summary[,sum(rate)/sum(freq)]

# standard deviation of mean number of wins
sd_wins = sqrt(mu_wins)
sd_rng = c(mu_wins+sd_wins, # 1 standard deviation upper
mu_wins+sd_wins*2, # 2 standard deviation upper
mu_wins+sd_wins*3 # 3 standard deviation upper)
txt=data.frame(lab=c('Average\n# wins','1 Std Dev','2 Std Dev','3 Std Dev'),
  x=c(round(mu_wins,1),round(sd_rng,1)), y=rep(100) )

## Exact confidence intervals
ex_ci=poisson.test(sum(wins_summary$rate),sum(wins_summary$freq))$conf.int[c(1,2)]

## plot out the counts + SDs &amp;amp;amp;amp;amp;amp; exact CIs
ci_pal = brewer.pal(3,'Set1')
sd_pal = brewer.pal(6,'Reds')
hi_cty = data.frame(cty = c('King, WA','Philadelphia, PA','Los Angeles, CA','Cook, IL'),
                    X=c(6,7,7,8),Y=c(10,22,10,10))
ggplot(data=wins_summary,aes(x=n_events,y=freq))+
geom_bar(stat='identity',color='grey58')+
scale_x_continuous(breaks = c(1:8), labels = c(1:8))+
geom_vline(xintercept = mu_wins,color=ci_pal[2],size=1)+
geom_vline(xintercept = ex_ci,color=ci_pal[3],linetype='longdash',size=.7)+
geom_vline(xintercept = sd_rng,color=sd_pal[c(4:6)],size=1)+
geom_text(data=txt,aes(label=paste0(lab,':\n',x),x=x,y=y,hjust=-.001),size=3.5)+
geom_text(data=hi_cty,aes(x=X,y=Y,label=cty),size=3,angle=35,hjust=-.01)+
labs(x='Number of grants won',y='Number of counties',title= &amp;amp;quot;Statistical deviation of grant wins&amp;amp;quot;)

This graph shows that Philadelphia’s wins are highly statistically significant (the green dashed lines are 95% confidence intervals; red lines are standard deviations from the mean). Data-related stuff: Chicago Transit Authority and Illinois DOT both had wins in 2011 and 2012, which is why Cook/Chicago has eight wins in seven years. Statistics-related stuff: I very subjectively determined that the data assumed a Poisson distribution here. But I performed no statistical tests for sensitivity, so feel free to debate that. I also calculated exact confidence intervals for the mean, rather than for the normal distribution.

So, Philadelphia has been really, really good at winning, and it looks like that’s a pretty hard feat, given that the over half the counties only won a single award. And this next graph demonstrates the probability of winning 1,2,…7 times:

## calculate probabilities
p=cbind(lapply(c(1:8), ppois, lambda=mu_wins, lower.tail=FALSE))
probs=data.frame(p=unlist(cbind(lapply(c(1:8), ppois, lambda=mu_wins, lower.tail=FALSE))),wins=c(1:8))

## Plot probability data
ggplot(data=probs,aes(x=wins,y=p))+geom_line()+
scale_y_continuous(labels = scales::percent,limits = c(0,.45))+
geom_text(aes(label=sprintf(“%1.2f%%”, 100*p)),hjust=-.1,vjust=-.5)+
labs(x=’Number of wins’,y=’Probability of achieving # wins’)+
scale_x_continuous(breaks=c(1:8))

There’s a .01% chance of winning seven or more times. That’s small.
< section class=" section--body">

To conclude,

My analysis shows that among the winners, Philadelphia’s winning streak was highly aberrant (in a good way, of course). From a federal perspective, this is probably a good thing, as it would look strange if just a few localities were winning over and over (I have more to show on that below!). And although the loss could have been from some major change in this year’s grant writing procedures or application quality that were consequences of Jim Kenney’s new administration, it would be hard to discern that, given that the city’s winning streak is so highly statistically significant.

I should strongly caution, that this analysis is based on only the grant winners. We don’t have any data on the losers. And because of that, we don’t know how rare any one success is. But considering that $500M in disbursements is only about 5.4% of $9.3B in applications, I’m going to say it ain’t easy. And that could potentially make Philly’s wins even more statistically significant (because you’d be adding a really tall bar at 0 for all the counties who never won). So don’t feel bad, Mr. Kenney! There’s always next year.

< section class=" section--body section--last">

Geographic locations of projects

After mapping to the counties to look at probabilities of wins, I aggregated to a higher level, this time US Census Divisions and Regions, to see where projects were getting awarded by year.

## Download the US Census Division shapefile
download.file('&amp;amp;amp;lt;a class=&amp;amp;quot;markup--anchor markup--pre-anchor&amp;amp;quot; href=&amp;amp;quot;http://www2.census.gov/geo/tiger/GENZ2015/shp/cb_2015_us_division_500k.zip%27,%27USCB_div.zip%27&amp;amp;quot; target=&amp;amp;quot;_blank&amp;amp;quot; rel=&amp;amp;quot;nofollow&amp;amp;quot; data-href=&amp;amp;quot;http://www2.census.gov/geo/tiger/GENZ2015/shp/cb_2015_us_division_500k.zip%27,%27USCB_div.zip%27&amp;amp;quot;&amp;amp;amp;gt;http://www2.census.gov/geo/tiger/GENZ2015/shp/cb_2015_us_division_500k.zip','USCB_div.zip'&amp;amp;amp;lt;/a&amp;amp;amp;gt;)
unzip('USCB_div.zip',exdir='div_shp') # unzip &amp;amp;amp;amp; create a folder
div &amp;amp;amp;lt;- readOGR('C:/Users/A770213/Desktop/div_shp',layer='cb_2015_us_division_500k') # Census county shapefile
crs=div@proj4string@projargs # set coordinate reference system
pts=SpatialPointsDataFrame(coords=tg[,list(Longitude,Latitude)], data=tg, proj4string=CRS(crs)) # match points &amp;amp;amp;amp; shapefile’s CRS
# div@proj4string@projargs == pts@proj4string@projargs TRUE
site_div = data.table(over(pts,div))
site_div=data.table(cbind(pts@data,site_div))
xtabs(~site_div$NAME+site_div$Year)

                    Year
Division Name      2009 2010 2011 2012 2013 2014 2015
East North Central    8    9    6    6    4    6    4
East South Central    4    1    2    3    4    4    3
Middle Atlantic       2    9    6    5    4    6    5
Mountain              7    7    3    5    7    9    5
New England           6    7    4    5    6    6    5
Pacific               9   11    7    6    7   10    8
South Atlantic        5   16    7    7    8   14    3
West North Central    5   10    5    5    5   10    4
West South Central    5    4    4    5    6    7    2

I aggregated divisions into Census regions and came out with the following:

tab=site_div[,list(cnt=.N,amt=sum(Amount)),by=list(div_name=NAME,year=Year)]
tab[,':='(yr_cnt=sum(cnt),yr_amt=sum(amt)),by=year]
tab[,':='(cnt_pct=round(cnt/yr_cnt,3),amt_pct=round(amt/yr_amt,3))]
tab_m=melt(tab,id.vars = c('year','div_name'),measure.vars=c('cnt_pct','amt_pct'))
tab_m[,variable := factor(variable,levels=c('amt_pct','cnt_pct'),labels=c('Percent of Dollars Awarded','Percent of Awards Given'))]
tab_m[,reg_name:=ifelse(div_name %in% c('New England','Middle Atlantic'),'Northwest',&amp;amp;amp;nbsp;ifelse(div_name %in% c('East North Central','West North Central'),Midwest',ifelse(div_name %in% c('South Atlantic','East South Central','West South Central'),'South’,'West')))]

tab_m2 = tab_m[,list(value=sum(value)),by=list(year,reg_name,variable)]
ggplot(data=tab_m2,aes(x=year,color=reg_name,y=value))+
geom_line(stat=’identity’,size=1)+
scale_x_continuous(breaks=c(2009:2015),labels=c(2009:2015))+
scale_y_continuous(labels=scales::percent)+
labs(x='Funding Year',y='Percent of Total Awarded',title='Regional share of total awards &amp;amp;amp;amp; award amounts',&amp;amp;amp;nbsp;color='US Region')+
theme(axis.text=element_text(size=10,color='black'),axis.text.x=element_text(angle = 90,vjust=.5),strip.text=element_text(size=10,color='black',face='bold'),legend.text=element_text(size=10))+
facet_grid(variable~.)

The South has really been killing it on wins over the past few years, although it looks like there was some kind of serious shift in 2015. Again, without knowing the total number of submissions (i.e. wins vs losses), it’s hard to judge what these numbers really represent. The South has the highest number of states of the Census Regions and thus more potential applicants; it could all just be a matter of scale. Southern states also may have generally lower economies and rely more heavily on federal funding, which could also drive up the number of applicants. There’s a blog post from wallethub that shows a state-level breakdown of federal funding, although we’d need to join states and regions together for an accurate view. For my next data adventure, I’ll have to pull that data and join it to the TIGER funding data.


To leave a comment for the author, please follow the link and comment on their blog: Normally Skewed.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.