2024-11-17

Chinese CO2 Emissions

A quick analysis of energy data, taken from “Our World in Data”

In this ioslide we will look at:

  • China’s CO2 Emissions over the years
  • China’s Energy Production
  • Changes in population
  • Relationship between CO2 Emissions, Energy Generation, and time
  • Make a quadratic model for CO2 Emissions based on energy generation, and compare to actual data

Where are we at?

Our current trend of CO2 emissions over the years by top energy producing countries Figure 1:

fig1 <- ggplot(data = energyData, aes(
               x = year,
               y = greenhouse_gas_emissions))+
  geom_smooth()

Figure 1

## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

The Relationship between Energy and CO2 Emissions

There seems to be a trend between energy production and CO2 emissions, but it’s not that simple.

fig2 <- ggplot(data = energyData, aes(
               x = electricity_generation,
               y = greenhouse_gas_emissions),
               )+
  geom_smooth()

Figure 2

## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

Combining the two figures

By combining the two figures, we can look at a three dimensional analysis of the “trajectory” of China’s CO2 emissions with relation to time and energy generation.

fig3 <- plot_ly(data = energyData, x = ~electricity_generation, y = ~year, z = ~greenhouse_gas_emissions, type = "scatter3d", mode = "lines") %>%
layout(scene = list(xaxis = list(title = "Terrawatt-Hours per Capita"),
yaxis = list(title = "Years"), zaxis = list(title = "CO2 Equivalient Emissions (Million-Tonnes)")))

Figure 3

Mathematical interpretation

The shape shows a quadratic nature for Emissions vs. Energy production, which we can determine the coefficiens and intercepts for using:

modelEmissionsVenergy<- lm(greenhouse_gas_emissions ~ electricity_generation + I(electricity_generation ^ 2), data = energyData)

modelEmissionsVenergy
## 
## Call:
## lm(formula = greenhouse_gas_emissions ~ electricity_generation + 
##     I(electricity_generation^2), data = energyData)
## 
## Coefficients:
##                 (Intercept)       electricity_generation  
##                  -4.753e+01                    8.834e-01  
## I(electricity_generation^2)  
##                  -3.293e-05

Showing the function for Emissions as a function of Energy Generations

The function of our curve is Greehouse Gas (written as GHG (X) ) :

\[GHG(x) = (-3.293 * 10^{-5})(Energy Generation)^2 + \] \[(8.834 * 10^{-1})(EnergyGeneartion) + (-4.753 * 10^1)\]

Comparing our function to the actual energy production:

We can see in figure 4 that we can reasonably model China’s carbon emissions. Further projects will show this relationship further by doing analysis on the different types of electricity generation that countries have and their impacts on carbon emissions.

greenPrediction <- function(x){
  n = 1
  myList <- c()
  while (n <=  length(x)) {
    tempNum = (((-3.293e-05) * (x[n] ^ 2)) + ((8.834e-01 ) * x[n]) + (-4.753e+01 ))
    myList <- append(myList, tempNum)
    n = n + 1
  }
  return (myList)
}

How Figure 4 is generated

elecGenList = energyData$electricity_generation
predictedValues <- greenPrediction(energyData$electricity_generation)
modeledData = data.frame(elecGenList, predictedValues)

fig4 <- plot_ly(data = energyData, 
                x = ~electricity_generation,
                y = ~greenhouse_gas_emissions, 
                name = "China's Data", 
                type = "scatter", mode = "lines")%>%
  add_trace(data = modeledData, 
            x = ~elecGenList, 
            y = ~predictedValues, 
            name = "Quadratic Model", 
            type = "scatter", mode = "lines")

Figure 4

China’s population

Because China has a growing population, it is also important to assess the actual efficiency of China’s energy production with respect to CO2 emissions by evaluating the per-capita energy production

Figure 5

## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

Re-Performing the quadratic analysis:

## 
## Call:
## lm(formula = greenhouse_gas_emissions ~ per_capita_electricity + 
##     I(per_capita_electricity^2), data = energyData)
## 
## Coefficients:
##                 (Intercept)       per_capita_electricity  
##                  -2.324e+02                    1.266e+00  
## I(per_capita_electricity^2)  
##                  -6.282e-05

Quadratic Analysis Values

\[GHG(x) = (-5.258 * 10^{-5})(Energy Generation per Capita)^2 + \] \[(1.170)(EnergyGeneartionperCapita) + (-2.349 * 10^1)\]

Figure 6