## Playing with R trying to fit the modern temperature record to forcings

Ok, this time I'm going to start with the graph, and explain what's going on after. Seems to work for other folks... :

This is a plot of the GISS global mean temperature anomaly from 1880 to 2003 (red curve), along with a "two time-constant" fit to those temperatures (black curve) using the sum of GISS radiative forcings for the same time period. The fit was done and curve generated using code written by Nick Stokes for the "R" statistical computing language, and provided in comment #18513 of this post at Lucia's blog. I adjusted the parameters slightly so that the long time-constant (w1 definition) was 20.0 years instead of 30, and the short time-constant (w2 definition) was 0.12 years instead of 0.1. This gives a total sensitivity of Earth's temperature to radiative forcings of about 0.6 degrees C per (W/m^2) change in forcing, which is equivalent to about 2.4 degrees C for a doubling of CO2.

This is a duplication of a very simple analysis (less than 40 lines of code in R!) done by Tamino last week in an attempt to show that you get reasonable results for climate sensitivity without the need for fancy climate models (i.e. without sophisticated physics-based models, as opposed to this sort of phenomenological or statistical model that just matches temperature to forcings.) He also showed pretty clearly that you can't get a good fit to the temperature data without including the effects of greenhouse gases like carbon dioxide. The observed warming of the twentieth century was real and is essentially related to human alterations of Earth's atmosphere.

Now, Tamino made a very minor mistake in doing this - he assumed the "short" time constant (0.12 years in the above fit) was 1 year and asserted that the underlying physical system corresponding to this short response was just the atmosphere. That doesn't affect the total sensitivity much; that's actually much more dependent on the size of the long time-constant (20 years in the above fit, 30 in Tamino's). But if it's really just the atmosphere, Lucia Liljegren did show you ought to use a shorter value - 0.09 or less. On the other hand, based on an R-squared criterion, the best fit for short time constant actually comes at around 2 years, rather than 1 (when the long time-constant is held fixed at 30 years). Anyway, playing with the 'R' language I put together some more pictures to look into this a bit better.

First let's look at the dependency on the long time constant, with the short time-constant held fixed at 0.05 years. Most of the fits look somewhat like the above picture, with the main differences being the extent to which they match the observed temperature changes associated with volcano events (such as Pinatubo in 1992).

So rather than looking at the fits themselves, here is an image of a measure of goodness of fit, the R-squared values for the fits as a function of that long time-constant:

The best fit is for close to 20 years, but 15 or 30 are almost as good. The fit gets worse as you go to longer or shorter “long” time-constants.

Each fit presents temperature as a linear combination of the two versions of the forcing, one exponentially averaged over a long time period, the other over a short one. Those two linear coefficient values and their sum (the total sensitivity) are plotted here:

Here green = short-time response, red = long-time response, black = total response or sensitivity. For the best fit time-constant of 20 years, the values are 0.5548995 for the long-time coefficient and 0.04699564 for the short one, with a total of 0.60189514 in C per W/m^2, or about 2.4 C per doubling of CO2.

Note that the total sensitivity is quite dependent on the choice of long time-constant, rising from about 0.5 at 12 years to 1.2 at 100 years.

Now let's look at changing the short time-constant, with long time-constant held fixed at 30 years - first the R-squared values again:

Here the best fit is very close to 2 years, though it's almost entirely independent of the time constant in this case.

The corresponding coefficient values are:

and the total response value is almost totally flat, independent of the short time constant, with a sensitivity of about 0.7 (2.7 C per doubling of CO2). In fact the sensitivity is highest for the shortest values, so Tamino would have actually found a slightly higher sensitivity if he’d gone with something less than 1 year.

As the short time constant is increased, the corresponding weight in the fit increases, and the weight for the long time decreases, while the total decreases only slightly. If you continue increasing the short time constant the two weights cross at about 12 years, and the long-time-constant weight becomes unphysically negative at 17 years. The fitting process diverges when both time constants are around 30 years, and then the two weights essentially switch places. In any case, anything short of 17 years seems to be reasonable as far as the fit is concerned, and perhaps 2 years would have been a better choice than 1 year given the improved R-squared for that choice.

This is my first experiment with "R" so I might have gotten something wrong here of course... The exact R scripts used to generate the above curves can be downloaded from the same URL’s as the above images, if the ‘.png’ extension is replaced by ‘.R’.

UPDATE: the original version of this post was indeed wrong - I'd given the fits the wrong time constants when I thought I was doing the short ones. The corrected short-time-constant dependency is shown above, with some notes on what goes wrong if you make that time constant much too large (which is what the original graphs inadvertently showed). (Update of the update - there was also some language regarding what Tamino did that needed fixing given my original error here).

UPDATE 2: Steven Mosher suggested showing the family of fitting curves, so here goes. For the second group (changing the short time constants while the long one is fixed at 30 years) with the observed temperatures in black and the fitted curves in red (0.1 year), brown (0.5 year), green (1.0 year), blue (2.0 year) and violet (2.5 year):

Fitted curves for a variety of long time constants (short time constant fixed at 1 year), again with observed temperatures in black and fitted curves in red (5 year), brown (10 year), green (20 year), blue (30 year) and violet (60 year):