Page 1 of 1

Chi-square test not working because of missing values

Posted: Thu Feb 05, 2026 1:58 pm
by Mara
Dear all,

Chi-square test for goodness-of-fit and test of independence are not working because of missing values that remain included in the calculations.

I have put the missing values in "missing values" in every variable, and they have been greyed out in the data set. However, they still remain in the variable levels. I have not found any way to exclude them from the calculations for Chi-square tests which of course did not work.

Indeed when I do the analysis and in the left box I tick "expected quantities", I can see that they have been taken into account (let's say they represent 20% of the answers) and on the right, in the result box, they don't appear but have been taken into consideration, meaning the other groups represent 80% (instead of 100%) and one part of the calcuation is "divided by nothing" (the 20% of the missing values), which result in NaN...

Anyone could please help me on that? That would be very much appreciated as otherwise I need to change software and restart from scratch all my analysis :(

Many thanks

Re: Chi-square test not working because of missing values

Posted: Thu Feb 05, 2026 11:00 pm
by jonathon
hi,

you're right, this is a weakness in our chi-square test implementation.

a work around would be to create a second variable which is a copy of the first, using computed variables. you'll see that the chi-square tests handle this second variable correctly.

jonathon


Screenshot 2026-02-06 at 09.57.25.png
Screenshot 2026-02-06 at 09.57.25.png (570.24 KiB) Viewed 1 time