# Testing the influence of monthly fluctuations

Let's say we have a dataset that looks like this:

month   year   airquality
jan     2000   36
...     ...    ...
dec     2001   33
jan     2002   44
...     ...    ...
dec     2002   21
jan     2003   44
...     ...    ...
etc.


The airquality in this case is considered to be the number of parts per million of something.

My question is, how would you test if the factor month has an influence on the airquality and how much of an influence? I am having troubles to think of the right method for testing this because besides a monthly difference there may als be an influence of the year factor (ie. airquality may get worse through the years as traffic intensity increases).

Hope you can point me in the right direction (the test/model to use, for example)

## 1 Answer

There are different approaches that you can use. I will list some here. For example, you can decide to go with a SARIMA model. This is an extension of the usual ARIMA models that take into account the seasonality effect. Here seasonality effect means the effect of month. Another method is to consider a naive model called "Time series regression". In this case, to test the effect of month, you can define some dummy variables (specifically since you have 12 months or 12 levels, you should define 11 dummy variables) and include the time (year) effect as well. The model in R may look like the following:

M.1=lm(airquality~as.dummy(month)+year)


But most probably, if you fit the model M.1 in above, you will end up with serially auto-correlated residuals, which is not good! So you need to correct it and take into account that correlation. One way to fix it is to use a model called Generalized Least Square. But to fit this, you need to first model the auto-correlation among the residuals properly. Off course you can fit above models and then compare them based on some criteria to select a reasonable model.

• Thanks for the answer! One question: what if we would group all the measurements by month (so we get 12 groups wich all have an airquality measurement for each year). Could we use anove to test if there is a significant difference in means? Would that make sense? – Mcruzz May 25 '14 at 11:30
• In that case you are actually removing the time effect (year). I am not sure how that can be fitted to the anova test as it needs some assumptions (like normality ...). You have a time series data ... so you need to go with the models that are appropriate for time series data. – Stat May 25 '14 at 14:46