To Notes

IT 223 -- Mar 2, 2026

Review Exercises

  1. Look at the formulas in the Final Exam Review Guide.
  2. What is the difference between these three function calls?
    rbinom(20, 1, 0.25)  rbinom(1, 20, 0.25)  rbinom(20, 20, 0.25)
    
    Answer: the three parameters to rbinom represent (1) the number of binomial experiments to simulate, (2) the number of trials in one binomial simulation, and (3) the probability of success in one trial. Here are the results:
    # Simulate 20 experiments with one trial each:
    rbinom(20, 1, 0.25)
    [1] 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0
    # Simulate one experiment with 20 trials:
    # rbinom(1, 20, 0.25)
    [1] 8
    # Simulate 20 experiments with 20 trials each:
    # rbinom(20, 20, 0.25)
    [1] 2 8 2 7 9 2 3 6 5 5 4 5 4 6 3 4 5 5 5 4
    
  3. What are the five steps for performing a z-test?
    1. State the null and alternative hypotheses.
    2. Compute the test statistic z.
    3. Find a 95% confidence interval I = (-2, 2) (or more precisely I = (-1.96, 1.96).
    4. If z ∈ I, accept the null hypothesis, if z ∉ i, reject the null hypothesis.
    5. Compute the p-value.
  4. What is the p-value for a statistical test?
    Answer: the p-value is the probability of obtaining a test statistic as extreme or more extreme that the one actually obtained, given that the null hypothesis is true.
  5. A lightbulb manufacturer claims its bulbs last 1,000 hours. A consumer group tests 40 bulbs and finds an average lifespan of 980 hours with SD+ = 50 hours. Test the claim with a z-test at a 5% significance level. Answer: here are the steps of the t-test:
    1. H0: x = 1000    H1: x ≠ 1,000
    2. z = (x / (SD+x / √n) = (980 - 1000) / (50 / √40)  = -2.53
    3. Confidence interval is I = (-2, 2)
    4. z ∉ I, so reject the null hypothesis.
    5. p-value is 0.018, which is < 0.05, which is another way to see that the null hypothesis should be rejected.
  6. The examTimes vector is defined by this R statement:
    examTimes <- c(18, 160, 234, 149, 145, 107, 
        197,  75, 201, 225, 211, 119, 157, 145, 
        107, 244, 163, 114, 145,  68, 111, 185, 
        202, 146, 203, 224, 213, 104, 178, 166)
    
    These are the times in minutes for students in a statistics class to complete the class final exam. Use the R function t.test to test the null hypotheses that the true average time for a typical student to take the exam is 175 minutes. Perform the test at these significance levels: 0.05, 0.01, 0.10.

    Note: R does not have a function that specifically performs z-tests. Use the t.test function instead. A z-test and a t-test use exactly the same test statistic:
    t = z = (x - μ) / (sx/√n)
    The advantage of the t-test is that it works for any sample size, including that when n < 30. However, for smaller values of n, a wider confidence interval is used, computed with the t-distribution instead of the normal distribution. We will discuss t-tests later today.

    Answer:
    > t.test(exam_scores, mu=175, conf.level=0.95)
    
            One Sample t-test
    
    data:  exam_scores
    t = -1.7956, df = 29, p-value = 0.08298
    alternative hypothesis: true mean is not equal to 175
    95 percent confidence interval:
     136.9259 177.4741
    sample estimates:
    mean of x 
        157.2 
    

Test of Hypothesis for a Proportion

The t-test

Degrees of Freedom