Z-test and t-test Xuhua Xia

Slides:



Advertisements
Similar presentations
One-sample T-Test Matched Pairs T-Test Two-sample T-Test
Advertisements

Statistical Techniques I EXST7005 Start here Measures of Dispersion.
Analysis of Variance Compares means to determine if the population distributions are not similar Uses means and confidence intervals much like a t-test.
Copyright ©2011 Brooks/Cole, Cengage Learning Testing Hypotheses about Means Chapter 13.
Lecture 10 Non Parametric Testing STAT 3120 Statistical Methods I.
Comparing Two Population Means The Two-Sample T-Test and T-Interval.
MARE 250 Dr. Jason Turner Hypothesis Testing II To ASSUME is to make an… Four assumptions for t-test hypothesis testing: 1. Random Samples 2. Independent.
MARE 250 Dr. Jason Turner Hypothesis Testing II. To ASSUME is to make an… Four assumptions for t-test hypothesis testing:
SADC Course in Statistics Comparing Means from Independent Samples (Session 12)
© 2002 Prentice-Hall, Inc.Chap 8-1 Statistics for Managers using Microsoft Excel 3 rd Edition Chapter 8 Two Sample Tests with Numerical Data.
ANalysis Of VAriance (ANOVA) Comparing > 2 means Frequently applied to experimental data Why not do multiple t-tests? If you want to test H 0 : m 1 = m.
Test statistic: Group Comparison Jobayer Hossain Larry Holmes, Jr Research Statistics, Lecture 5 October 30,2008.
Statistics 07 Nonparametric Hypothesis Testing. Parametric testing such as Z test, t test and F test is suitable for the test of range variables or ratio.
Analysis of Differential Expression T-test ANOVA Non-parametric methods Correlation Regression.
Lecture 9: One Way ANOVA Between Subjects
Testing for differences between 2 means Does the mean weight of cats in Toledo differ from the mean weight of cats in Cleveland? Do the mean quiz scores.
Analysis of variance (2) Lecture 10. Normality Check Frequency histogram (Skewness & Kurtosis) Probability plot, K-S test Normality Check Frequency histogram.
Independent Sample T-test Often used with experimental designs N subjects are randomly assigned to two groups (Control * Treatment). After treatment, the.
Basic Business Statistics (9th Edition)
Statistical Methods in Computer Science Hypothesis Testing I: Treatment experiment designs Ido Dagan.
Student’s t statistic Use Test for equality of two means
Non-parametric statistics
6.1 - One Sample One Sample  Mean μ, Variance σ 2, Proportion π Two Samples Two Samples  Means, Variances, Proportions μ 1 vs. μ 2.
Psy B07 Chapter 1Slide 1 ANALYSIS OF VARIANCE. Psy B07 Chapter 1Slide 2 t-test refresher  In chapter 7 we talked about analyses that could be conducted.
ANOVA: Analysis of Variance Xuhua Xia
- Interfering factors in the comparison of two sample means using unpaired samples may inflate the pooled estimate of variance of test results. - It is.
T-Tests and Chi2 Does your sample data reflect the population from which it is drawn from?
NONPARAMETRIC STATISTICS
University of Ottawa - Bio 4118 – Applied Biostatistics © Antoine Morin and Scott Findlay 21/09/2015 7:46 PM 1 Two-sample comparisons Underlying principles.
Statistics & Biology Shelly’s Super Happy Fun Times February 7, 2012 Will Herrick.
The paired t-test, non-parametric tests, and ANOVA July 13, 2004.
HLTH 653 Lecture 2 Raul Cruz-Cano Spring Statistical analysis procedures Proc univariate Proc t test Proc corr Proc reg.
Inferential Statistics 2 Maarten Buis January 11, 2006.
One-sample In the previous cases we had one sample and were comparing its mean to a hypothesized population mean However in many situations we will use.
t(ea) for Two: Test between the Means of Different Groups When you want to know if there is a ‘difference’ between the two groups in the mean Use “t-test”.
Biostat 200 Lecture 7 1. Hypothesis tests so far T-test of one mean: Null hypothesis µ=µ 0 Test of one proportion: Null hypothesis p=p 0 Paired t-test:
1 Experimental Statistics - week 2 Review: 2-sample t-tests paired t-tests Thursday: Meet in 15 Clements!! Bring Cody and Smith book.
Previous Lecture: Categorical Data Methods. Nonparametric Methods This Lecture Judy Zhong Ph.D.
T-TEST Statistics The t test is used to compare to groups to answer the differential research questions. Its values determines the difference by comparing.
Testing Multiple Means and the Analysis of Variance (§8.1, 8.2, 8.6) Situations where comparing more than two means is important. The approach to testing.
5-5 Inference on the Ratio of Variances of Two Normal Populations The F Distribution We wish to test the hypotheses: The development of a test procedure.
T- and Z-Tests for Hypotheses about the Difference between Two Subsamples.
Biostatistics, statistical software VII. Non-parametric tests: Wilcoxon’s signed rank test, Mann-Whitney U-test, Kruskal- Wallis test, Spearman’ rank correlation.
7. Comparing Two Groups Goal: Use CI and/or significance test to compare means (quantitative variable) proportions (categorical variable) Group 1 Group.
Experimental Design and Statistics. Scientific Method
Statistical Inference for the Mean Objectives: (Chapter 9, DeCoursey) -To understand the terms: Null Hypothesis, Rejection Region, and Type I and II errors.
Lecture 3 Topic - Descriptive Procedures Programs 3-4 LSB 4:1-4.4; 4:9:4:11; 8:1-8:5; 5:1-5.2.
1 ANALYSIS OF VARIANCE (ANOVA) Heibatollah Baghi, and Mastee Badii.
Testing Differences between Means, continued Statistics for Political Science Levin and Fox Chapter Seven.
Descriptive Statistics Used to describe a data set –Mean, minimum, maximum Usually include information on data variability (error) –Standard deviation.
Experimental Statistics - week 3
- We have samples for each of two conditions. We provide an answer for “Are the two sample means significantly different from each other, or could both.
Tuesday, September 24, 2013 Independent samples t-test.
Other Types of t-tests Recapitulation Recapitulation 1. Still dealing with random samples. 2. However, they are partitioned into two subsamples. 3. Interest.
Applied Epidemiologic Analysis - P8400 Fall 2002 Lab 3 Type I, II Error, Sample Size, and Power Henian Chen, M.D., Ph.D.
Statistics for clinicians Biostatistics course by Kevin E. Kip, Ph.D., FAHA Professor and Executive Director, Research Center University of South Florida,
Testing Differences in Means (t-tests) Dr. Richard Jackson © Mercer University 2005 All Rights Reserved.
HYPOTHESIS TESTING FOR DIFFERENCES BETWEEN MEANS AND BETWEEN PROPORTIONS.
Two-Sample-Means-1 Two Independent Populations (Chapter 6) Develop a confidence interval for the difference in means between two independent normal populations.
Quantitative methods and R – (2) LING115 December 2, 2009.
Hypothesis Testing. Steps for Hypothesis Testing Fig Draw Marketing Research Conclusion Formulate H 0 and H 1 Select Appropriate Test Choose Level.
32931 Technology Research Methods Autumn 2017 Quantitative Research Component Topic 3: Comparing between groups Lecturer: Mahrita Harahap
Hypothesis Testing Start with a question:
Comparing Three or More Means
Hypothesis Testing Review
Defining the null and alternative hypotheses
Happiness comes not from material wealth but less desire.
Hypothesis Testing and Confidence Intervals
Introduction to SAS Essentials Mastering SAS for Data Analytics
What are their purposes? What kinds?
Presentation transcript:

