From dd30f07ea102a46c0d440b2e0d2dd7d5bfd440fb Mon Sep 17 00:00:00 2001 From: andyeisenberg Date: Wed, 18 Mar 2026 22:18:53 -0400 Subject: [PATCH] Sectioning Ch 5 --- source/ch-Hypothesis-Testing.ptx | 327 +------------------------------ source/sec-Chi-Squared.ptx | 104 ++++++++++ source/sec-One-Sample-Tests.ptx | 231 ++++++++++++++++++++++ source/sec-Power.ptx | 88 +++++++++ source/sec-Two-Sample-Tests.ptx | 32 +++ 5 files changed, 461 insertions(+), 321 deletions(-) create mode 100644 source/sec-Chi-Squared.ptx create mode 100644 source/sec-One-Sample-Tests.ptx create mode 100644 source/sec-Power.ptx create mode 100644 source/sec-Two-Sample-Tests.ptx diff --git a/source/ch-Hypothesis-Testing.ptx b/source/ch-Hypothesis-Testing.ptx index 9acc1de..959a562 100644 --- a/source/ch-Hypothesis-Testing.ptx +++ b/source/ch-Hypothesis-Testing.ptx @@ -9,327 +9,12 @@

-
- One Sample Tests + + + + -

- Text of section. -

+ - - - -

- In each of the following scenarios, determine whether we should use a 1-tailed test or a 2-tailed test. -

-
- - - - -

- We have a coin which we've flipped many times, seeing an above-average number of heads. - We suspect the coin comes up heads more often than a fair coin would. -

-
-
- - - - -

- We find a coin on the street and wonder whether or not it's a fair coin. -

-
-
- - - - -

- We suspect there will be a difference in average weight of mice caught during the summer versus during the winter. -

-
-
- - - - -

- In a medical study, a group of patients are gathered and the proportion experiencing particular symptoms is measured. - A new drug intended to eliminate these symptoms is administered, after which the proportion experiencing symptoms is measured again. -

-
-
-
- - - -

- Suppose we find a coin and wonder whether it's fair. - As a first test, we decide to flip the coin 200 times and count the number of heads. - If we see 112 heads, should we accept or reject the null hypothesis of a fair coin at a significance level of 0.05? -

-
-
- - - -

- Suppose we have a coin which we suspect comes up heads more often than a fair coin would. - As a first test, we decide to flip the coin 200 times and count the number of heads. - If we see 112 heads, should we accept or reject the null hypothesis of a fair coin at a significance level of 0.05? -

-
-
- - - -

- Suppose we find a six-sided die and wonder whether it's fair. - As a first test, we decide to roll the die 100 times and count the number of times it comes up 1. - If we roll 22 1's, should we accept or reject the null hypothesis of a fair die at a significance level of 0.05? -

-
-
- - - -

- Suppose a particular plant when grown outdoors has an average height of 39 in with a variance of 20 in^2. - We suspect that growing this plant in a greenhouse will increase its height. - A sample of 50 plants grown in a greenhouse has an average height of 40 in. - Is this significant enough data to reject the null hypothesis of equal means at the p = 0.05 significance level? -

-
-
-
-
- -
- Two Sample Tests - -

- Text of section. -

- - - - -

- A farmer is testing an experimental new plant fertilizer that is supposed to increase the weight of a particular apple variety. - A control sample of 25 apples grown using the usual fertilizer have a mean weight of 75 grams and a sample variance of 90 grams^2 (for an individual apple). - An experimental sample of 25 apples grown using the new fertilizer have a mean weight of 79 grams and a sample variance of 90 grams^2. -

-
-
- - - -

- We have an established factory which produces coins that are close to fair. - We're opening up a second factory, and we'd like to ensure the machines are calibrated to produce coins which behave similarly to the ones produced in the established factory. - We pick one sample coin from each factory, and flip each sample coin 100 times. - The coin from the established factory flips 52 heads in 100 flips. - The coin from the new factory flips 62 heads in 100 flips. - Is this strong enough evidence to reject the null hypothesis that the two factories produce similar coins at a 0.05 significance level? -

