<<

Jun Zhang and Jin-Qiang Zhong, New York University Monte Carlo Methods in Climate Science JOHN C. BAEZ AND DAVID TWEED lots of computing power. Their goal was to understand the spectrum of possible futures compatible with what hey look placid lapping against the we know today. beach on a calm day, but the oceans are Let us look at some of the ideas underlying their actually quite dynamic. The ocean cur- work. rents act as conveyor belts, transporting heat both vertically between the water’s box ModelS Tsurface and the depths and laterally from one area of the globe to another. This effect is so significant The Earth’s climate is too complex to simulate from that the temperature and precipitation patterns the bottom up using basic physical principles, at least can change dramatically when currents do. for now. The most detailed models we have use sim- For example: Shortly after the last ice age, north- plifying assumptions—and even so, they take days to ern Europe experienced a shocking change in climate run on very powerful computers. So, to make reason- from 10,800 to 9,500 BC. At the start of this period, able predictions on a laptop in a tractable time frame, temperatures plummeted in a matter of decades. It geophysical modelers need to use some clever tricks. became 7° Celsius colder, and glaciers started forming First, it is possible to split geophysical phenomena in England! The cold spell lasted for more than a thou- into categories, or boxes, containing only strongly re- sand years, but it ended as suddenly as it had begun. lated things. For example: atmospheric gases, particu- Why? The most popular theory is that a huge lake late levels, and clouds all aff ect each other strongly; in North America formed by melting glaciers burst likewise, the heat content, currents, and salinity of the its bank—and in a massive torrent lasting for years, oceans all interact strongly. However, the interactions the water from this lake rushed out to the northern between the atmosphere and the oceans are weaker, Atlantic Ocean. By fl oating atop the denser salt water, and we can approximately describe them using just a this fresh water blocked a major current: the Atlantic few parameters, such as the amount of atmospheric

Meridional Overturning Circulation. This current CO2 entering or leaving the oceans. Clearly these brings warm water north and helps keep northern interactions must be consistent—for example, the

Europe warm. When it shut down, northern Europe amount of CO2 leaving the atmosphere box must equal was plunged into a deep freeze. the amount entering the ocean box—but breaking a Right now, global warming is causing ice sheets in complicated system into parts lets diff erent special- Greenland to melt and release fresh water into the ists focus on diff erent aspects; then we can combine North Atlantic. Could this shut down the Atlantic these parts and get an approximate model of the entire Meridional Overturning Circulation and make the cli- planet. The box model used by Keller and Urban is mate of northern Europe much colder? In 2010, Keller shown in fi gure 1. and Urban [4] tackled this question using a simple Second, it turns out that simple but eff ective box climate model, historical , probability theory, and models can be distilled from the complicated phys-

www.maa.org/mathhorizons : : Math Horizons : : November 2013 5 Meridional CO emissions radiative How can we 2 forcing Overturning Circulation compute this conditional probability? Carbon cycle Climate North This is a somewhat tricky problem. ocean atmos. land air temp. One thing we can more easily do is ocean CO2 ocean deep tropics ocean repeatedly run our model with ran- sea surf. temp. leaves wood domly chosen settings and see what South measurements it predicts. By doing detritus soil ocean this, we can compute the probabil- ity that given setting values the model predicts measurements This again is a conditional Figure 1. The box model used by Keller and Urban. probability, but now it is called ics in terms of forcings and feedbacks. A forcing is a This is not what we want: It’s backwards! But here measured input to the system, such as solar radiation Bayes’ rule comes to the rescue, relating what we want or CO2 released by burning fossil fuels. As an analogy, to what we can more easily compute: consider a child on a swing: The adult’s push every so often is a forcing. A feedback describes how the current state of our system influences its future state. In the swing analogy, one feedback is how the velocity will Here is the probability that the parameters influence the child’s future height. Specifying feedbacks take a specific value s, and similarly for typically uses knowledge of the detailed low-level phys- Bayes’ rule is quite easy to prove, and it is a general ics to derive simple, tractable functional relationships rule that applies to any random variables, not just between groups of large-scale observables, a bit like the parameters and the measurements in our problem how we derive the physics of a gas by thinking about [7]. It underpins most methods of figuring out hidden collisions of lots of particles. quantities from observed ones. For this reason, it is However, it is often not feasible to get actual settings widely used in modern and data [5]. for the parameters in our model starting from first How does Bayes’ rule help us here? We need to start principles. In other words, often we can get the general with a guess about the probability this is form of the equations in our model, but they contain a called our prior. We might assume the settings S are lot of constants that we can estimate only by looking equally likely to take any value in some range, or we at historical data. might use the opinions of experts to make a more informed guess. Probability Modeling Second, as mentioned, we can compute Suppose we have a box model that depends on some Finally, the number is parameters S. For example, in Keller and Urban’s independent of our choice of settings, so we can treat it model, S is a list of 18 numbers. To keep things simple, as a constant. Thus, we can use Bayes’ rule to compute suppose S is an element of some finite set. Suppose as a function of the settings s—at we also have huge hard disk full of historical mea- least up to a constant factor. Then, since probabilities surements, and we want to use this to find the best must sum to 1, we can figure out this constant. estimate of S. Because our data is full of “noise” from We call the posterior, because it other unmodeled phenomena, we usually cannot un- is the probability that the settings take some value ambiguously deduce the correct value of S. Instead we after taking into account our measurements. Knowing have to look at things in terms of probabilities. More this lets us do many things. It lets us find the most precisely, we need to study the probability that S takes likely values of the parameters for our model, given our some value s given that the measurements take some hard disk full of observed data. It also lets us find the value. Let’s call the sequence of measurements M, and probability that the settings lie within some set. This again let’s keep things simple by saying that M takes is important: If we’re facing the possibility of a climate values in some finite set of possible measurements. disaster, we don’t want to know just the most likely The probability that given that M takes outcome. We would like to know that with 95 percent some value m is called the conditional probability probability, the outcome will lie in some range.

