Which test is used to test or compare two means?

When to use which test — T-test, Chi-square Test, ANOVA

Which test is used to test or compare two means?

Image by Mohamed Hassan from Pixabay

Statistics is an integral part of Data Science and Machine Learning. Statistics is a subfield of mathematics that refers to the formalization of relationships between variables in the form of mathematical equations. It tries to find relationships between variables to predict the outcomes. Statistics is all about, involving the study of collection analysis, interpretation, presentation, and organization.

There is a lot of statistical tests, to measure the relationship within or between variables. During a data science project, often a question arises in Data Scientist’s mind, that which statistical techniques to use for what kind of data or variables and when. In this article, you can read about a basic understanding of several types of statistical tests and when and how to use them for your dataset.

One sample Test vs Two sample Test:

Which test is used to test or compare two means?

Image by stux from Pixabay

One sample test is a statistical procedure considering the analysis of one column or feature. It can be a percentage distribution analysis (categorical variable) or mean analysis (continuous variable).

On the other hand, a two-sample test is a statistical procedure to compare or calculate the relationship between two random variables.

One-Sample Test:

As discussed above, a one-sample test involves hypothesis testing of one random variable.

  • One sample T-test for Mean: For a numerical or continuous variable, you can use a one-sample T-test for Mean, to test that where your population means is different than a constant value. For example, A MNC is interested to test the mean age of their employees is 30. They can use the one-sample t-test to get the result.

Which test is used to test or compare two means?

Here, t-stat follows a t-distribution having n-1 DOF
x̅: mean of the sample
µ: mean of the population
S: Sample standard deviation
n: number of observations
  • One sample T-test for Proportion: One sample proportion test is used to estimate the proportion of the population. For categorical variables, you can use a one-sample t-test for proportion to test the distribution of categories.

Which test is used to test or compare two means?

p̂: Observed probability of one certain outcome occurring
p0: hypothesized probability
n: number of trials.

Two-Sample Test:

In hypothesis testing, a two-sample test is performed on the data of two random variables, each obtained from an independent population. The test can be used to test the statistically significant difference between the two samples.

Once you figure out the purpose and datatype of your random variable, there are basically 3broad categories of datatype combinations:

  • Two Continuous variables
  • One Continuous and another Categorical variable
  • Two Categorical variables

Statistical test between two Continous Variables:

When your experiment is trying to find a relationship between two continuous variables, you can use correlation statistical tests.

Pearson Correlation:

Pearson Correlation is a statistical technique used to measure the degree of relationships between two linearly related variables. The value of its coefficient ranges between [1, -1], whether 1 denoted positively correlated, -1 denotes negatively correlated, and 0 denotes no correlation.

Spearman Rank Correlation:

Spearman Rank correlation between two random variables is equal to the Pearson correlation between the rank values of the two variables. It can be used to measure the monotonic relationship between two continuous random variables. The value of its coefficient ranges between [1, -1], whether 1 denoted positively correlated, -1 denotes negatively correlated, and 0 denotes no correlation.

Statistical Test between One Continuous and another Categorical variable:

T-test:

When your experiment is trying to draw a comparison or find the difference between one categorical (with two categories) and another continuous variable, then you need to work on the two-sample T-test, to find the significant difference between the two variables.

ANOVA:

When your experiment is trying to draw a comparison or find the difference between one categorical (with more than two categories) and another continuous variable, then you use the ANOVA (Analysis of Variance) test.

Statistical Test between Two Categorical variables:

Chi-squared Test:

When your experiment is trying to draw a comparison or find the difference between the two categorical random variables, then you can use the chi-square test, to test the statistical difference.

Conclusion:

Which test is used to test or compare two means?

(Image by Author), When to Use What statistical technique

In this article, we have discussed statistical techniques, and when to use what test to derive relationships or conclusions between or within random variables. Using the above discussed statistical techniques you can access the impact of one variable onto the other variable.

Correlation between two continuous variables is used to measure their relationships. All the other statistical tests can be used to draw a comparison between the two random variables, and the p-value can be used to accept or reject the null hypothesis.

References:

[1] Statistics Solutions: https://www.statisticssolutions.com/correlation-pearson-kendall-spearman/

Loved the article? Become a Medium member to continue learning without limits. I’ll receive a small portion of your membership fee if you use the following link, with no extra cost to you.

Thank You for Reading

Does t

A t-test is a statistical test that compares the means of two samples. It is used in hypothesis testing, with a null hypothesis that the difference in group means is zero and an alternate hypothesis that the difference in group means is different from zero.

What test is used to compare two variables?

The Pearson's χ2 test is the most commonly used test for assessing difference in distribution of a categorical variable between two or more independent groups.