bugGNU Octave - Bugs: bug #58838, [octave forge] (statistics)...

 
 

bug #58838: [octave forge] (statistics) chisquare_test_homogeneity result does not equal equivalent chisquare_test_independence

Submitter:  Tasos Papastylianou <tpapastylianou>
Submitted:  Mon 27 Jul 2020 05:09:56 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Tasos Papastylianou Open/Closed:  * Closed
Release:  * 5.2.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 16 Aug 2022 06:00:33 PM UTC, comment #1: 

The calculation of chisq is the same in both tests. It is a matter of experimental design that makes the difference. In independence we are looking at groups drawn from the same population, whereas in homogeneity we are comparing two different populations. The computations on the contingency table are the same.
In the chisquare-test_homogeneity, the function attempts to build the contingency table, but it is best to use the `crosstab` function for this purpose
I 've merged both functions in a single implementation, while adding error checks, warnings regarding small expected values in cells, BISTs etc.
Commit f29d19e pushed at https://github.com/gnu-octave/statistics/commit/f29d19ece4a2c3e80fb5232e87dee8aae062da0a
This can be closed

Andreas Bertsatos <pr0m1th3as>
Mon 27 Jul 2020 05:09:56 PM UTC, original submission:  

Prompted by this question: https://stackoverflow.com/a/63119920/4183191

If my understanding of how chisquare_test_homogeneity is supposed to work (as described in that stackoverflow post) is correct, then the following two should have been equivalent, but in fact the resulting p-value is different.


x = [ones(1,10), zeros(1,10)];
y = [ones(1,5 ), zeros(1,15)];
chisquare_test_homogeneity (x, y, 0.5)
% pval: 0.31731

chisquare_test_independence ( [10, 10; 15, 5] )
% pval: 0.10247


While the code involved in the m-file is fairly short and simple, the documentation of this function is paltry. Also the implementation seems to rely on some sort of 'cumulative' version of the chi square, which I have not seen before. Is there a reference for this?

Tasos Papastylianou <tpapastylianou>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pr0m1th3as (Posted a comment)
  • -email is unavailable- added by siko1056 (Updated the item)
  • -email is unavailable- added by tpapastylianou (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-08-19 siko1056 StatusNone Fixed
        Open/ClosedOpen Closed
    2020-08-26 siko1056 SummaryStatistics package - chisquare_test_homogeneity result does not equal equivalent chisquare_test_independence [octave forge] (statistics) chisquare_test_homogeneity result does not equal equivalent chisquare_test_independence

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code