6 November 2013 : : Math Horizons : : www.maa.org/mathhorizons an exaMPle 0.12 0.1 Let us look at an example much simpler than that 0.08 considered by Keller and Urban. Suppose our measure- p 0.06 ments are real numbers ..., related by 0.04 0.02 1.7 1.6 0 0 1.5 100 1.4 Here s, a real constant, is our setting, while is 200 s 300 1.3 step 400 some noise: an independent Gaussian random variable 500 1.2 for each time t, with mean zero and some fixed stan- Figure 3. Estimates of the conditional probability dard deviation. Then the measurements will have where at each step we run the model at all roughly sinusoidal behavior but with irregularity added possible settings, and we keep a running total of the fraction of by the noise at each time step, as shown in figure 2. times each measurement m occurs when the setting is s. Note how there is no clear signal from either the curves or the differences that the green curve is at the correct shown in the for small num- setting value while the blue one has the wrong one: bers of samples. This has quite a few kinks, which The noise makes it nontrivial to estimate s. This is a disappear only later. The problem is that there are baby version of the problem Keller and Urban faced. lots of possible choices of s to try. And this is for a very simple model! Markov Chain Monte Carlo When dealing with the 18 settings involved in the Keller and Urban model, trying every combination Having glibly said that we can compute the condi- would take far too long. A way to avoid this is Markov tional probability how do we actu- Chain Monte Carlo . Monte Carlo is famous ally do this? The simplest way would be to run our for its casinos, so a Monte Carlo is one that model many, many times with the settings at uses random steps to converge upon the answer. A and determine the fraction of times it predicts mea- Markov chain is a random walk: for example, where surements consistent with m. This gives us an estimate you repeatedly flip a coin and take one step right when of Then we can use Bayes’ rule to you get heads, and one step left when you get tails. work out at least up to a constant In Markov Chain Monte Carlo, then, we perform a factor. random walk through the collection of all possible set- Doing this by hand would be incredibly time con- tings, collecting samples. From these samples we can suming and error prone, so computers are used for this estimate the density in the same way as before, only task. In our example, we do this in figure 3. As we with greater computational effciency. keep running our model over and over, the curve show- The key to making this work is that at each step ing settles down to the right answer. on the walk, a proposed modification to the cur- However, this is computationally ineffcient, as rent settings s is generated randomly—but it may be rejected if it does not seem to improve the estimates. 1.5 By cleverly choosing the rule for doing this, in a way motivated by Bayes’ rule, the random walk can be 1 designed so that in the long run it visits each setting

0.5 s with a frequency equal to With some additional tricks—such as discarding the very m 0 beginning of the walk—this gives a set of samples that can be used to estimate For details, -0.5 try the textbooks by Bolstad [3] or Press et al. [6].

-1 Figure 4 shows the results of using the Markov Chain Monte Carlo procedure to figure out -1.5 in our example. Compared with the

