The independent t test is used to test if there is any statistically significant difference between two means. Use of an independent t test requires several assumptions to be satisfied. The assumptions are listed below
- The variables are continuous and independent
- The variables are normally distributed
- The variances in each group are equal
When these assumptions are satisfied the results of the t test are valid. Otherwise they are invalid and you need to use a non-parametric test. When data is not normally distributed you can apply transformations to make it normally distributed.
For this exercise it is important to have a good understanding of data normality and hypothesis testing.
For this set of exercises we will use a motor trend car road tests data set. This data is already available in R as mtcars. The data consists of fuel consumption and vehicle characteristics related to design and the level of performance. Our interest in this exercise is to test if there are any significant differences in miles per gallon achieved between manual and automatic transmission vehicles.
Answers to the exercises are available here. If you have an alternative answer please post in the comments.
Inspect the structure of the data
Label the am (0,1) variable into automatic and manual categories
Check data labeling was successful
Attach mtcars data so that its variables are easily accessible
Generate descriptive statistics for each group
Generate box plot for each group
Test for normality in each group
Perform a Levene test for equality of variances in the two groups
Apply a log transformation to stabilize data variance
Perform a t test on the transformed variable
Interpret the results