Exercise

# Paired t-test

In the video, you learned how paired t-tests can be more powerful than regular t-tests. During this exercise, you will see an example demonstrating this. The first step will be to simulate data. Similar data might come from a people's weights before or after a drug treatment or amount of money spent by a customer before or after a seeing a commercial.

Simulated data allows you to know the properties of the data and check to see if your model behaves as expected. R comes with many distributions including the normal. Your simulated data will have unequal variance (that is, the standard deviations will be different). The second step will be to analyze the data with both a paired and regular t-test. Last, you will be asked about the results from the paired t-tests.

As part of the first step, you will "set the seed" for R's random number generator. This ensures you get the same numbers each time you run the code and DataCamp's software correctly scores your code.

Instructions 1/3

**undefined XP**

- Set the seed to equal
`345659`

. - Set
`n_ind <- 10`

to simulate 10 individuals. - Simulate the
`before`

group with a mean of`0`

and standard deviation of`0.5`

. - Simulate the
`after`

group by adding a random vector with a mean`4.5`

and standard deviation of`5`

to the before vector.