## What is an Independent Samples t-test?

The independent samples t-test is a parametric statistical technique that we use to compare the mean value of a continuous variable in two different groups. Therefore, for an independent samples t-test, we need one continuous dependent variable (e.g. stress level, anxiety level, self-esteem level, etc.) and one categorical independent variable with two groups (e.g. gender (male, female), belief in love (yes, no), in a relationship (yes, no), etc.).

**When Should an Independent t-test be Used?**

The independent t-test is used when you have two separate groups of individuals or cases in a between-participants design.

### An Example Of **Independent t-tests **

For example, a researcher wants to examine whether men’s and women’s stress levels differ. Therefore, we have one dependent variable – the stress level, which we measure on a scale from 1 to 10, and one independent variable, gender, with two categories (male and female).

**What are the use of null and alternative hypothesis for the independent t-test?**

Therefore, we test the following hypotheses:

** Null hypothesis**: There is no significant difference in stress levels between males and females.

** Alternative hypothesis**: There is a significant difference in stress levels between males and females.

## R function to Compute Independent t-test

The code to run an independent-samples t-test using R is as follows:

t.test (DV~ IV, var.equal=TRUE, data = dataframe)

DV: dependent variable

IV: Independent variable