z-test and t-test Xuhua Xia

Xuhua Xia 68.27% of the measurements lie within the range of , 95.44% lie within  2 , 99.73% lie within  3 , 50% lie within  0.67 , 95% lie within  1.96 , 97.5% lie within  2.24 , 99% lie within  2.58 , 99.5% lie within  2.81 , 99.9% lie within  3.29 . Given  = 70kg and  = 10kg for a normal distribution (of body weight), what is the probability of a body weight of 40 kg belonging to the population? The normal deviate: Standard deviation and Standard Error of the mean: The standard deviate pertaining to the normal distribution of means: Properties of a Normal Distribution

Xuhua Xia The z-score The government has certain regulations on commercial product. Suppose that packages of sugar labeled as 2 kg should have a mean weight of 2 kg and a standard deviation equal to If a package of sugar labeled 2 kg that you bought from a store has a weight of 1.82 kg, what is the z score? Can you present the package as evidence that the manufacturer has violated the government regulation?

Xuhua Xia Body Weight Frequency Body Weight of 10,000 Adult Men Mean = 70 kg, Std Dev = 10 kg Normal Distribution

Xuhua Xia Body Weight Frequency Frequency Distribution of Means

Xuhua Xia Is the mean difference significantly larger than 0? Wrong method assuming normal distribution:  = ;  = ; n = 15; Therefore, the mean difference is significantly larger than zero, i.e., inbreeding does reduce seed production. Darwin’s Breeding Experiment