-
-
-
-
- -
- Power of a Test - -

- Text of section. -

- - - - -

- Suppose we find a coin and wonder whether it's fair. - As a first test, we decide to flip the coin 200 times and count the number of heads, S. - What values of S would be extreme enough to reject the null hypothesis of a fair coin? If the coin actually has a 0.6 probability of coming up heads, what is the power of this test? -

-
-
- - - -

- Suppose we have a coin which we suspect comes up heads more often than a fair coin would. - As a first test, we decide to flip the coin 200 times and count the number of heads, S. - What values of S would be extreme enough to reject the null hypothesis of a fair coin? If the coin actually has a 0.6 probability of coming up heads, what is the power of this test? -

-
-
- - - -

- Suppose we find a six-sided die and wonder whether it's fair. - As a first test, we decide to roll the die 100 times and count the number of times it comes up 1. - The expected number of 1's is 50/3, with a variance of 125/9. -

-
- - - - -

- Using a normal approximation, what is the smallest number of 1's greater than 50/3 that would be extreme enough to reject the null hypothesis of a fair die? -

-
-
- - - - -

- Using a normal approximation, what is the greatest number of 1's less than 50/3 that would be extreme enough to reject the null hypothesis of a fair die? -

-
-
- - - - -

- Suppose that this die is weighted so that it rolls a 1 with probability 0.2. - What would be the power of our test? -

-
-
- - - - -

- Suppose we roll the die 100 times and see 23 1's. - Use the maximum likelihood value for the probability of rolling a 1 to calculate the power of the test. -

-
-
-
- - - -

- Suppose a particular plant when grown outdoors has an average height of 39 in with a variance of 20 in^2. - We suspect that growing this plant in a greenhouse will increase its height. - We take the average height of a sample of 50 plants grown in a greenhouse. - What is the minimum average height of this sample that would be extreme enough to reject the null hypothesis of equal means at the p = 0.05 significance level? If the plants, when grown in a greenhouse, would truly have an average height of 41 in, what is the power of our test? -

-
-
-
-
- -
- <m>\chi^2</m> Test - -

- Text of section. -

- - - - -

- A store owner wants to determine how much shelf space to allocate to each of the drinks that they sell. - They survey their customers about their favorite drinks. - Is the data below consistent with the null hypothesis that each type of drink will be equally preferred? -

- - - - - - - drink type - water - soda - tea - coffee - energy drinks - - - - favorite - 28 - 17 - 15 - 26 - 14 - - -
-
-
- - - -

- A particular drug is administered in 100 independent trials. - In each trial, the drug is administered to four people, and we count how many respond to the drug. - The table below shows how many trials have each different count of people who respond to the drug. -

- - - - - - - # who respond to drug - 0 - 1 - 2 - 3 - 4 - - - - # of trials - 3 - 11 - 31 - 34 - 21 - - -
-
- - - - -

- Is the data consistent with a binomial distribution with parameter p = 0.7? -

-
-
- - - - -

- What is the total number of people who have been administered the drug? What is the total number who have responded to it? What is the maximum likelihood estimation for the probability p that a person will respond to the drug? -

-
-
- - - - -

- Is the data consistent with a binomial distribution with the MLE value of p? -

-
-
-
-
-
+ \ No newline at end of file diff --git a/source/sec-Chi-Squared.ptx b/source/sec-Chi-Squared.ptx new file mode 100644 index 0000000..271fa1d --- /dev/null +++ b/source/sec-Chi-Squared.ptx @@ -0,0 +1,104 @@ +
+ <m>\chi^2</m> Test + +

+ Text of section. +

+ + + + +

