Project 41: One-Sample T Test

Intro Problem: Suppose we want to test the hypothesis that the mean number of miles on student vehicles in the student parking lot is greater than 100,000.  We randomly select 36 vehicles from the parking lot and record the number of miles driven on the vehicles.  We obtain a mean of 102,334 miles and standard deviation 14,129 miles.

Explanation:

Ho: μ = 100,000

Ha: μ >100,000

Since the sample size is large (above 30) we know the sampling distribution of sample means is approximately normal.  The mean of the sampling distribution (assuming Ho is true) is 100,000 and our estimate for the standard deviation of the sampling distribution (the standard error) is 14,129/sqrt(36) = 2354.83 

Since the p-value of .164 is greater than .05, we would fail to reject Ho.  We do not find convincing evidence that the true mean number of miles traveled for all student cars in the student parking lot is greater than 100,000.  This is because it is reasonable that we obtained our statistic based on random chance since we would observe sample means as high or higher than 102,334 about 16% of the time even if the true mean was really 100,000.

Project 41: The variables 'data', 'muHo', and 'haDirection' are initialized.  There are also working methods called getMean, getSD, tcdf and invT.

data is the sample data gathered.

muHo represents the hypothesized mean for Ho (100,00 in the example given)

haDirection represents the direction of the alternative hypothesis.  1 for <, 2 for >, and 3 for

haDirection is 2 in the example given

getMean(x) returns the average of the dataset x

getSD(x) returns the standards deviation of the dataset 'x'

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 one sample t-test.

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