# Statistical Test for frequency distribution

I have an event (say the number of cars observed on a section of a road in an hour) that is performed every day throughout a year at a specific time for an hour. The numbers are divided into groups (say 0-100, 100-200 and so on). At the end of the year, each division has a frequency associated with it, i.e. the number of times the number of cars observed in an hour was in that range.

Now, I want to compare if the weather plays a role in this or not. So, I segregate the observations for summer and winter. Now, I have two sets. Which test should i use to test whether weather plays a significant role in determining the frequency distributions?

• Why are the numbers divided into groups? Do you not have the raw counts? Commented Jan 9, 2015 at 16:12
• Yes I have the raw counts as well. Commented Jan 10, 2015 at 17:56
• You can obtain detailed weather records. So why not use them, rather than stripping out so much useful information by binning the counts and splitting only into summer vs winter? You would learn far more that way.
– whuber
Commented Jan 11, 2015 at 20:22
• Thanks. The real data set is more complicated than the way I have represented it. I have the other season data as well. I had written about two just as an example. Commented Jan 14, 2015 at 21:51

There are a couple of different approaches you can take, depending on how you want to slice the data.

• If you keep your groupings, then you could create a crosstab or contingency table, and use a $\chi^2$ test. This is a very basic test that compares the expected counts to the observed counts in each cell. The expected counts are what you would expect if there is no difference between seasons; the observed is what was actually obtained. If the difference is large enough to not be from random chance, then the test will show you it is statistically significant (based on a $\chi^2$ distribution).

• If you want to work with the raw data, then you need to think about the process that created the counts. It could be represented by a Poisson distribution, which is often used for number of occurrences within a period. You could use a simple Poisson regression, where the unit of analysis is the day, dependent variable is the number of cars, and the independent variable is a single dummy variable for season (1=Winter, 0=not winter); or you could include all four seasons with 3 dummies (e.g. one for Fall, one for Spring, one for Summer, and the ommitted category is Winter). If the season coefficient is significant, then the expected number of cars is statistically different.

Depending on the actual distribution of the data, you may be able to approximate the Poisson distribution with a Normal distribution, and you could use a t-test, analysis of variance (ANOVA), or linear regression. The interpretation of these tests are much simpler than a Poisson model, so many analysts prefer to do this if possible. Look at the histogram of your data and examine the skew and kurtosis.

Most of these tests are available in standard statistical software like SPSS, Stata, SAS, and R. Excel can do them as well.

If I were you, I would actually start with the raw data, unless you have strong theoretical reasons for wanting to group the data. You could do both, of course, and see which result makes more intuitive sense.

If you were to compute a simple frequency distribution by hour for summer and a separate one for winter , you would be implicitely assuming that there were no other effects that should be conditioned for. When you construct a model that incorporates important effects , the residuals from that model are the adjusted counts taken into account (play on words) the variables in the model e.g. day-of=the-week, holiday effects, pulse effects et al .

Since you have the original count data , I would develop a Transfer Function / regression model for each hour incorporating any and all identifiable factors. This model would include an indicator variable 0/1 reflecting the two seasons reflecting the hypothesized effect. The model could include day-of-the-week factors, holiday factors, weekend factors , level shift/local time trend factors , pulses etc.. By conditioning the count series for a number of these possible explanatory/cause variables one could then estimate the statistical significance of the seasonal indicator.

This is the essence of testing the equivalence of the frequency distributions,in my opinion. This model may have to identify and incorporate any unusual data points in order to get a robust estimate of the seasonal effect. If you wish to post one hour of data in an excel file for as long as you have it, I will pursue this for you. Please indicate in the excel file your 0/1 indicator for the season effect It might also be productive for other readers of this to suggest their analysis/approach to this "sticky question".

• Thanks a lot. I will try doing the analysis and will get back to you. Commented Jan 14, 2015 at 21:52