Mini-Project 2: Niamtougou

Donna Odhiambo & Matthew Gall

Niamtougou is located in the Kara region of Togo and is composed of six villages: Niamtougou, Koka, Baga, Ténéga, Yaka, and Agbandé. While Togo is classified as a tropical, sub-Saharan country its length stretches it through six geographic regions, making its climate vary from tropical to savanna. The Kara region is in northern Togo, and thus Niamtougou has a tropical climate with an average elevation of 1535 ft.

The purpose of this project is to analyze monthly surface temperature information from Niamtougou from years 1961-2015 and determine if the maximum and minimum temperature time-series data demonstrate significant increases over time. This question was explored in a preliminary fashion using yearly maximum and minimum temperature time-series by a previous group for Mini-Project 1. They found the data gave indeterminate results and lacked true discernible form. Those findings in mind, our group’s first task was to corroborate the original group’s yearly values with our own. Shown below are two matrices, the first containing comparisons of the minimum temperatures and the second containing comparisons of the maximum, under “1st data set” is the original group’s data and under “2nd data set” is ours. The numbers from each data set that correspond to each other match, which gives us more confidence that we are receiving accurate and reliable data for the annual average minimum temperatures and annual average maximum temperatures for our city.

Maximum Values (1961-2015)

rawdata=Import["C:\\Users\\odhia\\Downloads\\TOGO-TEMPERATUREMOYENNEMAXIMALE61-15.xls"][[8]];
max=Flatten[rawdata];
maxPlot=ListPlot[max,AxesLabel->{"months","avg T (°C)"},PlotLabel->"Monthly Maxima of Surface Temperatures"]

LM=LinearModelFit[max,{x,(x^2),Sin[((2π )/12)x],Cos[((2π )/12)x]},x,ConfidenceLevel->0.95];
LM["ParameterTable"]
LM["ParameterConfidenceIntervals"]

Our first model used x and (x^2) terms just try to see what kind of a fit it would give considering this was the model the previous group used for the maximum data and it was somewhat successful for them as well as sin(((2π)/12)x) and cos(((2π)/12)x) terms to account for the periodicity we expected to see due to seasonal change. Examining the model plotted over the data, the fit seemed somewhat successful, however the parameter table showed the t-statistic for the x value was not extreme, the p-value was a little too high for our liking, and the confidence interval included the probability of the parameter being zero. We then attempted two more fits, one excluding the (x^2) term and one excluding the x term. Shown below is LM1, the fit excluding the (x^2) term.

LM1=LinearModelFit[max,{x,Sin[((2π x)/12)],Cos[((2π x)/12)]},x,ConfidenceLevel->0.95]
LM1["ParameterTable"]
LM1["AdjustedRSquared"]
LM1["ParameterConfidenceIntervals"]
ListPlot[LM1["FitResiduals"],PlotLabel->"Residuals for Max",Filling->Axis,AxesLabel->{"Fitted Value","Residual"}]
Histogram[LM1["FitResiduals"],PlotLabel->"Histogram of Max Residuals", AxesLabel->{"Residual", "Frequency"}]

The parameter table for our new model with just x, sine, and cosine showed all of our parameters to be significant, since they had higher t-statistics, smaller p-values, and confidence intervals that excluded zero, so that was a good sign so we then plotted our residuals for the max and saw that they had no pattern and the residuals were not very extreme. Due to the sheer size of the dataset, a clearer picture of the residuals was generated using histogram format. The histogram showed the model was a good fit due to the normal distribution about 0 of the residuals. It also brought five data points (those left of -3) under suspicion, however five data points in a set of 660 was not enough to raise real alarm. The model with (x^2), sine, and cosine gave very similar results concerning (R^2) values and residuals, so we decided to keep it simple and use the model with just the x. 

