I have searched about chi-square test and what I read is only about its application to genetics like Mendel's law. My data is about internet marketing where my variable is about user sessions. What I got from chi-square test I tried to apply to user sessions. I made data for observed user sessions and then for expected user sessions. I know the sum of expected and observed should be same.

1st. Question how to make expected column (user sessions): Is it by selecting randomly, keeping their sum equal to observed sum?

2nd. Is it applicable to my data? My expected user sessions were 4000 and what I observed was 4, so this single calculation becomes $(4-4000)^2/4000=3992$. By adding others in my outcome is like 21747!!!! But I read chi-square should be less than 1000.

Where did I go wrong?

Here is the table by day:

day  expected observed
1     4000      4   
2     200       50
3     234       200
4     5000      289
5      333       41
6      3999      209

Right now I am making expected values randomly as I am not clear about expected value. And one more important thing is I have one class in my case as its user sessions. Ask me if any ambiguity about question.

  • 1
    $\begingroup$ Please include in one sentence what statistical question you are trying to answer, i.e. what are you trying to achieve with the chi-squared test?. You have your observed data which I assume you collect through your server. How do you generate your 'expected' user session data? $\endgroup$
    – Zhubarb
    Nov 29, 2013 at 10:50
  • $\begingroup$ Large chi-square statistics are inevitable if the sum of observed frequencies and the sum of expected frequencies aren't equal. That certainly implies a hypothesis that fits poorly. It's customary to translate expected probabilities to expected frequencies by multiplying by the total frequency, so total frequencies match. $\endgroup$
    – Nick Cox
    Nov 29, 2013 at 11:26
  • 2
    $\begingroup$ Please use capitalisation and punctuation as usual in formal written English. You are not texting friends or relations; you are posting in a public forum and it's not in your interests to make what you say more difficult to read. $\endgroup$
    – Nick Cox
    Nov 29, 2013 at 11:28
  • $\begingroup$ To answer one of your questions: random guesses at expected frequencies are completely incorrect. $\endgroup$
    – Nick Cox
    Nov 29, 2013 at 11:35

2 Answers 2


I do not understand what type of $\chi^2 $ test you are trying to perform. And I suspect that you don't either. There are two types of $\chi^2 $ tests:

1- Goodness-Of-Fit: A goodness-of-fit test is a one variable Chi-square test, with the goal of determining whether a set of frequencies or proportions is similar to and therefore “fits” with a hypothesized set of frequencies or proportions” . A Chi-square goodness-of-fit test is like to a one-sample t-test. It determines if a sample is similar to, and representative of, a population. Catch-point: You need to hypothesise a true distribution.

Example: Compare the proportions of M&M’s of each color in a given packet to the proportions that Mars (the manufacturer) claims to produce. In order to be able to carry out this test, you need to have your packet of M$M's and know the true distribution that Mars claims.

2- Test of Independence: A test of independence is a two variable Chi-square test. Like any Chi-square test the data are frequencies, so there are no scores and no means or standard deviations. The goal of a two-variable Chi-square is to determine whether or not the first variable is related to—or independent of—the second variable. A two variable Chi-square test or test of independence is similar to the test for an interaction effect in ANOVA, that asks: Is the outcome in one variable related to the outcome in some other variable.

Example: To continue with the M&M’s example, with the independence test, you can investigate whether the colour distributions of the M&M's in two different bags differ from each other. All you need is to purchase two bags from the market and count the colour frequencies in each.

  • $\begingroup$ i think its the first one because at the end i want to know that if my expected user sessions are equal to observed user sessions. its only one variable and frequencies are available for each day $\endgroup$
    – Achilles
    Nov 29, 2013 at 11:22
  • $\begingroup$ If that is the case, do you know what your true distribution should be? $\endgroup$
    – Zhubarb
    Nov 29, 2013 at 11:26

First, chi-square is used in all forms of research, it is very general.

Second, where ever you heard or read that the statistic should be under 1,000 - forget it. It can range from 0 to infinity. If you have large numbers and your null hypothesis is far from true, you will get large values.

Third, since you probably want a goodness of fit test, you need to figure out the expected frequencies. You do not just guess. One possible hypothesis is that the frequencies are uniformly distributed over the days. Then, the table would be

day  expected observed
1     4000      2294.33   
2     200       2294.33
3     234       2294.33
4     5000      2294.33
5      333      2294.33
6      3999     2294.33

and your chi-square would be 11,163.06, which would have a p value with 15 0's. You don't say what software you are using, but in R this could be found with

obs <- c(4000, 200, 234, 5000, 333, 3999)

But you may have a different null hypothesis.

It would help if you told us a lot more about the context. My post how to ask a statistics question may help.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.