Xuhua Xia I may premise that if we took by chance a dozen or score of men belonging to two nations and measured them, it would I presume be very rash to form any judgment from such small numbers on their (the nation’s) average heights. But the case is somewhat different with my … plants, as they were exactly of the same age, were subjected from first to last to the same conditions, and were descended from the same parents. -- Darwin, quoted in Fisher’s The design of experiments. Problem of Small Samples

Xuhua Xia Body Weight Frequency Normal distribution t distribution t distribution is wider and flatter than the normal distribution William S. Gosset & t Distribution

Xuhua Xia t distribution The t distribution depends on the degree of freedom (DF). For Darwin’s data with a sample size = 15, DF = = 14. With the t distribution with DF = 14, we expect 95% of the observations should fall within the range of mean  STD. Remember that for a normal distribution, 95% of the observations are expected to fall within the range of   1.96 . For pair-sample t-test with the null hypothesis being Mean1 = Mean2 (or MeanD = 0):

Xuhua Xia In contrast to Poincaré’s brilliance the contributions to probability published in 1908 and 1912 by the chemist W. S. Gosset … seem bumbling affairs indeed…… Altogether the papers of this anonymous “Student” must have seemed a pretty dismal flop to any disciple of Poincaré who might somehow have been induced to look at them. Yet “Student’s distribution” is a basic tool of a multitude of statisticians who will never have any use for the beautiful but relatively inconsequential work of Poincaré in probability; and what is more important, “Student” inspired Fisher. --H. Hotelling J Amer Stat Assoc 46:37 The Value of a Practical Method

Xuhua Xia T-Test T-Test can be used to test –the difference in mean between two samples (paired or unpaired), –a sample mean against a mean of a known population (e.g., the concentration of a medicine set as a standard by the government), –whether a single individual observation belong to a sample with sample size larger than one. The normal distribution and the Student’s t distribution. Why should the statistic t take into consideration both the mean difference and the variance? How to apply the test using Excel or SAS. The assumptions. Alternative methods: Wilcoxon rank-sum test or Mann- Whitney U test.

Xuhua Xia SAS Program /* Mercury level in the hair of men and women */ data Mercury; input gender $ Level cards; f 75 f 76 f 80 f 77 f 80 f 77 f 73 m 82 m 80 m 85 m 85 m 78 m 87 m 82 ; proc ttest cochran; class gender; var Level; title ’Mercury in hair'; run;

Xuhua Xia Variable: LEVEL GENDER N Mean Std Dev Std Error f m Variances T Method DF Prob>|T| Unequal Satterthwaite Cochran Equal For H0: Variances are equal, F' = 1.53 DF = (6,6) Prob>F' = SAS Output

Xuhua Xia Same variance, smaller mean difference Same mean difference, larger variance The Essence of the t Statistic

Xuhua Xia More on variance and SE Two independent variables: x 1, x 2 sampled from two normal distributions

Xuhua Xia Df = (7-1) + (7-1) = 12 Computation for unpaired t-test

Xuhua Xia SAS program for t-test /* A biologist wants to know whether male mice are larger than female mice. He randomly sampled 5 male and 5 female mice and measured their weight in gram: Males: 23, 22, 25, 23, 24; Females: 20, 21, 21, 20, 28. He subsequently found the largest female to be in late pregnancy. Now analyze this data set and draw your conclusion about size difference between males and females. */ data q4; do n=1 to 5; input weight sex = 1; output; end; do n=1 to 4; input weight sex = 2; output; end; cards; ; proc ttest; class sex; var weight; run;

