# Statistics - (Student's) t-test (Mean Comparison)

### Table of Contents

## 1 - About

The t-test is a test that compares means.

- Effect Size can be calculated like in multiple regression.
- Confidence Interval around the mean can also be reported

T-tests:

- t-test (single sample)

The two last ones are really common.

A t-test is a parametric statistic.

## 2 - Articles Related

## 3 - History

The Sutdent's t-test was developed by William Gossett in 1908. He was not only a statistics expert, but he was also a beer expert. He monitored the quality of stout beer at the Guinness brewery in Dublin, Ireland. He wanted to be empirical about it, and he sort of randomly assigned different things to different batches and then, developed this test to compare means.

But the management at Guinness were so protective of their brand, that they did not want William Gossett to share his procedures with anyone else. They didn't even want him to publish this in an academic journal.

They convinced him to publish under the name student.

## 4 - Test statistic

### 4.1 - Definition

- the z-test is used when comparing a sample mean to a population mean, and the population standard deviation is known.
- the single sample t-test is used when comparing a sample mean to a population mean and the population standard deviation is not known.

- A dependent t-test is appropriate when we have the same people measured twice. We can calculate a different score and then see if the mean different score is signifigantly different from zero. If so, we have a significant change.

- The independent t-test is appropriate when we want to compare two separate groups of people or two separate samples. For instance, if we want to compare one condition to another as men versus women.

### 4.2 - Calculation

The z or t test statistic is some observed value minus an expected value relative to standard error.

<MATH> \text{z or t} = \frac{(\text{Observed} - \text{Expected})}{\href{Standard_Error}{\text{Standard Error}}} </MATH>

Test | Observed | Expected | Standard Error |
---|---|---|---|

z | Sample mean | Population mean | Standard Error of the mean |

t (single sample) | Sample mean | Population mean | Standard Error of the mean |

t (dependent) | Sample mean of difference score | Population mean of difference score | Standard Error of the mean difference |

t (independent) | Difference between two sample mean | Difference between two population mean | Standard Error of the difference between mean |

In the dependent test, the observed is the sample mean of difference scores. As we have the same people measured twice, we can calculate the difference score for each individual, and then average the difference scores. That's not the case in the independent t-test as we have two different groups. In the independent t-test, we get the mean for the group one and the mean for group two, and then, look at the difference between the means.

### 4.3 - p-value

The p-values for z and t (back to the central limit theorem) is dependent on:

- whether the test is directional or non-directional
- on the sample size. degree of freedom. Different t-distributions for different sample sizes.

### 4.4 - degree of freedom

Test | degree of freedom |
---|---|

z | Non Applicable |

t (single sample) | <math>N - 1</math> |

t (dependent) | <math>N - 1</math> |

t (independent) | <math>(N_1 - 1) + (N_2 - 1)</math> |

## 5 - Example

Preferences comparison for a political candidate.

- In the 1st study you recruit liberals and conservatives and have them rate their likelihood to vote for the candidate. → independent t-test
- In the 2nd study you ask a group to rate their likelihood to vote for the candidate before and after the candidate makes a speech. dependent t-test
- In the 3rd study, you compare your group’s preference for the candidate to the voting population. → single sample t-test

???? Taking a sample size of 10, you find that your group performs 1.5 units of standard error higher the population mean for the test. You can then conclude that your group is not significantly different from the population. ????