Project 42: Two-Sample T-Test

Intro Problem: Do high school males send less texts messages per week than high school females?

To test this claim at the .10 level, we randomly select 36 high school males and 36 high school females.

For the males, the mean was 91 with standard deviation 20. For the females, the mean was 116 with standard deviation 35.

Explanation:

Ho: Mm - Mf = 0

Ha: Mm - Mf < 0

Since the sample sizes are large (bigger than 30) we know the sampling distribution of the difference in sample means will be approximately normal.

Mu of xbarm - xbarf = 0 (since we assume Mm - Mf = 0)

Standard Error: sqrt(20^2/36 + 35^2/36) = 6.72

Statistic = xbarm - xbarf   = 91 - 116 = -25

Since the p-value for the test is .0003 which is less than .10, we reject Ho and obtain evidence that high school males do send less texts per week than high school females.

Project 42: Variables 'data1', 'data2', and 'haDirection' have been initialized.  There are also working methods called tcdf and invT.

data1 is the dataset for the first group

data2 is the dataset for the second group

haDirection represents the direction of the alternative hypothesis: 1 for <, 2 for >, and 3 for ≠  (1 for the example given)

tcdf(lower, upper, df) represents the area (proportion) under the t-distribution curve with df degrees of freedom from lower to upper.

Example: tcdf(0,1,10) = .3295

invT(area, df) represents the t-score with left-tail area given and df degrees of freedom.

Example: invT(.6, 20) = .257 because tcdf(-100, .257, 20) is .6

Task: appropriately initialize the values for 't', 'df' and 'pValue' which represent the test statistic (t-score), the degrees of freedom, and the p-value for the two-sample t-test.

Note: the degrees of freedom used is the conservative degrees of freedom (smaller n - 1)

**If your code works for 5 test cases, you can enter your e-mail address

Universal Computational Math Methods:

pow(5,2) returns 25.0

abs(-3.0) returns 3

sqrt(49.0) returns 7.0