+ A store owner wants to determine how much shelf space to allocate to each of the drinks that they sell. + They survey their customers about their favorite drinks. + Is the data below consistent with the null hypothesis that each type of drink will be equally preferred? +

+ + + + + + + drink type + water + soda + tea + coffee + energy drinks + + + + favorite + 28 + 17 + 15 + 26 + 14 + + +
+
+
+ + + +

+ A particular drug is administered in 100 independent trials. + In each trial, the drug is administered to four people, and we count how many respond to the drug. + The table below shows how many trials have each different count of people who respond to the drug. +

+ + + + + + + # who respond to drug + 0 + 1 + 2 + 3 + 4 + + + + # of trials + 3 + 11 + 31 + 34 + 21 + + +
+
+ + + + +

+ Is the data consistent with a binomial distribution with parameter p = 0.7? +

+
+
+ + + + +

+ What is the total number of people who have been administered the drug? What is the total number who have responded to it? What is the maximum likelihood estimation for the probability p that a person will respond to the drug? +

+
+
+ + + + +

+ Is the data consistent with a binomial distribution with the MLE value of p? +

+
+
+
+
+
\ No newline at end of file diff --git a/source/sec-One-Sample-Tests.ptx b/source/sec-One-Sample-Tests.ptx new file mode 100644 index 0000000..5d2b678 --- /dev/null +++ b/source/sec-One-Sample-Tests.ptx @@ -0,0 +1,231 @@ +
+ One Sample Tests + + + +

+ Suppose 10% of the general population is left-handed. + In a sample of 100 patients with carpal tunnel syndrome, 16 are found to be left-handed. + Is this evidence that the proportion of left-handedness is higher among carpal tunnel syndrome patients than among the general population? +

+
+
+ +

+ We would like to develop a framework through which we can analyze whether data we've collected provides evidence for a particular hypothesis. + In fact, we will generally consider two hypotheses: +

+ + + +

+ The null hypothesis, often denoted H_0, is the assumption that an effect being studied or proposed does not exist. + The alternative hypothesis, H_a, is the claim that the effect does exist. +

+
+
+ +

+ In the previous example, if we write \theta for the true proportion of left-handed people among the population with carpal tunnel syndrome, the null hypothesis would be that this proportion is the same as the general population. + The alternative hypothesis might be, for example, that the proportion is higher than among the general population: + + H_0: \theta \amp = 0.1 + H_a: \theta \amp \gt 0.1 + +

+ +

+ After performing an experiment, we will either accept or reject the null hypothesis based on the data we collect. + Consider the following scenarios: +

+ + + + + accept H_0 + reject H_0 + + + + H_0 true + correct + type I error + + + + H_0 false + type II error + correct + + + +

+ We'll use the notation \alpha for the probability of making a type I error, also called the significance level, and \beta for the probability of making a type II error. + The power of a test is the probability of correctly rejecting H_0, i.e., 1 - \beta. +

+ + + +

+ The p-value is the probability of observing a result at least as extreme as measured if H_0 is true. +

+
+
+ + + +

+ Continuing the previous example, under H_0 that \theta = 0.1, the probability of seeing at least 16 left-handed people in a sample of 100 people would be: + + \sum_{k = 16}^{100} {100 \choose k} (0.1)^k (1 - 0.1)^{100 - k} \approx 0.04, + + which is our p-value. +

+
+
+ +

+ The goal of our calculation is to control the chance of making a type I error by choosing a significance level cutoff, often 0.05. + If our calculated p-value is below the cutoff, then reject H_0. + Otherwise, accept H_0. + In the previous example, we would reject H_0, because it appears that the data we collected is pretty unlikely to see if the null hypothesis were true. + We would accept that, about 4% of the time if the null hypothesis is true, we would see data at least this extreme, and therefore make a mistake by rejecting H_0. +

+ +

