Wolfram Language

Richer Knowledgebase Access

National Science Foundation Grants

The US National Science Foundation (NSF) awarded nearly 12,000 grants in 2015. Here, awards, investigators, and their affiliated institutions are analyzed using data available from www.nsf.gov/awardsearch/download.jsp. In particular, you can load an entity store containing this data as a ResourceObject, then explore the distribution of grant sizes, quantitative and qualitative properties of the proposals and grants, and geographic dispersal of associated institutions.

To begin, load an entity store containing the NSF data from a ResourceObject.

In[1]:=
Click for copyable input
nsfStore = ResourceData[ ResourceObject[ Association[ "Name" -> "National Science Foundation Grants - 2015", "UUID" -> "0e9655df-86b6-4e20-bcc9-87365562357b", "ResourceType" -> "DataResource", "Version" -> "1.0.0", "Description" -> "Data on National Science Foundation grants (and \ associated investigators and institutions) awarded in the the year \ 2015.", "ContentSize" -> Quantity[0, "Bytes"], "ContentElements" -> {"EntityStore"}]]]
Out[1]=

Register the store for this session.

In[2]:=
Click for copyable input
PrependTo[$EntityStores, nsfStore];

View available grant properties using the "NSFGrant" entity type from the store.

In[3]:=
Click for copyable input
EntityValue["NSFGrant", "Properties"]
Out[3]=

Return data on a randomly selected grant.

show complete Wolfram Language input
In[4]:=
Click for copyable input
TextGrid[List @@@ (RandomEntity["NSFGrant"]["PropertyAssociation"] // SortBy[#, ByteCount] & // Normal // Take[#, 16] &), Dividers -> All, Background -> {Automatic, {{LightBlue, None}}}] // TraditionalForm
Out[4]//TraditionalForm=

Plot the distribution of grant sizes.

In[5]:=
Click for copyable input
awardAmounts = EntityValue["NSFGrant", "AwardAmount"];
In[6]:=
Click for copyable input
Histogram[awardAmounts, ScalingFunctions -> {Identity, "Log"}, PlotRange -> All, AxesLabel -> Automatic]
Out[6]=

Show details for the three largest grants.

In[7]:=
Click for copyable input
EntityValue[ EntityClass["NSFGrant", "AwardAmount" -> TakeLargest[3]], "Dataset"]
Out[7]=

Examine total grant awards for each NSF directorate.

show complete Wolfram Language input
In[8]:=
Click for copyable input
TextGrid[SortBy[{#1, Total[#2[[All, -1]]]} & @@@ Normal[GroupBy[ EntityValue["NSFGrant", {"Directorate", "AwardAmount"}], First]], Last] // DeleteMissing[#, 1, 2] & // Reverse, Alignment -> {{Left, Decimal}, Automatic}, Dividers -> All, Background -> {Automatic, {{LightBlue, None}}}]
Out[8]=

Compare the distribution of the first digits of the award dollar amounts with Benford's law.

show complete Wolfram Language input
In[9]:=
Click for copyable input
With[{$s = QuantityMagnitude[ EntityValue["NSFGrant", EntityProperty["NSFGrant", "AwardAmount"]]]}, ListPlot[{Rest[Sort[Tally[IntegerDigits[#][[1]] & /@ $s]]], Table[{d, Length[$s] Log10[1 + 1/d]}, {d, 9}]}, Filling -> Axis, PlotLegends -> {"NSF grants", "Benford"}]]
Out[9]=

Make a word cloud of the most-used words in mathematics, physics, and chemistry grants.

In[10]:=
Click for copyable input
keywords = EntityValue[EntityClass["NSFGrant", "Division" -> #], "KeywordTally"] & /@ {"Division Of Mathematical Sciences", "Division Of Physics", "Division Of Chemistry"};
In[11]:=
Click for copyable input
Row[WordCloud[ Merge[Association @@ (Rule @@@ #) & /@ DeleteMissing[#], Total]] & /@ keywords]
Out[11]=

Visualize NSF grants by amount and ZIP code.

show complete Wolfram Language input
In[12]:=
Click for copyable input
amountsandinsts = EntityValue[ "NSFGrant", {EntityProperty["NSFGrant", "AwardAmount"], EntityProperty["NSFGrant", "Institution"]}];
In[13]:=
Click for copyable input
amountsinzips = (#[[1, 1]] -> Total[#[[All, -1]]]) & /@ Normal[GroupBy[Transpose[{EntityValue[ amountsandinsts[[All, -1]], EntityProperty["NSFInstitution", "ZIPCode"] ], amountsandinsts[[All, 1]]}], First]][[All, -1]];
In[14]:=
Click for copyable input
GeoRegionValuePlot[SortBy[amountsinzips, Last], ColorFunction -> ColorData["GreenPinkTones"], GeoRange -> Entity["Country", "UnitedStates"], PlotLegends -> Histogram]
Out[14]=

Related Examples

de es fr ja ko pt-br ru zh