Xuhua Xia SAS t-test output Variable: weight sex N Mean Std Dev Std Err Minimum Maximum Diff (1-2) sex Method Mean 95% CL Mean Std Dev 95% CL Std Dev Diff (1-2) Pooled Diff (1-2) Satterthwaite Method Variances DF t Value Pr > |t| Pooled Equal Satterthwaite Unequal Equality of Variances Method Num DF Den DF F Value Pr > F Folded F Now modify the program to include the pregnant female and re-do the t-test. The message: If he were not intimate with data and did not know that the female is pregnant, he would have concluded that males and females do not differ in weight. “The best statistician is the one who is intimate with his data.”

Xuhua Xia Paired Sample T-Test: 1 Options ls=75; data breed; input Outbreed Inbreed; Diff=Outbreed - Inbreed; cards; ; proc means n mean stderr t prt; var Diff; title ‘Paired sample t-test.’; run; SpeciesOutbreedIntbreedDifference Use the same data, do an unpaired two- sample t-test in SAS. to me: t, DF, p, what is the null hypothesis and whether it is rejected.

Xuhua Xia Paired-sample t-test: 2 /* An experiment is designed to test the effect of an insecticide on aquatic biomass. Five ponds are chosen for the experiments, with each pond devided into two halves labelled T (for treatment) and C (for control). The insecticide is applied to the T half. Aquatic biamass is then measured for T and C for the five ponds. */ data pollution; input pond T C diff=T-C; cards; ; proc print; var T C diff; run; proc univariate; var diff; run; Use the same data, do an unpaired two- sample t-test in SAS. to me: 1.Paired-sample t-test: t, DF, p, what is the null hypothesis and whether it is rejected. 2.Unpaired two-sample t-test: t, DF, p, what is the null hypothesis and whether it is rejected.

Xuhua Xia SAS output Obs T C diff N 5 Sum Weights 5 Mean Sum Observations -169 Std Deviation Variance Skewness Kurtosis Uncorrected SS Corrected SS Coeff Variation Std Error Mean Basic Statistical Measures Location Variability Mean Std Deviation Median Variance 1463 Mode Range Interquartile Range Tests for Location: Mu0=0 Test -Statistic p Value Student's t t Pr > |t| Sign M -2.5 Pr >= |M| Signed Rank S -7.5 Pr >= |S| What would be the result if T and C in Pond #3 do not differ as much, e.g., if C in Pond #3 is only 232 instead of 322? Make this modification and re-run the SAS program. Discuss.

Xuhua Xia How should we allocate the two crop varieties to the plots? What comparison would be fair? Block 1 Block 2 Block 3 Block 4 Using blocks to reduce confounding environmental factors (Everything else being equal except for the treatment effect) in evaluating the protein content of two wheat variaties. Paired-sample t-test: Block 1 Block 2 Block 3 Block

Xuhua Xia The Wilcoxon-Mann-Whitney Test Statistical significance tests can be grouped into –Parametric tests, e.g., t-test, ANOVA –Non-parametric tests, e.g., Wilcoxon-Mann-Whitney test, sign test, runs test.

Xuhua Xia When to Use Non-parametric Tests Parametric tests depends on the assumed probability distributions, e.g., normal distribution, t distribution, etc, and would give misleading results when the assumptions are violated. Non-parametric tests are called distribution-free tests and can be used in cases where the parametric tests are inappropriate. Parametric tests are more powerful than their non- parametric counterparts when the underlying assumptions are met.

Xuhua Xia Wilcoxon-Mann-Whitney Test The Wilcoxon-Mann-Whitney test is the non- parametric equivalent of the t-test. The original data are rank-transformed before applying the test The test statistic is U

Xuhua Xia SAS program /* Mercury level between men and women */ data Mercury; input gender $ Level cards; f 75 f 76 f 80 f 77 f 80 f 77 f 73 m 82 m 80 m 85 m 85 m 78 m 87 m 82 m 120 ; proc ttest cochran; /*cochran is for requesting a conservative test with unequal variances */ class gender; var Level; title 'Mercury in hair'; run; proc anova; class gender; model level=gender; run; proc npar1way wilcoxon; class gender; var level; run; Run the program and discuss the output. The parametric t-test will have p > 0.05, whereas the nonparametric tests will have p < Why?