以下是資料的基礎統計

summary(polution)
##   Country.Code               Country.Name       year     
##  AGO    :  24   Albania            :  24   Min.   :1990  
##  ALB    :  24   Algeria            :  24   1st Qu.:1996  
##  ARE    :  24   Angola             :  24   Median :2002  
##  ARG    :  24   Antigua and Barbuda:  24   Mean   :2002  
##  ATG    :  24   Argentina          :  24   3rd Qu.:2007  
##  AUS    :  24   Australia          :  24   Max.   :2013  
##  (Other):3360   (Other)            :3360                 
##   co2_per_GDP       GDP_per_capita        GDP           
##  Min.   :0.004985   Min.   :   242   Min.   :8.821e+07  
##  1st Qu.:0.137573   1st Qu.:  2180   1st Qu.:7.449e+09  
##  Median :0.208438   Median :  6361   Median :3.266e+10  
##  Mean   :0.242897   Mean   : 12635   Mean   :3.522e+11  
##  3rd Qu.:0.293970   3rd Qu.: 17440   3rd Qu.:2.260e+11  
##  Max.   :1.420133   Max.   :140037   Max.   :1.680e+13  
## 

我們可以發現,2013年人均GDP前十名的地區,在近24年來,CO2/GDP要不下降,要不持平。而人均GDP後十名的地區,則是持平或上升。

polution$year<-as.integer(polution$year)
gdp_per_capita_top10<-head(polution[order(polution$year,polution$GDP_per_capita,decreasing = T),2],n = 10)

gdp_per_capita_low10<-head(polution[polution$year==2013,][order(polution[polution$year==2013,5]),2],n=10)

polution %>% 
  filter(Country.Name %in% gdp_per_capita_top10) %>% 
  ggplot(aes(x=year,y=co2_per_GDP))+
  geom_line(aes(color=Country.Name))+
  geom_point(aes(size=GDP_per_capita,color=Country.Name))+
  labs(title="2013年平均每人GDP前十名國家,CO2/GDP變化",x="Year",y="CO2 per GDP")

polution %>% 
  filter(Country.Name %in% gdp_per_capita_low10) %>% 
  ggplot(aes(x=year,y=co2_per_GDP))+
  geom_line(aes(color=Country.Name))+
  geom_point(aes(size=GDP_per_capita,color=Country.Name))+
  labs(title="2013年平均每人GDP後十名國家,CO2/GDP變化",x="Year",y="CO2 per GDP")

從1990-2013年對於世界GDP增加貢獻度最高的前十名,中國CO2/GDP大幅下降,其餘者則持平或略有下降。

grow_country<-polution %>% 
  filter(year %in% c(1990,2013)) %>% 
  select(Country.Code,Country.Name,year,GDP) %>% 
  group_by(Country.Code,Country.Name) %>% 
  summarise(grow_rate=max(GDP)-min(GDP))
gdp_grow_top10<-head(grow_country[order(grow_country$grow_rate,decreasing = T),2],n=10)

gdp_grow_top10<-gdp_grow_top10$Country.Name
polution %>% 
  filter(Country.Name %in% gdp_grow_top10) %>% 
  ggplot(aes(x=year,y=co2_per_GDP))+
  geom_line(aes(color=Country.Name))+
  geom_point(aes(size=GDP,color=Country.Name))+
  labs(title="1990-2013年GDP增加量前十名國家,CO2/GDP變化",x="Year",y="CO2 per GDP")

1990年代開始,亞洲四虎快速發展,從圖表中可以看出,在發展初期,CO2/GDP是上升的。

polution %>% 
  filter(Country.Name %in% c("Philippines","Malaysia","Indonesia","Thailand")) %>% 
  ggplot(aes(x=year,y=co2_per_GDP))+
  geom_line(aes(color=Country.Name))+
  geom_point(aes(size=GDP_per_capita,color=Country.Name))+
  labs(title="亞洲四虎,CO2/GDP變化",x="Year",y="CO2 per GDP")

從1990-2013年,趨勢線向右下方移動

polution$year<-as.character(polution$year)
polution %>% 
  filter(year %in% c(1990,2000,2013)) %>% 
  ggplot(aes(x=GDP_per_capita,y=co2_per_GDP,size=GDP,color=year))+
  geom_point()+
  coord_cartesian(xlim = c(0,100000),ylim = c(0,1))+
  geom_smooth(se = F)+
  labs(title="世界各國CO2/GDP比較(1990,2000,2013年)",x="人均GDP",y="CO2 per GDP")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'