Module #9: t-test for independent means

This week we looked at t-tests for independent samples. The dataset was a list of students, with the values being the student gender and the number of times they raised their hands in class.

To get the values I needed, I first put the data into a text file, read it into R, then set up vectors for boys and girls and ran t.test() on them:

students <- read.table("G:/week9data.txt", header=TRUE)
girls <- students[students$Gender==1,2]
boys <- students[students$Gender==2,2]
t.test(girls, boys)

The result of t.test() was:

	Welch Two Sample t-test

data:  girls and boys
t = 2.8651, df = 6.7687, p-value = 0.02505
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.6805904 7.3765524
sample estimates:
mean of x mean of y
 7.600000  3.571429
 

1. The means are:
girls: 7.6
boys: 3.571

2. The degrees of freedom value is 6.769.

3. The t-test statistics score is 2.865.

4. The p value is 0.025

5. The p value is below the alpha value of 0.05, so this test would have been statistically significant.

6. To find the critical t value for a p of 0.01 and the degrees of freedom indicated by the samples, I used the qt() function:

qt(0.01, 6.769)

Then I took the absolute value of the result. The result indicates that the t value would have to exceed 3.027 to be statistically significant for a p value of 0.01.

This entry was posted in Advanced Statistics and Analytics. Bookmark the permalink.

Comments are closed.