Exercise

Preliminary statistics

For independent t-tests you will revisit the working memory dataset from the previous chapter. In this dataset, subjects were randomly assigned to four different training groups that trained for 8, 12, 17 and 19 days, respectively (column cond in wm_t).

The scores for each subject were recorded before and after undergoing the training regime. You are interested in determining if there is a significant difference in the gain in intelligence scores between groups that trained for different lengths of time.

Instructions

100xp

The wm_t dataset has been loaded into your workspace.

Print wm_t to the console to refresh your memory of its contents.

Create a subset of the data for each training group and save each in a variable called wm_t##, where ## is 08, 12, 17 or 19.

View summary statistics for each subset using the describe() function from the psych package, which has been loaded for you. The gain row tells you the gain in intelligence test scores before and after training.

Create a boxplot using the ggplot2 package to visualize differences in the group means. This code has been provided for you, so you just need to run it as-is.

Use leveneTest() to perform Levene's test for homogeneity of variance. This will check if all groups contain an equivalent amount of variance, which is a necessary precondition for the use of pooled standard deviation in the t-statistic for independent groups. Note that the function uses a formula interface, so pass wm_t$gain to the left of ~ and wm_t$cond to the right.