200 likes | 211 Views
How to do T-test?. Cindy Wu. Population means, independent samples. *. Use a Z test statistic. σ 1 and σ 2 known. Use S p to estimate unknown σ , use a t test statistic and pooled standard deviation. σ 1 and σ 2 unknown, assumed equal.
E N D
How to do T-test? Cindy Wu
Population means, independent samples * Use a Z test statistic σ1 and σ2 known Use Sp to estimate unknown σ , use a t test statistic and pooled standard deviation σ1 and σ2 unknown, assumed equal Use S1 and S2 to estimate unknown σ1 and σ2, use a separate-variance t test σ1 and σ2 unknown, not assumed equal Difference Between Two Means Source: Mark L, Berenson, David M. Levine, Timonthy C. Levine, Basic Business Statistics– Concepts and Applications, 10rd Edition, 2005
When is T-test performed? • To compare the means between two groups • One-tail T-test • μ1 ≧ μ2 orμ1 ≤μ2 • ex: Foreign students have higher grade than local students • Two-tail T-test • μ1 ≠μ2 • ex: the performance between foreign and local students are different.
Lower-tail test: H0: μ1 – μ2≧ 0 H1: μ1 – μ2< 0 Upper-tail test: H0: μ1 – μ2≤ 0 H1: μ1 – μ2> 0 Two-tail test: H0: μ1 – μ2= 0 H1: μ1 – μ2≠ 0 a a a/2 a/2 -ta ta -ta/2 ta/2 Reject H0 if t < -ta Reject H0 if t > ta Reject H0 if t < -ta/2 or t > ta/2 Where t has n - 1 d.f. Hypothesis Testing for Mean Difference, σD Unknown Source: Mark L, Berenson, David M. Levine, Timonthy C. Levine, Basic Business Statistics– Concepts and Applications, 10rd Edition, 2005
Hypothesis • Hypothesis 0: Gender differences have no influence on the preference toward chocolate • Hypothesis 1: Gender differences have influence on the preference toward chocolate
T-test step1: The test of variance (F-test) • To test if the variances of the two groups are equal • If the p-value of F value (Pr > F ) >α=0.05, the variances are equal • Equal variance: pooled method • If the p-value of F value (Pr > F ) <α=0.05, the variances are unequal • Unequal variance: Satterthwaite method
T-test step2: T-test • To test if the hypothesis 1 is accepted. • If the p-value of T value (Pr > |t|) >α=0.05, H0 is accepted • Gender differences have no influence on the preference toward chocolate • If the p-value of T value (Pr > |t|) <α=0.05, H0 is rejected • Gender differences do have influence on the preference toward chocolate
Example (SAS) Please open Tim’s HW
Common Mistakes • Didn’t check if the variance is equal or not first • T-test can’t be used to find the reason • Why do people ride bike? For convenience? For health? • Use pair T-test to test two different groups • When using Excel, don’t know how to interpret the result
Examples: • Marital Status • Political Party • Eye Color (Defined categories) Examples: • Number of Children • Defects per hour (Counted items) Examples: • Weight • Grades (Measured characteristics) Types of Data Source: Mark L, Berenson, David M. Levine, Timonthy C. Levine, Basic Business Statistics– Concepts and Applications, 10rd Edition, 2005
EXAMPLES: Height, Age, Weekly Food Spending Ratio Data Differences between measurements, true zero exists Temperature in Fahrenheit, Standardized exam score Interval Data Differences between measurements but no true zero Service quality rating, Standard & Poor’s bond rating, Student letter grades Ordinal Data Ordered Categories (rankings, order, or scaling) Marital status, Type of car owned Nominal Data Categories (no ordering or direction) Levels of Measurementand Measurement Scales Source: Mark L, Berenson, David M. Levine, Timonthy C. Levine, Basic Business Statistics– Concepts and Applications, 10rd Edition, 2005
Two-Sample Tests in EXCEL For independent samples: • Independent sample Z test with variances known: • Tools | data analysis | z-test: two sample for means • Pooled variance t test: • Tools | data analysis | t-test: two sample assuming equal variances • Separate-variance t test: • Tools | data analysis | t-test: two sample assuming unequal variances For paired samples (t test): • Tools | data analysis | t-test: paired two sample for means For variances: • F test for two variances: • Tools | data analysis | F-test: two sample for variances Source: Mark L, Berenson, David M. Levine, Timonthy C. Levine, Basic Business Statistics– Concepts and Applications, 10rd Edition, 2005
Hypothesis • Hypothesis 0: Gender differences have no influence on the preference toward chocolate • Hypothesis 1: Gender differences have influence on the preference toward chocolate
Table 2. T-test results (SPSS) P-value <0.05 Ho is rejected. So the gender differences have influence on the preference toward chocolate
Test for the Difference in 2 Independent Populations Parametric Test Procedure Assumptions Both populations are normally distributed Test is not robust to this violation Samples are randomly and independently drawn F distribution Source: Mark L, Berenson, David M. Levine, Timonthy C. Levine, Basic Business Statistics– Concepts and Applications, 10rd Edition, 2005
Hypothesis Tests for Variances * Tests for Two Population Variances H0: σ12 = σ22 H1: σ12 ≠ σ22 Two-tail test F test statistic H0: σ12≧σ22 H1: σ12 < σ22 Lower-tail test H0: σ12 ≤ σ22 H1: σ12 > σ22 Upper-tail test