# Thread: Chi square test where one variable is a constant

1. ## Chi square test where one variable is a constant

Hello everyone,

This is my first post on this forum. I am a newbie in this field and am trying hard to grasp the concepts of using statistical tests but need your expert help and advice.

I am a clinician and am interpreting some data we have collected as part of a routine clinical practice. We have collected data for one year for every new patient presenting to us and now want to check whether gender, age group and area of residence have any association with the diagnosis of the patient. We use international classification of disease (ICD-10) to code for the diagnosis. I have read through multiple websites and seen many videos on what test is the best to check for this association/difference. As all the variables are categorical, i believe chi square test would be the most appropriate option. So i want to know whether patients having a certain diagnosis, let's say F31, are more likely to be male or female, older or younger (decade wise analysis) or from outside or inside the city. The problem i am facing is that when i place F31 as a diagnosis in one of the tabs, SPSS does not calculate chi square test, indicating that the test was not performed as diagnosis was a constant.

Now am i right i assuming that chi square test is the best test option in this particular scenario? If not what would be the most suitable statistical test. If chi square is the right option, how do i get past this problem of one variable being a constant.

Regards,

2. ## Re: Chi square test where one variable is a constant

If I understand you correctly, then within the patient group with F31 diagnoses you want to know whether (e.g.) gender is unevenly distributed? You could do that by using one-sample Chi² test. With this you would test whether the distribution in you sample is significantly different from a 50%:50% distribution.

HTH

K.

3. ## The Following User Says Thank You to Karabiner For This Useful Post:

shaariq (07-01-2016)

4. ## Re: Chi square test where one variable is a constant

Yes exactly. You got that right. I want to find out if within this group of patients (F31) gender, age group (by decade: e.g. 1-10, 11-20 etc.) and area of residence (outer city, inner city) are evenly or unevenly distributed. So you mentioned one sample chi square test. I'll have a look on google to find out how this is done in SPSS, but would be greatly obliged if you guide me on exactly how i go about this using SPSS. Many thanks for your time and advise. Stay blessed.

5. ## Re: Chi square test where one variable is a constant

OK. Had a look on Google. What i get from it is that you go to Analyze then non parametric tests then legacy and then pick chi square which seems to be working quite well for the gender part but not so well for the age groups or area of residence. I think i will need further guidance on how to go about these later 2 variables but for now feeling happy that i have with the help of experts like you been able to solve at least one part of the puzzle.

6. ## Re: Chi square test where one variable is a constant

Ok guys. Hi again.

Now that i have had a few days to play with the data files (and only data files ) i have some new questions popping up now. The one sample chi square test works wonderfully well for the gender part as there are only 2 categories. However we also want to find out if individual disorders vary by the age groups as well. When i run this analysis i get this sort of results

Age
Observed N Expected N Residual
2.00 44 51.8 -7.8
3.00 120 51.8 68.2
4.00 83 51.8 31.2
5.00 45 51.8 -6.8
6.00 13 51.8 -38.8
7.00 6 51.8 -45.8
Total 311
Test Statistics
Age
Chi-Square 180.093a
df 5
Asymp. Sig. .000
a 0 cells (0.0%) have expected frequencies less than 5. The minimum expected cell frequency is 51.8.

Now my querry is as follows:

As there is only one p value attached to this data set i gather that there is a significant difference between different age groups.However, age group 2 and age group 5 only differ slightly from the expected frequency while age group 6 and 7 show larger difference from the expected. I want to know if the difference in age group 2 and 5 can also be termed as significant and if not what is the method by which we decide the significance for an INDIVIDUAL age group and not for a data set as a whole.

Thanks again for everyone taking the time to read through this and please bear with me if the question is a silly one. Stats is not everyone's cup of tea .

P.S. i could not get the table inserted in the post so the text of the table looks jumbled. I have attached a word file and hopefully it would show the table as it is shown in SPSS. Fingers crossed.

7. ## Re: Chi square test where one variable is a constant

