## What is a Paired Samples t-test?

The T-test provides insight into whether the difference between the means of two groups is due to chance or is reliable (ie would be found again in another measurement from the same population). As opposed to a descriptive statistic, which describes the sample being measured, the t-test is an inferential statistic, which describes the sample being measured and provides a generalization for the entire population from which the sample was taken. Lastly, It is also called the dependent t-test or repeated t-test.

The paired-sample t-test is a parametric statistic technique used when we have one group of participants and collect data from them on two occasions or under two different conditions. For example, we collect data about stress or anxiety levels before and after exams. Therefore, we have one continuous dependent variable and one independent categorical variable (time one and time 2, or before and after).

**When Should a Paired Sample t-test be Used?**

Paired sample t-test is a statistical technique that is used to *compare two population means in the case of two samples that are correlated*. In other words, You should use a paired t-test when you have the same subjects in both conditions being compared.

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

For example, Suppose that teacher wants to know whether a training program in statistics improves exam marks. Therefore, the teacher gives students an exam before the statistics training program and records marks on a scale of 1 to 5. Students take statistics classes, and the teacher gives them the exam after the training programs. Therefore, we have one dependent variable, the exam mark, and one independent variable, the training program in statistics (before, and after).

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

Therefore, we test the following hypotheses:

* Null hypothesis*: There is no significant difference in exam marks before and after the statistics training program.

* Alternative hypothesis: *There is a significant difference in exam marks before and after the statistics training program.

## R function to Compute Dependent t-test

The code to run a dependent sample t-test using R is as follows:

t.test (x, y, paired=TRUE, data = dataframe)

**x:** numeric vector (pre-scores)

**y:** numeric vector (post or follow-up scores)

**paired**: a logical value specifying that we want to compute a paired t-test