so you have some data and you need to calculate chi-square which can be defined as a statistical measure of the magnitude of the differences between the observed and expected frequencies you use Chi square on nominal or categorical data to that end we will focus on a brief and basic understanding of chi-square how to calculate the chi-square statistic and how to use what you have calculated to determine if you should accept or reject the null hypothesis we will calculate a one variable chi-square here once you understand the basics the two variable chi-square while time consuming will be fairly simple to do let's start with some assumptions let's say that we're interested in learning styles in particular we hypothesize that individuals have dominant learning styles one of three visual auditory or kinesthetic you could write a measure to divide individuals into one of the three learning styles and you do a survey of say 99 people if the resulting data is evenly distributed we would expect the numbers to be broken up evenly among the three learning styles in this case 33 in each category 99 divided by three categories is 33 so that's what we would expect to find if the data were normally distributed but at what point can we say that learning styles is not normally distributed say your results are instead of being normally distributed at 33 for each category your survey results are 35 for visual 24 for auditory and 40 for kinesthetic that's what we observed from the data we gathered but is that enough of a difference to say that there really is a dominant learning style could what we have found or observed be the result of chance or sampling error that's what we use chi-square for the formula for chi-square is the sum of observed minus expected squared divided by expected all we need to know in the formula is that observed is au and expected is e in this case o means observed or what you actually found and a means expected or what you would expect to find if there were no differences if the data were for example normally distributed between the categories remember that expected is total sample size divided by the number of categories for example ninety-nine people three categories means 33 in each category the expected would be 33 you are using chi-square to test a hypothesis the chi-square hypothesis really the alternative hypothesis you are hypothesizing that there will be a difference between what you observe which is what you have or will find and what you would expect to find if there were no differences in the data in other words the chi-square hypothesis is that the expected would not equal the observed frequencies remembering that the null hypothesis encompasses everything but what's included in the alternative hypothesis the null hypothesis would be that e equals o or that there is no difference between what you would expect to find if all responses were equally distributed and what you did find or observed in the resulting data so now let's focus on how to calculate a one variable chi-square where you are asking if there is a non normal distribution on a single variable in this case we'll continue with the learning styles example one variable what type of learning style remember that in our example there were three possible answers to this question that means three categories the number of categories is designated as K that helps you determine your expected data the total number of observations in our example we've been using 99 divided by K or the number of categories one other calculation you will need after you've calculated the chi-square is degrees of freedom designated as DF this is the number of categories K minus 1 in our case that would be two degrees of freedom if you had four categories visual auditory kinesthetic and well let's say extrasensory then degrees of freedom would be three four categories minus one equals three it has been argued that individuals have dominant learning styles visual auditory or kinesthetic you do a survey of 99 people and you get the following results 35 were visual learners 24 were auditory learners and 40 were kinesthetic learners these are your served frequencies and another reminder chi-square is used for categorical or nominal data not continuous level data in other words you don't calculate chi-square for data that you can summarize in means the question is at one point can we say that learning styles is not normally distributed let's focus first on the visual cell remember that we have 99 observations sometimes called instances of cases in this cell you have an observed frequency of 35 step 1 is to calculate the expected frequency recall the formula as the total number of observations in this case 99 divided by the number of categories in this case 3 so 99 divided by 3 is 33 the next step is to subtract the observed in this case 35 from the expected in this case 33 yielding to the formula tells us that we now have to square that so we are now at four now it's time to divide that by the expected which we previously calculated at 33 so 4 divided by 33 is 0. 12 now let's do it for auditory where the observed is 24 we have 33 again for the expected but now when we subtract the expected from the observed we get negative 9 following the formula we square that and come up with 81 now we take that 81 and divide it by the expected value of 33 and we end up with 2. 45 onto the last column of numbers for kinesthetic again expected is 33 when subtracted from the observed of 40 yields 7 7 squared is 49 and when you divide 49 by the expected 33 you end up with one point four eight one last step to calculate chi-square is to add this bottom row of numbers together two plus two point four five plus one point four eight equals four point oh five four point oh five then is the calculated chi-square now that you've calculated the chi-square we need to compare it against something to make a decision to accept or reject the null to do this you'll need to calculate the degrees of freedom remember that no the desired alpha level related to the desired level of confidence in your decision and a chi-squared distribution table so you can find the critical value remember the formula for degrees of freedom is the number of categories minus one in our case we have three categories visual auditory and kinesthetic minus one equals two degrees of freedom degrees of freedom means essentially room to move or how many ways our data can be combined and still produce the same value of the calculated chi-square if you have a product of three for example that could be achieved by 1 plus 1 plus 1 or 0 plus 1 plus 2 etc ok let's say that we want an alpha level of 0.
05 which when converted to a percentage is 5% this means that we want to be 95% confident in our decision or that we are only willing to tolerate a 5% chance of error time to take all this data and look at a table of chi-square critical values you are looking for where your degrees of freedom and your alpha level intersect in this case with two degrees of freedom and an alpha level of 0. 05 the critical value is five point nine nine one now compare your calculated chi-square with a critical value if your calculated chi-square is higher than the critical value this means that you can be 95% sure that what you observed is really different from what you would expect to see so you would reject the null hypothesis that there's no difference if however your calculated chi-square is lower than the critical value then you should accept the null hypothesis that there is no difference between what you would expect to find and what you did find or observed in your data one way to remember whether to reject or accept the null is to think what you do when you buy something you have a certain amount of money in your wallet if the price of what you want to buy is high it is more than the money than you have in your wallet in this case the critical value you don't purchase so you reject the purpose you reject the null if the price is low however you will accept the purchase so you'll accept the null so if the calculated chi-square is higher than the critical chi-square value then you reject the null in favor of the alternative hypothesis in our example the calculated chi-square of 4. 05 is lower than the critical value chi-square of 5.