Statistics 1 for Economics - Proportions and Hypothesis Testing Introduction to Statistical Variables Population vs. Sample : Statistics involves making inferences about a larger population based on data collected from a sample.Quantitative Variables : Variables that measure a numerical quantity. Examples include:How many hours of sleep do you get? How often do you get up during the night? How high is the blood pressure measured in numerical values? Mean number of hours that adolescents sleep per 24 24 24 \ hours. Nominal Variables : Categorical variables represented by qualitative descriptions, often resulting in "yes/no" responses. Examples include:Do you use painkillers or sleeping tablets? Do you usually dream about school? Did you see a scary movie before you went to bed? Hypothesis Testing for Proportions (Normal Approximation) Assumptions and Conditions : For a large-sample test of a population proportion p p p using the Normal distribution, the following must be met:A random sample must be used. n p 0 ≥ 5 np_0 \geq 5 n p 0 ≥ 5 n ( 1 − p 0 ) ≥ 5 n(1 - p_0) \geq 5 n ( 1 − p 0 ) ≥ 5 Null and Alternative Hypotheses :H 0 : p = p 0 H_0: p = p_0 H 0 : p = p 0 (The null hypothesis, representing no change or a specific status quo).H 1 : p > p 0 H_1: p > p_0 H 1 : p > p 0 , H 1 : p < p 0 H_1: p < p_0 H 1 : p < p 0 , or H 1 : p ≠ p 0 H_1: p \neq p_0 H 1 : p = p 0 (The research or alternative hypothesis).Test Statistic : The standardized distance between the sample proportion and the hypothesized proportion:Z = p ^ − p 0 p 0 ( 1 − p 0 ) n Z = \frac{\hat{p} - p_0}{\sqrt{\frac{p_0(1 - p_0)}{n}}} Z = n p 0 ( 1 − p 0 ) p ^ − p 0 Distribution: Z ∼ N ( 0 , 1 ) Z \sim N(0, 1) Z ∼ N ( 0 , 1 ) . Case Study: Question 1 (RTVL Market Share) :Scenario: An advertiser buys time if RTVL's market share is greater than 5 % 5\% 5% . Data: n = 500 n = 500 n = 500 , p ^ = 6.2 % = 0.062 \hat{p} = 6.2\% = 0.062 p ^ = 6.2% = 0.062 , α = 1 % \alpha = 1\% α = 1% . Check Conditions: n p 0 = 500 × 0.05 = 25 ≥ 5 np_0 = 500 \times 0.05 = 25 \geq 5 n p 0 = 500 × 0.05 = 25 ≥ 5 n ( 1 − p 0 ) = 500 × 0.95 = 475 ≥ 5 n(1 - p_0) = 500 \times 0.95 = 475 \geq 5 n ( 1 − p 0 ) = 500 × 0.95 = 475 ≥ 5 Hypotheses: H 0 : p = 0.05 H_0: p = 0.05 H 0 : p = 0.05 vs. H 1 : p > 0.05 H_1: p > 0.05 H 1 : p > 0.05 . Rejection Region: At α = 1 % \alpha = 1\% α = 1% , reject H 0 H_0 H 0 if Z ≥ z c r i t = 2.33 Z \geq z_{crit} = 2.33 Z ≥ z cr i t = 2.33 . Sample Realization:z o b s = 0.062 − 0.05 0.05 × 0.95 500 = 1.23 z_{obs} = \frac{0.062 - 0.05}{\sqrt{\frac{0.05 \times 0.95}{500}}} = 1.23 z o b s = 500 0.05 × 0.95 0.062 − 0.05 = 1.23 Decision: Since z o b s < z c r i t z_{obs} < z_{crit} z o b s < z cr i t (1.23 < 2.33 1.23 < 2.33 1.23 < 2.33 ), do not reject H 0 H_0 H 0 . Conclusion: At a significance level of 1 % 1\% 1% , there is insufficient evidence to infer that the market share is more than 5 % 5\% 5% .\n The p-value and Power of the Test p-value Definition : The probability of obtaining evidence at least as strong as the observed sample, assuming the null hypothesis is true.Calculation for Question 1: p -value = P ( Z ≥ z o b s ) = P ( Z ≥ 1.23 ) = 1 − 0.8907 = 0.1093 p\text{-value} = P(Z \geq z_{obs}) = P(Z \geq 1.23) = 1 - 0.8907 = 0.1093 p -value = P ( Z ≥ z o b s ) = P ( Z ≥ 1.23 ) = 1 − 0.8907 = 0.1093 . Power of the Test : The probability of correctly rejecting the null hypothesis when it is false (P ( reject H 0 ∣ H 0 is false ) P(\text{reject } H_0 \mid H_0 \text{ is false}) P ( reject H 0 ∣ H 0 is false ) ).Calculating Power (Example Q3) :Target: Find power if true p = 0.09 p = 0.09 p = 0.09 for the RTVL test at α = 1 % \alpha = 1\% α = 1% . Step 1: Find the critical sample proportion (p ^ c r i t \hat{p}_{crit} p ^ cr i t ) necessary to reject H 0 H_0 H 0 :p ^ c r i t = p 0 + z c r i t × p 0 ( 1 − p 0 ) n \hat{p}_{crit} = p_0 + z_{crit} \times \sqrt{\frac{p_0(1 - p_0)}{n}} p ^ cr i t = p 0 + z cr i t × n p 0 ( 1 − p 0 ) p ^ c r i t = 0.05 + 2.33 × 0.05 × 0.95 500 = 0.0727 \hat{p}_{crit} = 0.05 + 2.33 \times \sqrt{\frac{0.05 \times 0.95}{500}} = 0.0727 p ^ cr i t = 0.05 + 2.33 × 500 0.05 × 0.95 = 0.0727 Step 2: Calculate the probability of observing p ^ ≥ 0.0727 \hat{p} \geq 0.0727 p ^ ≥ 0.0727 given the new population proportion p = 0.09 p = 0.09 p = 0.09 :Z = 0.0727 − 0.09 0.09 × ( 1 − 0.09 ) 500 = − 1.35 Z = \frac{0.0727 - 0.09}{\sqrt{\frac{0.09 \times (1 - 0.09)}{500}} } = -1.35 Z = 500 0.09 × ( 1 − 0.09 ) 0.0727 − 0.09 = − 1.35 Power = P ( Z ≥ − 1.35 ) = 0.9115 \text{Power} = P(Z \geq -1.35) = 0.9115 Power = P ( Z ≥ − 1.35 ) = 0.9115 . Distributions and Test Statistics Counts (X) :X ∼ B i n o m i a l ( n , p ) X \sim Binomial(n, p) X ∼ B in o mia l ( n , p ) .Mean: μ = E ( X ) = n p \mu = E(X) = np μ = E ( X ) = n p . Variance: σ 2 = V ( X ) = n p ( 1 − p ) \sigma^2 = V(X) = np(1 - p) σ 2 = V ( X ) = n p ( 1 − p ) . Standardization: Z = X − n p n p ( 1 − p ) ∼ N ( 0 , 1 ) Z = \frac{X - np}{\sqrt{np(1 - p)}} \sim N(0, 1) Z = n p ( 1 − p ) X − n p ∼ N ( 0 , 1 ) . Proportions (\hat{p}) :Sample proportion p ^ = X n \hat{p} = \frac{X}{n} p ^ = n X . Expected Value: E ( p ^ ) = p E(\hat{p}) = p E ( p ^ ) = p . Variance: V ( p ^ ) = p ( 1 − p ) n V(\hat{p}) = \frac{p(1 - p)}{n} V ( p ^ ) = n p ( 1 − p ) . Standardization: Z = p ^ − p p ( 1 − p ) n ∼ N ( 0 , 1 ) Z = \frac{\hat{p} - p}{\sqrt{\frac{p(1 - p)}{n}}} \sim N(0, 1) Z = n p ( 1 − p ) p ^ − p ∼ N ( 0 , 1 ) . Confidence and Prediction Intervals Confidence Interval (CI) : Used to estimate the unknown population parameter p p p .Formula: p = p ^ ± z α / 2 × p ^ ( 1 − p ^ ) n p = \hat{p} \pm z_{\alpha/2} \times \sqrt{\frac{\hat{p}(1 - \hat{p})}{n}} p = p ^ ± z α /2 × n p ^ ( 1 − p ^ ) Example (NOB Market Share): n = 500 n = 500 n = 500 , p ^ = 0.332 \hat{p} = 0.332 p ^ = 0.332 , Confidence Level = 90 % 90\% 90% . Calculation: α = 10 % ⟹ α / 2 = 0.05 ⟹ z 0.05 = 1.645 \alpha = 10\% \implies \alpha/2 = 0.05 \implies z_{0.05} = 1.645 α = 10% ⟹ α /2 = 0.05 ⟹ z 0.05 = 1.645 . Margin of Error = 1.645 × 0.332 × 0.668 500 = 0.035 \text{Margin of Error} = 1.645 \times \sqrt{\frac{0.332 \times 0.668}{500}} = 0.035 Margin of Error = 1.645 × 500 0.332 × 0.668 = 0.035 .Interval: 0.332 ± 0.035 ⟹ [ 0.297 < p < 0.367 ] 0.332 \pm 0.035 \implies [0.297 < p < 0.367] 0.332 ± 0.035 ⟹ [ 0.297 < p < 0.367 ] . Width of the interval: 2 × margin = 2 × 0.035 = 0.070 2 \times \text{margin} = 2 \times 0.035 = 0.070 2 × margin = 2 × 0.035 = 0.070 (or 7.0 % 7.0\% 7.0% ). Prediction Interval : Used to determine the range in which a future sample proportion p ^ \hat{p} p ^ is expected to fall based on a known population parameter p p p .Formula: p ^ = p ± z α / 2 × p ( 1 − p ) n \hat{p} = p \pm z_{\alpha/2} \times \sqrt{\frac{p(1 - p)}{n}} p ^ = p ± z α /2 × n p ( 1 − p ) Example (Lock-down Support): Known p = 0.62 p = 0.62 p = 0.62 , n = 100 n = 100 n = 100 , 90 % 90\% 90% \ probability. p ^ = 0.62 ± 1.645 × 0.62 × 0.38 100 = 0.62 ± 0.08 \hat{p} = 0.62 \pm 1.645 \times \sqrt{\frac{0.62 \times 0.38}{100}} = 0.62 \pm 0.08 p ^ = 0.62 ± 1.645 × 100 0.62 × 0.38 = 0.62 ± 0.08 .Range: [ 0.54 < p ^ < 0.70 ] [0.54 < \hat{p} < 0.70] [ 0.54 < p ^ < 0.70 ] . Sample Size Determination Objective : Find the minimum sample size n n n to achieve a specific margin of error (B B B ) or bound.Derivation :z α / 2 × p ^ ( 1 − p ^ ) n ≤ B z_{\alpha/2} \times \sqrt{\frac{\hat{p}(1 - \hat{p})}{n}} \leq B z α /2 × n p ^ ( 1 − p ^ ) ≤ B n ≥ z α / 2 2 × p ^ ( 1 − p ^ ) B 2 n \geq \frac{z_{\alpha/2}^2 \times \hat{p}(1 - \hat{p})}{B^2} n ≥ B 2 z α /2 2 × p ^ ( 1 − p ^ ) Case 1: Available Estimate : If a previous sample proportion p ^ \hat{p} p ^ exists (e.g., 0.332 0.332 0.332 ), use it in the formula.Example: n ≥ 1.645 2 × 0.332 × 0.668 0.01 2 = 6001.3 ⟹ n ≥ 6002 n \geq \frac{1.645^2 \times 0.332 \times 0.668}{0.01^2} = 6001.3 \implies n \geq 6002 n ≥ 0.0 1 2 1.64 5 2 × 0.332 × 0.668 = 6001.3 ⟹ n ≥ 6002 . Case 2: No Information (Conservative Approach) : If p ^ \hat{p} p ^ is unknown, use p ^ = 0.50 \hat{p} = 0.50 p ^ = 0.50 to maximize the required n n n because the product p ^ ( 1 − p ^ ) \hat{p}(1 - \hat{p}) p ^ ( 1 − p ^ ) is largest at 0.5 0.5 0.5 .p ^ = 0.50 ⟹ p ^ ( 1 − p ^ ) = 0.25 \hat{p} = 0.50 \implies \hat{p}(1 - \hat{p}) = 0.25 p ^ = 0.50 ⟹ p ^ ( 1 − p ^ ) = 0.25 Example: n ≥ 1.645 2 × 0.50 × 0.50 0.01 2 = 6765.06 ⟹ n ≥ 6766 n \geq \frac{1.645^2 \times 0.50 \times 0.50}{0.01^2} = 6765.06 \implies n \geq 6766 n ≥ 0.0 1 2 1.64 5 2 × 0.50 × 0.50 = 6765.06 ⟹ n ≥ 6766 . Exact Hypothesis Testing using the Binomial Distribution Conditions : Used when the normal approximation conditions fail (n p 0 < 5 np_0 < 5 n p 0 < 5 or n ( 1 − p 0 ) < 5 n(1 - p_0) < 5 n ( 1 − p 0 ) < 5 ).Procedure :Define X ∼ B i n o m i a l ( n , p 0 ) X \sim Binomial(n, p_0) X ∼ B in o mia l ( n , p 0 ) . Calculate the exact p-value using binomial probabilities. Compare p-value to α \alpha α . Example: Question 8 (Tourist Agency Loyalty) :n = 15 n = 15 n = 15 , p 0 = 0.20 p_0 = 0.20 p 0 = 0.20 , α = 5 % \alpha = 5\% α = 5% . n p 0 = 15 × 0.20 = 3 < 5 np_0 = 15 \times 0.20 = 3 < 5 n p 0 = 15 × 0.20 = 3 < 5 (Condition fails).H 0 : p = 0.20 H_0: p = 0.20 H 0 : p = 0.20 , H 1 : p > 0.20 H_1: p > 0.20 H 1 : p > 0.20 . Observed x o b s = 7 x_{obs} = 7 x o b s = 7 . p -value = P ( X ≥ 7 ) = 1 − P ( X ≤ 6 ) = 1 − 0.982 = 0.018 p\text{-value} = P(X \geq 7) = 1 - P(X \leq 6) = 1 - 0.982 = 0.018 p -value = P ( X ≥ 7 ) = 1 − P ( X ≤ 6 ) = 1 − 0.982 = 0.018 .Decision: Reject H 0 H_0 H 0 (0.018 ≤ 0.05 0.018 \leq 0.05 0.018 ≤ 0.05 ). Example: Question 9 (Statistics Course Rating) :n = 20 n = 20 n = 20 , p 0 = 0.90 p_0 = 0.90 p 0 = 0.90 , α = 5 % \alpha = 5\% α = 5% .n ( 1 − p 0 ) = 20 × 0.10 = 2 < 5 n(1 - p_0) = 20 \times 0.10 = 2 < 5 n ( 1 − p 0 ) = 20 × 0.10 = 2 < 5 (Condition fails).H 0 : p = 0.90 H_0: p = 0.90 H 0 : p = 0.90 , H 1 : p < 0.90 H_1: p < 0.90 H 1 : p < 0.90 . Observed x o b s = 17 x_{obs} = 17 x o b s = 17 .p -value = P ( X ≤ 17 ) = 0.323 p\text{-value} = P(X \leq 17) = 0.323 p -value = P ( X ≤ 17 ) = 0.323 .Decision: Do not reject H 0 H_0 H 0 (0.323 > 0.05 0.323 > 0.05 0.323 > 0.05 ). Example: Question 10a (Train Delays - Two-sided) :n = 25 n = 25 n = 25 , p 0 = 0.80 p_0 = 0.80 p 0 = 0.80 , α = 5 % \alpha = 5\% α = 5% . Observed x o b s = 16 x_{obs} = 16 x o b s = 16 .H 0 : p = 0.80 H_0: p = 0.80 H 0 : p = 0.80 , H 1 : p ≠ 0.80 H_1: p \neq 0.80 H 1 : p = 0.80 .p -value = 2 × P ( X ≤ 16 ) = 2 × 0.047 = 0.094 p\text{-value} = 2 \times P(X \leq 16) = 2 \times 0.047 = 0.094 p -value = 2 × P ( X ≤ 16 ) = 2 × 0.047 = 0.094 .Decision: Do not reject H 0 H_0 H 0 (0.094 > 0.05 0.094 > 0.05 0.094 > 0.05 ). Normal Approximation and Continuity Correction Continuity Correction (CC) : Adjusting a discrete value by 0.5 0.5 0.5 when using a continuous distribution to approximate a discrete one.Application Rules :If using Counts (X X X ) and conditions n p ≥ 5 np \geq 5 n p ≥ 5 and n ( 1 − p ) ≥ 5 n(1 - p) \geq 5 n ( 1 − p ) ≥ 5 are met: Use Normal approximation with CC.Left tail: P ( X ≤ x ) ≈ P ( X c c ≤ x + 0.5 ) P(X \leq x) \approx P(X_{cc} \leq x + 0.5) P ( X ≤ x ) ≈ P ( X cc ≤ x + 0.5 ) . Right tail: P ( X ≥ x ) ≈ P ( X c c ≥ x − 0.5 ) P(X \geq x) \approx P(X_{cc} \geq x - 0.5) P ( X ≥ x ) ≈ P ( X cc ≥ x − 0.5 ) . If using Proportions (p ^ \hat{p} p ^ ) and conditions are met: Use the normal test statistic Z Z Z without CC. If conditions are not met: Use the exact binomial test. Case Study: Question 10b (Train Delay CC Comparison) :With CC : Approximation of 2 × P ( X ≤ 16 ) 2 \times P(X \leq 16) 2 × P ( X ≤ 16 ) becomes 2 × P ( X c c ≤ 16.5 ) 2 \times P(X_{cc} \leq 16.5) 2 × P ( X cc ≤ 16.5 ) .Z = 16.5 − ( 25 × 0.80 ) 25 × 0.80 × 0.20 = 16.5 − 20 2 = − 1.75 Z = \frac{16.5 - (25 \times 0.80)}{\sqrt{25 \times 0.80 \times 0.20}} = \frac{16.5 - 20}{2} = -1.75 Z = 25 × 0.80 × 0.20 16.5 − ( 25 × 0.80 ) = 2 16.5 − 20 = − 1.75 p -value = 2 × P ( Z ≤ − 1.75 ) = 0.0802 p\text{-value} = 2 \times P(Z \leq -1.75) = 0.0802 p -value = 2 × P ( Z ≤ − 1.75 ) = 0.0802 (Do not reject H 0 H_0 H 0 ; aligns with exact test).Without CC : Approximation of 2 × P ( X ≤ 16 ) 2 \times P(X \leq 16) 2 × P ( X ≤ 16 ) using raw values.Z = 16 − 20 2 = − 2.00 Z = \frac{16 - 20}{2} = -2.00 Z = 2 16 − 20 = − 2.00 p -value = 2 × P ( Z ≤ − 2.00 ) = 0.0456 p\text{-value} = 2 \times P(Z \leq -2.00) = 0.0456 p -value = 2 × P ( Z ≤ − 2.00 ) = 0.0456 (Incorrectly reject H 0 H_0 H 0 ).