U.S. Electricity Generation

U.S. Electricity Generation

Posted by Peter Liu

Updated: May 11, 2020


The United States is the second largest electricity producer in the world, and has made great strides in improving its electricity generation profile over the last 30 years with natural gas accounting for around 40% of the generation sources and renewables at around 10%, and coal at 23%.  This compares favorably to the profile 30 years ago in which the main generation source was coal at more than 50%, natural gas at 12%, and less than 2% from renewable sources.  Nuclear has remained relatively constant over the period at roughly 20%.  This project looks at how the trend is reflected among the individual states. 


The datasets were obtained from the U.S. Energy Information Administration website (www.eia.gov), which maintains various energy related news and information.  The datasets were clean with no missing values and consist of annual generation figures from various sources in megawatt hours (MWh) with the year and state in respective columns.  As the final generation figures for a given year are reported in the follow year, the 2019 figures were preliminary.  Nevertheless, no material changes were expected.  The 2019 figures were combined into the 1990-2018 set for the project.     


The app allows the user to select two years between 1990 and 2019 and two states for comparing electricity generation profiles.  The user has the flexibility to compare a state, or two different states, at two different times; or compare two different state for a given year.  The output graphs show the generation source composition at absolute and relative levels.      

The change in the generation profile is most prominent in some of the largest energy producing states, such as California, Texas, Florida, New York, marked by shift to natural gas to at least 40% complemented by rise in renewable energy, at the expense of coal. 

An interesting development can be seen for the state of Hawaii.  In particular, though the state continued to rely heavily on petroleum as the main source of electricity (90% in 1990 vs. 70% in 2019), its usage of coal increased to about 13% in 2019 (compared to less than 1% in 1990).  The likely reason may be due to the fact that Hawaii has no natural resources and relies on importing its energy sources from the upper 48 states.  And as other states use less coal, Hawaii became a price taker as the cost of coal declined.        

Another notable point can be seen in some smaller states, such as Maine and Vermont, which experienced declining generation capacity over the past 30 years driven by shifting demographics as the younger population moved out of the states for better employment prospects elsewhere.  The changing demographics picture is significant as it is a factor in the state public commissions’ decision in approving utility rates and return allowance for public utilities.  Nevertheless, the generation profile for the two states improved with greater emphasis on renewable sources.           


The declining usage of coal over the years as a generation source at the national level is driven by the changes undertaken at the state level.  The decrease in coal is replaced by increased utilization of natural gas and renewables as the issue of climate change comes to the discussion foreground.  What is interesting about the U.S. renewables space is that it is driven mostly by the state mandates and initiatives as the federal tax credits are expiring.  Given the current form of the project, I would like to revisit it and add in summary statistics that would provide the user with further insight into the data.  Overall, it was an invaluable experience in learning about working with the R Shiny app.


Peter Liu

Peter Liu has more than 14 years of experience in corporate credit risk management and held various financial analytics positions. He has an MBA and a BA in mathematics.

View all articles

Topics from this blog: Student Works R Shiny

Interested in becoming a Data Scientist?

Get Customized Course Recommendations In Under a Minute