Topic 6: \(t\)-tests for two-sample hypothesis testing


These are the solutions for Computer Lab 7.


1 The independent samples \(t\)-test in jamovi

1.1

No solutions required.

1.2

The null hypothesis is \(H_0: \mu_1 = \mu_2\) while the alternative hypothesis is \(H_1: \mu_1 \neq \mu_2\).

Note that we could also write this as \(H_0: \mu_1 - \mu_2 = 0\) and \(H_1: \mu_1 - \mu_2 \neq 0\).

1.3

The dependent variable here is the Yield variable. The independent variable is the Locality variable.

1.4

1.5

We have \(n_1 = n_2 = 42\).

1.6

We have \(\overline{x}_1 = 129.764\), \(\overline{x}_2 = 109.637\), \(s_1 = 52.810\) and \(s_2 = 51.974\).

1.7

We can see that both subsets of data may not be normally distributed. The boxplots also show that the median yield values between the two locations are quite different. However the spread of the data in both subsets appears similar (although the Virginian yield data includes one large outlier).

1.8

The \(p\)-values computed by the Shapiro-Wilk tests are \(0.034\) and \(0.024\) for Purnong Landing (Locality = 1) and Virginia (Locality = 2) respectively. As these values are both smaller than \(\alpha = 0.05\), we reject the null hypotheses that the data follow normal distributions, and conclude, based on these tests, that the yield data is non-normal for both localities. However, as noted in last week’s computer lab, thanks to the Central Limit Theorem we can still conclude that the distributions of the sample means are (approximately) normal, given that our sample sizes are greater than \(30\) for each Locality.

1.9

No solutions required.

1.10

Since the Levene’s Test p-value \(= 0.5819 > 0.05\), we can assume that the variances of the two yield data subsets are equal. Therefore, we should read from the first row of the \(t\)-test output, i.e. Student’s \(t\).

1.11

We note that the test statistic equals \(1.760\), the p-value equals \(0.082\), the degrees of freedom equal \(82\) \((n_1 + n_2 - 2)\), the sample means match those we calculated in 1.6, and the \(95\%\) confidence interval is \(( -2.618, 42.871)\).

1.12

The \(95\%\) confidence interval is \(( -2.618, 42.871)\). This is an interval for the difference between the true average yield value of White Imperial Spanish onions grown in Purnong Landing compared to those grown in Virginia. Therefore this interval tells us that we are \(95\%\) confident that the mean difference in the yield of Purnong Landing onions compared to Virginian onions will be between approximately \(-2.618\) grams and \(42.871\) grams.

1.13

We have carried out a thorough analysis to assess whether there is a statistically significant difference in the true (population) average yield value of White Imperial Spanish onions grown in the two different locations of Purnong Landing and Virginia. Following an independent samples \(t\)-test, we conclude that we do not have evidence of a statistically significant difference in the average yield values of onions grown in these two locations.

2 The paired \(t\)-test in jamovi

2.1

The null hypothesis is \(H_0: \mu_D = 0\) while the alternative hypothesis is \(H_1: \mu_D \neq 0\).

2.2

The dependent variable here is the weight, which is measured at the start and end of semester. The independent variable is the time variable, since we measure at two time points (initial and terminal).

2.3

2.4

The weights look similar before and after semester.

2.5

The initial weight sample mean is \(136.074\) pounds, the terminal weight sample mean is \(137.985\) pounds.

The sample standard deviation for the initial weights is \(24.371\). The sample standard deviation for the terminal weights is \(24.610\).

We note that the initial sample mean and the terminal sample mean are quite similar, as are the initial sample standard deviation and the terminal sample standard deviation.

At the terminal time point, both the sample mean and sample standard deviation are larger than at the initial time point.

2.6

No solutions required.

2.7

This Normal Q-Q plot could be acceptable, although it does exhibit some peculiar ‘grouping’ (which could possibly be due to the limited range of values the variable takes).

The \(p\)-value computed by the Shapiro-Wilk test is \(0.022\). As this is much smaller than the \(\alpha = 0.05\) value used in the Shapiro-Wilk test, we reject the null hypothesis that the data follows a normal distribution, and conclude, based on this test, that the paired difference data is non-normal.

However, because our sample size of \(n=68\) is larger than \(30\), due to the Central Limit Theorem we can still conclude that the distribution of the sample mean is (approximately) normal.

2.8

We note that the test statistic equals \(-7.407\), the degrees of freedom equal \(n-1 = 67\), \(p < 0.001\), the mean difference equals \(-1.912\), and the \(95\%\) confidence interval is \((-2.427, -1.397)\). Note that these values could be reversed in sign, if you have tested Terminal.Weight against Initial.Weight.

2.9

The \(95\%\) confidence interval of \((-2.427, -1.397)\) is an interval for the difference between the true (population) mean weight (in pounds) of students before semester, compared to after semester. Therefore this interval tells us that we are \(95\%\) confident that the average weight of a student at the start of the semester is between 2.42 and 1.4 pounds less than by the end of semester.

2.10

We have carried out a thorough analysis to assess whether there is a statistically significant difference in the true average weight of freshman students before and after their first semester of college. Following a paired \(t\)-test, we conclude, with a high degree of statistical certainty, that such a difference does exist. Namely, students are highly likely to gain between roughly 1.4 to 2.42 pounds over the course of semester.

2.11

Note that these results are the same as those found for the paired \(t\)-test, in terms of absolute magnitude. In other words, the two tests are equivalent!

3 Effect size for a one-sample \(t\)-test

The estimated effect size is 0.183, which is considered a “negligible”, or very small effect.


That’s everything! If there were any parts you were unsure about, take a look back over the relevant sections of the Topic 6 material.


References


These notes have been prepared by Amanda Shaker and Rupert Kuveke. The copyright for the material in these notes resides with the authors named above, with the Department of Mathematical and Physical Sciences and with La Trobe University. Copyright in this work is vested in La Trobe University including all La Trobe University branding and naming. Unless otherwise stated, material within this work is licensed under a Creative Commons Attribution-Non Commercial-Non Derivatives License BY-NC-ND.