The data is so scattered that we knew when we were looking for a model it was not going to be a perfect model. When interpreting our parameters we see that we predict that in January of 1961 we should have 32.1169 ppm of (Subscript[CO, 2]) Niamtougou and then our coefficients are giving us as amplitude and also give us a wave curve. Overall, there is a significant increase in the temperature over time due to the fact that we have good fit for our model and the x coefficient is positive and significant. The x coefficient is 0.000861335. This number is the slope and shows us how much we predict the temperature to be changing month to month. Below is the model placed over the maximum data, while examining the goodness of fit seems difficult from afar, zooming in on a small range of data points reveals the periodic nature of the dataset as well as how good our fit was.

Show[maxPlot,Plot[LM1[x],{x,1,Length[max]}]]

Manipulate[
Module[
{},
p1=Plot[LM1[x],{x,n,n+24}];
p2=ListPlot[Transpose[{Table[i,{i,1,Length[max]}],max}]
,PlotRange->{{n,n+24},{Min[max],Max[max]}}];
Show[p1,p2]
], {n, 1, 600,1}
]

Minimum Values

rawdata1=Import["C:\\Users\\odhia\\Downloads\\TOGO-TEMPERATUREMOYENNEMINIMALE61-15.xls"][[8]];
min=Flatten[rawdata1];
minPlot=ListPlot[min,AxesLabel->{"months","avg T (°C)"},PlotLabel->"Monthly Minima of Surface Temperatures"]

LM2=LinearModelFit[min,{x,Sin[((2π x)/12)],Cos[((2π x)/12)]},x,ConfidenceLevel->0.95]
LM2["ParameterTable"]
LM2["ParameterConfidenceIntervals"]

For the minimum values, we tried starting out with a linear model to see what we would get. However, the t-statistic for the x value was not extreme, the p-value was too high for our liking, and the confidence interval included the probability of the parameter being 0. This meant the x term was most likely not significant and therefore we decided to make our model without x in it.

LM3=LinearModelFit[min,{Sin[((2π x)/12)],Cos[((2π x)/12)]},x,ConfidenceLevel->0.95]
LM3["ParameterTable"]
LM3["AdjustedRSquared"]
LM3["ParameterConfidenceIntervals"]
ListPlot[LM3["FitResiduals"],PlotLabel->"Residuals for Min",Filling->Axis,
AxesLabel->{"Fitted Value","Residual"}]
Histogram[LM3["FitResiduals"],PlotLabel->"Histogram of Max Residuals", AxesLabel->{"Residual", "Frequency"}]

This then lead us to the conclusion that for Niamtougou there was not a significant increase in temperature over the data set for minimum temperatures, just fluctuation. The fluctuation between seasons was expected and accounted for using sines and cosines in our model. After graphing this model and looking at the parameters, residuals, and the histogram plot of the residuals, we were happy to see the parameters were significant and that the residuals seemed independent and randomly distributed. The histogram plot also had normal distribution centered about zero which made us confident in the model we choose. It also brought one data points (the one to the far left) under suspicion, however one “off” data point in a set of 660 was not enough to raise real alarm. Below is the model placed over the minimum data, while examining the goodness of fit seems difficult from afar, zooming in on a small range of data points reveals the periodic nature of the dataset as well as how good our fit was.

Show[minPlot, Plot[LM3[x],{x,0,Length[min]}]]

Manipulate[
Module[
{},
p11=Plot[LM3[x],{x,n,n+24}];
p22=ListPlot[Transpose[{Table[i,{i,1,Length[min]}],min}]
,PlotRange->{{n,n+24},{Min[min],Max[min]}}];
Show[p11,p22]
], {n, 1, 600,1}
]

We were very pleased with the data we were able to get. However we had to do quite a bit of digging to get the data in a workable form since it was so scattered. Of the Togolese, we would like ask why the data was so scattered. We would also like to hear them explain their data collection methods, is it possible that the data is being collected at different points in the Kara region or just in Niamtougou? There is a weather station (DXNG) located in the Niamtougou International Airport, is this where data might be collected and if so, using what instrumentation? When they report the monthly average, are they reporting an average calculated using the average minimum and maximum of each day, or are they using a different time span, or perhaps a different method entirely?