The debate whether global warming is real and whether it is a man-made problem or not is more political than scientific. Collecting and analyzing data that accurately reflect a global picture of what is happening on our planet is a challenge. However, it is rather easy to get reliable local weather data and with some careful statistical modeling it is possible to identify if global warming is real at the local level.
The National Oceanic and Atmospheric Administration (NOAA) collects and archives weather data from thousands of collection sites around the globe. The data format and instructions on how to download the data can be found on this NOAA website:
ftp://ftp.ncdc.noaa.gov/pub/data/gsod/readme.txt
The list of the roughly 9000 weather stations is posted here:
ftp://ftp.ncdc.noaa.gov/pub/data/gsod/ish-history.txt
Perusing this list, I discovered that McGuire Air Force Base, located not far from Princeton NJ, is one of the archived weather stations. Since, the data is archived in one year batches, I wrote a unix shell script to grab the 55 annual data files for McGuire and then assemble the relevant pieces of data into a single file. Here is the shell script...
http://www.princeton.edu/ rvdb/ampl/nlmodels/LocalWarming/McGuireAFB/data/getData.sh
The resulting pair of data files that will be used as input to my local climate model are posted at...
http://www.princeton.edu/ rvdb/ampl/nlmodels/LocalWarming/McGuireAFB/data/McGuireAFB.dat
and
http://www.princeton.edu/ rvdb/ampl/nlmodels/LocalWarming/McGuireAFB/data/Dates.dat
Let t(d) denote the average temperature in degrees Fahrenheit on day d ∈ D where D is the set of days from January 1, 1955, to August 13, 2010. We wish to model the average temperature as a constant a0 plus a linear trend a1d plus a sinusoidal function with a one-year period representing seasonal changes,

plus a sinusoidal function with a period approximately equal to 10.7 years to represent the solar cycle,

The parameters a0, a1, …, a6 are unknown regression coefficients. We wish to find the values of these parameters that minimize the sum of the absolute deviations:

If the unknown parameter a6 is fixed at 1, forcing the solar-cycle to have a period of exactly 10.7 years, then the problem can be reduced to a linear optimization problem that is guaranteed to have a global minimum and no other local minima. If, on the other hand, we allow a6 to vary, then the problem is nonlinear and even nonconvex and therefore much harder in principle. Nonetheless, if we stipulate that a6 be near one, then the problem might, and in fact does, prove to be tractable.
Note: This least-absolute-deviations (LAD) model automatically ignores “outliers”. Minimizing sums of squares is analogous to computing the mean whereas minimizing sums of absolute deviations is analogous to computing medians, which is a statistic that is insensitive to outliers in the data.
The problem was formulated in the ampl programming language and solved using my optimization software loqo. Here’s the ampl model
http://www.princeton.edu/ rvdb/ampl/nlmodels/LocalWarming/McGuireAFB/WXregress2.mod
The nice thing about ampl and loqo is that anyone can use these programs via the NEOS server at Argonne National Labs...
The linear version of the problem solves in a small number of iterations and only takes a minute or so on my MacBook Pro laptop computer. The nonlinear version takes more iterations and more time but eventually converges to a solution that is almost identical to the solution of the linear version. The optimal values of the parameters are

From a0, we see that the nominal temperature at McGuire AFB is 52.56 degrees Fahrenheit (on January 1, 1955).
We also see, from a1, that there is a positive trend of 0.000099 degrees Fahrenheit per day. That translates to 3.63 degrees Fahrenheit per century—in amazing agreement with results from global climate change models.
From a2 and a3, we can compute the amplitude of annual seasonal changes in temperatures...

In other words, on the hottest summer day we should expect the temperature to be 22.02 degrees warmer than the nominal value of 52.56 degrees; that is, 77.58 degrees. Of course, this is a daily average—daytime highs will be higher and nighttime lows should be about the same amount lower. Similarly, from a4 and a5, we can compute the amplitude of the temperature changes brought about by the solar-cycle...

The effect of the solar cycle is real but relatively small.
The fact that a6 came out slightly less than one indicates that the solar cycle is slightly longer than the nominal 10.7 years. It’s closer to 10.7∕a6 = 10.78 years.
Here is a plot showing the actual data in blue and the regression model’s predictions in red...

Blue: Average daily temperatures at McGuire AFB from 1955 to 2010.
Red: Output from least absolute deviation regression model.
The above plot shows that seasonal fluctuations completely dominate other effects. In order to see the linear trend, here is a plot where the seasonal variations and (much smaller) solar-cycle fluctuations have been removed...

As before but with sinusoidal seasonal variation removed and sinusoidal solar-cycle
variation removed as well.
Even this plot is noisy simply because there are many days in a year and some days are unseasonably warm while others are unseasonably cool. In order to smooth out these high frequency fluctuations, the plot below uses 101 day rolling averages of the data in the above plot.

In this plot, the long term trend in temperature is clearly seen. In NJ we have local warming. Close inspection of the output shows that the January 22 is the coldest day in the winter, July 24 is nominally the hottest day of summer, and February 12, 2007, was the day of the last minimum in the 10.78 year solar cycle.
Using only 6 years of data from Rocky Hill, NJ, we get similar results: 2 degrees Fahrenheit per century.
