Page 1 of 2
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 (570.24 KiB) Viewed 43514 times
Re: Chi-square test not working because of missing values
Posted: Mon Feb 09, 2026 10:02 am
by Mara
Hi, thanks for checking this. It is true that the missing variable disappear from the data sets when you compute a new variable =...
However, if I do the test on this variable I still get NaN for the Chi-square test. Indeed, if I look at the expected quantities on the left, the missing variable is still taken into consideration...
Re: Chi-square test not working because of missing values
Posted: Mon Feb 09, 2026 10:32 pm
by jonathon
hi,
can you double check that for me? it works for me. observe that the 500 no longer appears in the contingency table. you'll need to use the new column in the analysis of course.
i think we have a fix for this issue in the pipeline, but i think you should be able to get this to work in the mean time.

- Screenshot 2026-02-10 at 09.30.03.png (245.75 KiB) Viewed 41936 times
Re: Chi-square test not working because of missing values
Posted: Tue Feb 10, 2026 8:14 am
by Mara
Hi, contingency table works. But not the chi-square test goodness of fit (NaN). And if you look at the expected proportions, the missing values would still appear...
Re: Chi-square test not working because of missing values
Posted: Tue Feb 10, 2026 8:37 am
by jonathon
Ah, apologies for the misunderstanding.
I have something for you that I think will work.
Rather than a computed variable, use a transformed variable instead. Use the variable with the missing values as your source. You'll need to create a transform with the default formula, i.e. $source
Sorry for the runaround!
Jonathon
Re: Chi-square test not working because of missing values
Posted: Wed Feb 11, 2026 7:54 am
by decaux
The jeva module, available in the jamovi library, allows categories with 0 counts. It calculates the equivalent G rather than chi-square.
G is comparable (even favourable) to chi-square, and is 2 x log likelihood ratio (without correction for parameters).
Peter
Re: Chi-square test not working because of missing values
Posted: Wed Mar 04, 2026 9:04 am
by Mara
Hi Jonathon,
Sorry for not replying earlier: I was very busy with another project. Regarding your last post:
Do I have to go under "compute" or under "transform"? Besides, I did not understand your formula:$source -> could you please tell me what do I need to type (=...)?
Many thanks
Re: Chi-square test not working because of missing values
Posted: Wed Mar 04, 2026 9:34 am
by jonathon
hi,
yes, you'll want to use a transformed variable ... see the following screenshot

- Screenshot 2026-03-04 at 20.32.34.png (174.5 KiB) Viewed 17662 times
having said that ... we're very close to pushing out a fix to this issue.
jonathon
Re: Chi-square test not working because of missing values
Posted: Wed Mar 04, 2026 11:59 am
by reason180
'
Hi. This seems like a simple solution (see the screen shot below).
'

- Picture_GoodnessOfFitWorks.png (61.81 KiB) Viewed 17502 times