+ The test we just applied is called 1-tailed. + The alternative hypothesis \theta \gt 0.1 proposed that \theta was different from 0.1 in a specific direction. + For a 2-tailed test, we could use the alternative hypothesis that \theta \neq 0.1. + In this setting, the idea of data "at least as extreme" as what was measured is reframed. + We measured 16 left-handed people in a sample of 100, which is 6 more than we would expect under the null hypothesis. + So we should also include the possibility of seeing at least 6 fewer left-handed people in the sample than expected: + + p\text{-value} \amp = \Pr(\geq 16 \text{ left-handed people}) + \Pr(\leq 4 \text{ left-handed people}) + \amp = \left(\sum_{k = 16}^{100} {100 \choose k} (0.1)^k (0.9)^{100 - k}\right) + \left(\sum_{k = 0}^{4} {100 \choose k} (0.1)^k (0.9)^{100 - k}\right) + \amp \approx 0.064 \gt 0.05, + + so, using a 2-tailed test, we would fail to reject the null hypothesis. +

+ +

+ In suitable situations, we can also use a normal approximation via to calculate the p-value. +

+ + + +

+ We find a coin on the street and wonder if it's a fair coin. + We flip it 100 times and see 62 heads. + Is this strong evidence to reject the null hypothesis of a fair coin at a 0.05 significance level? +

+ +

