Project 44: Two Sample T Interval

Intro Problem: We want to estimate the difference in mean mile times between NFL lineman and NFL defensive backs at the 96% confidence level.

We randomly sample 25 NFL lineman and 25 NFL defensive backs and record their mile run times.  The mean and standard deviation of the 25 lineman was 430 seconds and 85 seconds, respectively.

The mean and standard deviation of the 25 defensive backs was 310 seconds and 60 seconds, respectively.

Explanation:  Assuming both samples of miles times were fairly symmetrical, we can assume the sampling distribution of the difference in sample means is approximately normal. 

Standard Error = sqrt(85^2/25 + 60^2/25) = 20.81

Critical Value = 2.06   (The T value with left-tail area .975 to contain the middle 95% with 24 degrees of freedom)

Margin of Error = 2.06*20.81 = 42.87

Statistic = xbarL - xbarDB = 430 - 310 = 120

Confidence Interval: 120 ± 42.87 = [77.13, 162.87]

We are 90% confident that the true difference in mean mile times between NFL lineman and NFL defensive backs is between 77.13 and 162.87 seconds.

Project 44: Variables 'data1', 'data2', and 'confidenceLevel' have been initialized.  There are also working methods called getMean, getSD, tcdf, and invT.

data is the sample dataset.

confidenceLevel is how confident we want to be in our interval (.9 in the example above)

Note: confidence level is a number between 0 and 1 (proportion) not 0 and 100 (percentage)

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

getMean(data) returns the mean (average of the dataset)

getSD(data) returns the standard deviation of the dataset.

Task: Appropriately initialize the values 'lower' and 'upper' which represent the lower and upper bound for the confidence interval given.

**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