# Chi-squared test for imbalance class

**URL:** <https://forum.knime.com/t/chi-squared-test-for-imbalance-class/78966>\
**Category:** KNIME Analytics Platform\
**Tags:** r\
**Created:** [May 3, 2024, 5:18pm UTC](https://forum.knime.com/t/chi-squared-test-for-imbalance-class/78966 "2024-05-03T17:18:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdibiase2](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mdibiase2](https://forum.knime.com/u/mdibiase2)\
**Post date:** [May 3, 2024, 5:18pm UTC](https://forum.knime.com/t/chi-squared-test-for-imbalance-class/78966/1 "2024-05-03T17:18:51Z")

</div>

Hi all !

I am dealing with chi-squared test performing with Crosstabe node.  
I get through this properly, but i have a doubt: classes are imbalanced a lot. How can I deal with this ?

---

<div class="post-metadata">

**Author:** ![mwiegand](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mwiegand/32/66896_2.png) [@mwiegand](https://forum.knime.com/u/mwiegand)\
**Post date:** [May 3, 2024, 9:34pm UTC](https://forum.knime.com/t/chi-squared-test-for-imbalance-class/78966/2 "2024-05-03T21:34:40Z")

</div>

Hi @mdibiase2,

is it possible for you to share some sample data illustrating the issue please?

Best  
Mike

---

<div class="post-metadata">

**Author:** ![mdibiase2](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mdibiase2](https://forum.knime.com/u/mdibiase2)\
**Post date:** [May 4, 2024, 7:37am UTC](https://forum.knime.com/t/chi-squared-test-for-imbalance-class/78966/3 "2024-05-04T07:37:21Z")

</div>

Sure !  
I got the target variable presenting 3 classes and 2113 total observations.  
Most of them, namely about 1800 belong to class 1, while the remaining are splitted among class 2 and 3. So a strong imbalance over classes does exist.

I want to check out if a categorial explanatory variable of 2 classes show different distribution among the 3 classes of the target variable, so Chi-squared is required.

Should I handle the class imbalance in this case ?

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [August 2, 2024, 7:37am UTC](https://forum.knime.com/t/chi-squared-test-for-imbalance-class/78966/4 "2024-08-02T07:37:57Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