+ Let S be the random variable which counts the number of heads in 100 flips. + The null hypothesis H_0 of a fair coin would mean the parameter \theta = \Pr(\text{heads}) = 0.5. + (We'll avoid the letter p for the parameter to prevent confusion with the new term, p-value.) So: + + \E(S) \amp = n\theta = 100(0.5) = 50 + \Var(S) \amp = n\theta(1-\theta) = 100(0.5)(0.5) = 25 + + Then, by , S \approx \Norm(50, 25). + So, using a 2-tailed test, the p-value is: + + \Pr(S \geq 62) + \Pr(S \leq 38) \amp \approx \Pr\left(Z \geq \frac{61.5 - 50}{\sqrt{25}}\right) + \Pr\left(Z \leq \frac{38.5 - 50}{\sqrt{25}}\right) + \amp = (1 - \Phi(2.3)) + \Phi(-2.3) + \amp \approx (1 - 0.9893) + 0.0107 + \amp = 0.0214 \lt 0.05, + + so this is strong enough evidence to reject H_0. +

+
+
+ + + + +

+ In each of the following scenarios, determine whether we should use a 1-tailed test or a 2-tailed test. +

+
+ + + + +

+ We have a coin which we've flipped many times, seeing an above-average number of heads. + We suspect the coin comes up heads more often than a fair coin would. +

+
+
+ + + + +

+ We find a coin on the street and wonder whether or not it's a fair coin. +

+
+
+ + + + +

+ We suspect there will be a difference in average weight of mice caught during the summer versus during the winter. +

+
+
+ + + + +

+ In a medical study, a group of patients are gathered and the proportion experiencing particular symptoms is measured. + A new drug intended to eliminate these symptoms is administered, after which the proportion experiencing symptoms is measured again. +

+
+
+
+ + + +

+ Suppose we find a coin and wonder whether it's fair. + As a first test, we decide to flip the coin 200 times and count the number of heads. + If we see 112 heads, should we accept or reject the null hypothesis of a fair coin at a significance level of 0.05? +

+
+
+ + + +

+ Suppose we have a coin which we suspect comes up heads more often than a fair coin would. + As a first test, we decide to flip the coin 200 times and count the number of heads. + If we see 112 heads, should we accept or reject the null hypothesis of a fair coin at a significance level of 0.05? +

+
+
+ + + +

+ Suppose we find a six-sided die and wonder whether it's fair. + As a first test, we decide to roll the die 100 times and count the number of times it comes up 1. + If we roll 22 1's, should we accept or reject the null hypothesis of a fair die at a significance level of 0.05? +

+
+
+ + + +

+ Suppose a particular plant when grown outdoors has an average height of 39 in with a variance of 20 in^2. + We suspect that growing this plant in a greenhouse will increase its height. + A sample of 50 plants grown in a greenhouse has an average height of 40 in. + Is this significant enough data to reject the null hypothesis of equal means at the p = 0.05 significance level? +

+
+
+
+
\ No newline at end of file diff --git a/source/sec-Power.ptx b/source/sec-Power.ptx new file mode 100644 index 0000000..ab0af33 --- /dev/null +++ b/source/sec-Power.ptx @@ -0,0 +1,88 @@ +
+ Power of a Test + +

+ Text of section. +

+ + + + +

+ Suppose we find a coin and wonder whether it's fair. + As a first test, we decide to flip the coin 200 times and count the number of heads, S. + What values of S would be extreme enough to reject the null hypothesis of a fair coin? If the coin actually has a 0.6 probability of coming up heads, what is the power of this test? +

+
+
+ + + +

+ Suppose we have a coin which we suspect comes up heads more often than a fair coin would. + As a first test, we decide to flip the coin 200 times and count the number of heads, S. + What values of S would be extreme enough to reject the null hypothesis of a fair coin? If the coin actually has a 0.6 probability of coming up heads, what is the power of this test? +

+
+
+ + + +

+ Suppose we find a six-sided die and wonder whether it's fair. + As a first test, we decide to roll the die 100 times and count the number of times it comes up 1. + The expected number of 1's is 50/3, with a variance of 125/9. +

+
+ + + + +

+ Using a normal approximation, what is the smallest number of 1's greater than 50/3 that would be extreme enough to reject the null hypothesis of a fair die? +

+
+
+ + + + +

+ Using a normal approximation, what is the greatest number of 1's less than 50/3 that would be extreme enough to reject the null hypothesis of a fair die? +

+
+
+ + + + +

+ Suppose that this die is weighted so that it rolls a 1 with probability 0.2. + What would be the power of our test? +

+
+
+ + + + +

+ Suppose we roll the die 100 times and see 23 1's. + Use the maximum likelihood value for the probability of rolling a 1 to calculate the power of the test. +

+
+
+
+ + + +

+ Suppose a particular plant when grown outdoors has an average height of 39 in with a variance of 20 in^2. + We suspect that growing this plant in a greenhouse will increase its height. + We take the average height of a sample of 50 plants grown in a greenhouse. + What is the minimum average height of this sample that would be extreme enough to reject the null hypothesis of equal means at the p = 0.05 significance level? If the plants, when grown in a greenhouse, would truly have an average height of 41 in, what is the power of our test? +

+
+
+
+
\ No newline at end of file diff --git a/source/sec-Two-Sample-Tests.ptx b/source/sec-Two-Sample-Tests.ptx new file mode 100644 index 0000000..badb7cc --- /dev/null +++ b/source/sec-Two-Sample-Tests.ptx @@ -0,0 +1,32 @@ +
+ Two Sample Tests + +

+ Text of section. +

+ + + + +

+ A farmer is testing an experimental new plant fertilizer that is supposed to increase the weight of a particular apple variety. + A control sample of 25 apples grown using the usual fertilizer have a mean weight of 75 grams and a sample variance of 90 grams^2 (for an individual apple). + An experimental sample of 25 apples grown using the new fertilizer have a mean weight of 79 grams and a sample variance of 90 grams^2. +

+
+
+ + + +

+ We have an established factory which produces coins that are close to fair. + We're opening up a second factory, and we'd like to ensure the machines are calibrated to produce coins which behave similarly to the ones produced in the established factory. + We pick one sample coin from each factory, and flip each sample coin 100 times. + The coin from the established factory flips 52 heads in 100 flips. + The coin from the new factory flips 62 heads in 100 flips. + Is this strong enough evidence to reject the null hypothesis that the two factories produce similar coins at a 0.05 significance level? +

+
+
+
+
\ No newline at end of file