<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Climate Change on R Views</title>
    <link>https://rviews.rstudio.com/tags/climate-change/</link>
    <description>Recent content in Climate Change on R Views</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 09 Oct 2017 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://rviews.rstudio.com/tags/climate-change/" rel="self" type="application/rss+xml" />
    
    
    
    
    <item>
      <title>Climate Change and Population Modeling in R</title>
      <link>https://rviews.rstudio.com/2017/10/09/population-modeling-in-r/</link>
      <pubDate>Mon, 09 Oct 2017 00:00:00 +0000</pubDate>
      
      <guid>https://rviews.rstudio.com/2017/10/09/population-modeling-in-r/</guid>
      <description>
        


&lt;p&gt;A recent paper in &lt;a href=&#34;https://www.nature.com/nclimate/&#34;&gt;nature climate change&lt;/a&gt;: &lt;a href=&#34;http://go.nature.com/2xiyNC0&#34;&gt;Less than 2°C warming by 2100 unlikely&lt;/a&gt; (Raftery et al. 2017), concludes that the goal of the &lt;a href=&#34;https://ec.europa.eu/clima/policies/international/negotiations/paris_en&#34;&gt;Paris Agreement&lt;/a&gt; is unlikely to be met.&lt;/p&gt;
&lt;p&gt;Although the conclusion is disheartening, the paper advances the science of climate modeling by developing a joint Bayesian hierarchical model for Gross Domestic Product per capita and carbon intensity. This ensemble of models, in turn, depends on the availability of probabilistic population projections developed by the &lt;a href=&#34;https://bayespop.csss.washington.edu/software/&#34;&gt;BayesPop&lt;/a&gt; Project at the University of Washington and available on CRAN.&lt;/p&gt;
&lt;p&gt;The linkage between CO&lt;sub&gt;2&lt;/sub&gt; emissions and population modeling comes through the use of a version of the &lt;a href=&#34;https://en.wikipedia.org/wiki/Kaya_identity&#34;&gt;Kaya identity&lt;/a&gt;, which “expresses future emissions levels in a country as a product of three components: population, GDP per capita, and carbon intensity (CO&lt;sub&gt;2&lt;/sub&gt; emissions per unit of GDP).”&lt;/p&gt;
&lt;p&gt;The 3700 lines of R code that implement the models underlying the paper are available &lt;a href=&#34;https://github.com/PPgp/Co2projections&#34;&gt;here&lt;/a&gt; on GitHub. Unless you work in this aspect of climate modeling, mastering this code seems likely to be a formidable task. A good first step, however, might be to work through the population models developed by BayesPop. These models comprise a series of R packages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://CRAN.R-project.org/package=bayesTFR&#34;&gt;&lt;code&gt;bayesTFR&lt;/code&gt;&lt;/a&gt; implements a Bayesian hierarchical model to make projections of total fertility for all of the countries in the world.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://cran.r-project.org/package=bayesLife&#34;&gt;&lt;code&gt;bayesLife&lt;/code&gt;&lt;/a&gt; implements a Bayesian Hierarchical model to make life expectancy projections for all the countries in the world is described &lt;a href=&#34;https://link.springer.com/article/10.1007%2Fs13524-012-0193-x&#34;&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://cran.r-project.org/package=bayesPop&#34;&gt;&lt;code&gt;bayesPop&lt;/code&gt;&lt;/a&gt; uses &lt;code&gt;bayesTFR&lt;/code&gt; and &lt;code&gt;bayesLife&lt;/code&gt; to generate population projections for all of the world’s countries.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://cran.r-project.org/package=bayesDem&#34;&gt;&lt;code&gt;bayesDem&lt;/code&gt;&lt;/a&gt; provides graphical user interface for &lt;code&gt;bayesTFR&lt;/code&gt;, &lt;code&gt;bayesLife&lt;/code&gt; and &lt;code&gt;bayesPop&lt;/code&gt;.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://CRAN.R-project.org/package=wppExplorer&#34;&gt;&lt;code&gt;wppExployer&lt;/code&gt;&lt;/a&gt; implements a &lt;code&gt;shiny&lt;/code&gt; app for exploring the data in on the &lt;a href=&#34;https://esa.un.org/unpd/wpp/&#34;&gt;World Population Prospects&lt;/a&gt; This data is available in R packages &lt;a href=&#34;https://cran.r-project.org/package=wpp2017&#34;&gt;wpp2017&lt;/a&gt;, &lt;a href=&#34;https://cran.r-project.org/package=wpp2015&#34;&gt;wpp2015&lt;/a&gt;, &lt;a href=&#34;https://cran.r-project.org/package=wpp2012&#34;&gt;wpp2012&lt;/a&gt;, and &lt;a href=&#34;https://cran.r-project.org/package=wpp2010&#34;&gt;wpp2010&lt;/a&gt;,&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;wppExployer&lt;/code&gt; &lt;code&gt;shiny&lt;/code&gt; app is also available &lt;a href=&#34;https://rstudio.stat.washington.edu/shiny/wppExplorer/inst/explore/&#34;&gt;online&lt;/a&gt;. &lt;br/&gt; &lt;iframe src = &#34;https://rstudio.stat.Washington.edu/shiny/wppExplorer/inst/explore/&#34; height = &#34;450&#34; width = &#34;100%&#34;&gt;&lt;/iframe&gt; &lt;br/&gt;&lt;/p&gt;
&lt;p&gt;To give you a feel for how these models work, we use the &lt;code&gt;bayesTFR&lt;/code&gt; package to estimate and plot fertility rates for the United States. (Note that, for brevity, the informative console output of the simulations in the code below have been suppressed.)&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;library(bayesTFR)
# This command produces output data, such as in the directory ex-data
sim.dir &amp;lt;- tempfile()
# Phase II MCMCs
m &amp;lt;- run.tfr.mcmc(nr.chains=1, iter=60, output.dir=sim.dir, seed=1, verbose=TRUE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Loading required package: wpp2017&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Warning: package &amp;#39;wpp2017&amp;#39; was built under R version 3.4.2&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# Phase III MCMCs (not included in the package)
m3 &amp;lt;- run.tfr3.mcmc(sim.dir=sim.dir, nr.chains=2, iter=100, thin=1, seed=1, verbose=TRUE)
# Prediction
pred &amp;lt;- tfr.predict(m, burnin=30, burnin3=50, verbose=TRUE)
summary(pred, country=&amp;#39;United States of America&amp;#39;)
unlink(sim.dir, recursive=TRUE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;tfr.trajectories.plot(pred,country=&amp;quot;United States of America&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;/post/2017-10-04-population-modeling-in-r_files/figure-html/unnamed-chunk-3-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;&lt;/p&gt;
&lt;p&gt;The transparent, reproducible work being done by Raftery and his collaborators, and the other members of the BayesPop Project, is a great gift to the R community. Anyone with an appetite for R code and the patience to learn something of Bayesian hierarchical models can gain some insight into one of the most important scientific problems of our day.&lt;/p&gt;

        &lt;script&gt;window.location.href=&#39;https://rviews.rstudio.com/2017/10/09/population-modeling-in-r/&#39;;&lt;/script&gt;
      </description>
    </item>
    
  </channel>
</rss>