0 5 10 15 20 25 method in figure 3, we run the Markov Chain Monte t Carlo method for more steps, but each step involves Figure 2. The example system: Red is predicted measurements running the model at just one setting, instead of all pos- for a given value of the settings, green is another simulation for sible settings, so it is much more effcient. the same s value, and blue is a simulation for a slightly different s. The key advantage of Markov Chain Monte Carlo is

www.maa.org/mathhorizons : : Math Horizons : : November 2013 7 0.5 exPloring the toPiC 0.45 0.4 The Azimuth Project is a group of scientists, engi- 0.35 0.3 neers, and computer programmers interested in ques- p 0.25 0.2 tions like this [2]. If you have questions, or want to help 0.15 0.1 1.7 out, just email us. Versions of the computer programs 0.05 1.6 we used in this paper available at [1]. 0 0 1.5 10000 1.4 s Here are some practical issues to investigate: 20000 1.3 step 30000 1.2 • The collapse of the Atlantic Meridional Overturning Circulation would cause a tem- Figure 4. The estimates of using Markov perature drop in northern Europe. the Chain Monte Carlo, showing the current distribution estimate effects on humans and ecosystems of drops of 1°, at increasing intervals. The red line shows the current position ° ° of the random walk. Again the kinks are almost gone in the 3 , and 7 Celsius. final distribution. • Learn in detail how Markov Chain Monte Carlo works [3 , 5 , 6]. Also learn about some other that it avoids performing many simulations with set- methods of parameter estimation, and try those tings where the probability is low, as we can see from in the example here. the way the red path of the random walk stays under • We’ve seen a one-dimensional system with one set- the big peak in the probability density almost all the ting. Simulate some multidimensional and multi- time. More impressively, it achieves this without us setting systems. What new issues arise? n needing to know ahead of time where this peak will be! This advantage becomes even more important as we John C. Baez is professor of mathematics at University move to dealing with more complicated models, where of California, Riverside, and a researcher for the Centre often the regions of high probability density are irregu- for Quantum Technologies in Singapore. He is cofounder larly shaped multidimensional blobs, as it proves very of the Azimuth Project. effective at finding them effciently. Email: [email protected] Why is it worth doing so much work to estimate the probability distribution for settings for a climate model? David Tweed is a member of the Azimuth Project who One reason is that we can then estimate probabilities of did a Ph.D. on image recognition at the Department of events, such as the collapse of the Atlantic Meridional Computer Science of the University of Bristol. His work Ocean Current. And what’s the answer? According to makes extensive use of probability theory and statistics. Keller and Urban’s calculation, this current will likely Email: [email protected] weaken by about a fifth in the 21st century, but a com- Acknowledgments. We thank Jan Galkowski, plete collapse is unlikely before 2300. This claim needs Graham Jones, Nathan Urban, and other members of to be checked in many ways—for example, using more the Azimuth Project for many helpful discussions. detailed models. But the importance of the issue is clear, and we hope we have made the importance of good math- ematical ideas for climate science clear as well. http://dx.doi.org/10.4169/mathhorizons.21.2.5

Further reading 5. J. K. Kruschke, Doing Bayesian Data Analysis: A Tutorial with and BUGS, Academic Press, New 1. Software available at http://math.ucr.edu/home/ York, 2010. baez/climate_math/. 2. Azimuth Project, http://azimuthproject.org. 6. W. H. Press, S. A. Teukolsky, W. T. 3. W. M. Bolstad, Understanding Computational Vetterling, and B. P. Flannery, Numerical Bayesian Statistics, John Wiley, New York, 2010. Recipes: The Art of Scientific Computing, Section 4. K. Keller and N. Urban, “Probabilistic hindcasts 15.8: Markov Chain Monte Carlo, Cambridge and projections of the coupled climate, carbon cycle University Press, Cambridge, 2007. Also avail- and Atlantic meridional overturning circulation system: able at http://scribd.com/doc/40633192/ a Bayesian fusion of century-scale measurements with Cambridge-press-numerical-recipes-3rd-edition-sep. a simple model,” Tellus A 62 (2010), 737–750. Also 7. Eliezer S. Yudkowsky, “An Intuitive Explanation available at http://public.lanl.gov/nurban/pubs/ of Bayes Theorem,” available at http://yudkowsky.net/ moc-projections.pdf. rational/bayes.

8 November 2013 : : Math Horizons : : www.maa.org/mathhorizons