Statistics : T-test & Chi-Square test


In statistics we have various types of test to validate the a single group or multiple groups.Here we can say a group as a feature in the data set.These features can be either categorical or numerical features.

With the help of T-test and Chi-square test we can conclude that if the given group/feature’s are independent or dependent with each other.

T-test :

When we want to compare one or two numerical variable for independence we use T-test.Git Link

It is of three types.

1-Sample T-test
2-Sample T-Test or Independent T-test
3-Paired T-test

1-Sample T-test

To compare population mean and sample means if they are same or different we use 1-Sample T-test.

Below code to test in Python.

2-Sample T-Test or Independent T-test

Sample T-test will compare two independent means of two features to validate if both are same or different

3-Paired T-test

We go for paired t-test when we want to compare different means of same group taken at different time interval.

Chi-Square test:

Chi-Square test is used to compare two categorical variables to see if they are same or different .Git Link

Conclusion: These test are very important in data Preprocessing and feature engineering steps where we drop the columns which depict same information to avoid multicollinearity issue.

Hope you like my article.Please hit Clap 👏(50 times) to motivate me to write further.

Please write your queries & comments and share your feedback.

Want to connect :

Linked In :

If you like my posts here on Medium and would wish for me to continue doing this work, consider supporting me on patreon



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Anjani Kumar

Anjani Kumar

Data Science ,ML & NLP Enthusiastic