For individual groups, you could carry out 6 separate one-sample Chi² tests, each with 1 age group vs. the rest (you would need to create 6 new variables), using a Bonferroni-corrected alpha 0.05/6 (because of mutliple testing).

For pairwise comparisons, you can do 15 one-sample Chi² tests. Maybe you don't need to perform all of them, but the correction factor would be 0.05/15 anyway.

With kind regards

K.

8. ## The Following User Says Thank You to Karabiner For This Useful Post:

shaariq (07-18-2016)

9. ## Re: Chi square test where one variable is a constant

OK. Thanks a bunch for your helpful reply again. Although this time it looks like beyond my capacities to handle statistical information. Will need to spend sometime on google etc. to understand Bonferoni-correction etc. Also the creation of 6 new variables seems a bit . Anyway let me spend some quality time with these new concepts and i will report back with what i have understood. Thanks and kind regards .

10. ## Re: Chi square test where one variable is a constant

Just to further clarify my original query regarding multiple testing... i feel i may have mislead you in framing my question in the above post. When i said i wanted to calculate the significance for individual age group, i did not mean to say that i want to report the significance for the individual age group( by having a particular p value for each individual age group). I want to report my finding by writing something like " for this particular disorder, we found that patients in the 2nd and 3rd decade of life and significantly more likely to report in outpatients and patients in the 6th and 7th decade of life are significantly less likely to do so" . I do not mind whether there is one p value attached to this statement or multiple values. With this in mind would you still recommend the above stated method for multiple testing or something else ?

Also i have read in some of the posts that Bonferroni correction is not needed for observational data. Our data is of observational nature i.e we are analyzing the gender, seasonal and age trends in patients who have presented to us in the one year specified period. This is not an experimental study. So would bonferroni correction would still apply?

And finally i cannot get my head around making six new variables. We already have six variable whcih are name, age , gender, residence, month and diagnosis. What would be the other six variable that would need to created for further analyses as suggested ?

Thanks and regards,

11. ## Re: Chi square test where one variable is a constant

I want to report my finding by writing something like " for this particular disorder, we found that patients in the 2nd and 3rd decade of life and significantly more likely to report in outpatients and patients in the 6th and 7th decade of life are significantly less likely to do so" . I do not mind whether there is one p value attached to this statement or multiple values.
You want a statement about statistical significance but you do not want to perform significance tests?

If you want to avoid tests, then you could inspect adjusted standardized residuals for each cell. A value > 1.96 (or < -1.96) is often considered as an indication that the cell frequency is higher or lower than expected under the assumption of no association.
Also i have read in some of the posts that Bonferroni correction is not needed for observational data.
This is not true. The Bonferroni method is applied if one wishes to contain the risk of false-positive tests. Whether the tested data are from an observational or an experimental study is not relevant for the decision to apply or not apply Bonferroni.

And finally i cannot get my head around making six new variables.
One variable for each age group, e.g. variable "age group 20-29": each participant who is between 20 and 29 years old receives a "1" in this variable, all other participants receive "0". etc.

With kind regards

K.

12. ## The Following User Says Thank You to Karabiner For This Useful Post:

shaariq (07-27-2016)

13. ## Re: Chi square test where one variable is a constant

Originally Posted by Karabiner
You want a statement about statistical significance but you do not want to perform significance tests?

If you want to avoid tests, then you could inspect adjusted standardized residuals for each cell. A value > 1.96 (or < -1.96) is often considered as an indication that the cell frequency is higher or lower than expected under the assumption of no association.

This is not true. The Bonferroni method is applied if one wishes to contain the risk of false-positive tests. Whether the tested data are from an observational or an experimental study is not relevant for the decision to apply or not apply Bonferroni.

One variable for each age group, e.g. variable "age group 20-29": each participant who is between 20 and 29 years old receives a "1" in this variable, all other participants receive "0". etc.

With kind regards

K.

OK. This is perfect. You are truly a rock star. All my doubts are clarified now. Thank you so much. Stay blessed.

 Tweet

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts