Download presentation

Presentation is loading. Please wait.

1
z-test and t-test Xuhua Xia xxia@uottawa.ca http://dambe.bio.uottawa.ca

2
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

3
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 0.10. 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?

4
Xuhua Xia 0 50 100 150 200 250 300 350 29.9136.3242.7449.1555.5761.9868.4074.8181.2387.6494.06 100.47106.89 Body Weight Frequency Body Weight of 10,000 Adult Men Mean = 70 kg, Std Dev = 10 kg Normal Distribution

5
Xuhua Xia 0 50 100 150 200 250 300 350 29.9136.3242.7449.1555.5761.9868.4074.8181.2387.6494.06 100.47106.89 Body Weight Frequency Frequency Distribution of Means

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

7
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

8
Xuhua Xia 0 50 100 150 200 250 300 350 29.9136.3242.7449.1555.5761.9868.4074.8181.2387.6494.06 100.47106.89 Body Weight Frequency Normal distribution t distribution t distribution is wider and flatter than the normal distribution William S. Gosset & t Distribution

9
Xuhua Xia t distribution The t distribution depends on the degree of freedom (DF). For Darwin’s data with a sample size = 15, DF = 15 - 1 = 14. With the t distribution with DF = 14, we expect 95% of the observations should fall within the range of mean 2.145 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):

10
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 1951. J Amer Stat Assoc 46:37 The Value of a Practical Method

11
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.

12
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;

13
Xuhua Xia Variable: LEVEL GENDER N Mean Std Dev Std Error ------------------------------------------------------------------- f 7 76.85714286 2.54483604 0.96185761 m 7 82.71428571 3.14718317 1.18952343 Variances T Method DF Prob>|T| -------------------------------------------------------- Unequal -3.8288 Satterthwaite 11.5 0.0026 Cochran 6.0 0.0087 Equal -3.8288 12.0 0.0024 For H0: Variances are equal, F' = 1.53 DF = (6,6) Prob>F' = 0.6189 SAS Output

14
Xuhua Xia Same variance, smaller mean difference Same mean difference, larger variance The Essence of the t Statistic -6-4-2024 6 -6-4-20246 -18-12-6061218

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

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

17
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; 23 22 25 23 24 20 21 21 20 ; proc ttest; class sex; var weight; run;

18
Xuhua Xia SAS t-test output Variable: weight sex N Mean Std Dev Std Err Minimum Maximum 1 5 23.4000 1.1402 0.5099 22.0000 25.0000 2 4 20.5000 0.5774 0.2887 20.0000 21.0000 Diff (1-2) 2.9000 0.9411 0.6313 sex Method Mean 95% CL Mean Std Dev 95% CL Std Dev 1 23.4000 21.9843 24.8157 1.1402 0.6831 3.2764 2 20.5000 19.5813 21.4187 0.5774 0.3271 2.1527 Diff (1-2) Pooled 2.9000 1.4072 4.3928 0.9411 0.6222 1.9154 Diff (1-2) Satterthwaite 2.9000 1.4738 4.3262 Method Variances DF t Value Pr > |t| Pooled Equal 7 4.59 0.0025 Satterthwaite Unequal 6.1347 4.95 0.0024 Equality of Variances Method Num DF Den DF F Value Pr > F Folded F 4 3 3.90 0.2925 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.”

19
Xuhua Xia Paired Sample T-Test: 1 Options ls=75; data breed; input Outbreed Inbreed; Diff=Outbreed - Inbreed; cards; 100 51. ; proc means n mean stderr t prt; var Diff; title ‘Paired sample t-test.’; run; SpeciesOutbreedIntbreedDifference 1 1005149 2 222289-67 3 1211138 4 43341716 5 2222166 6 1118823 7 53450628 8 43239141 9 998514 10 44541629 11 11256 12 33330924 13 22214775 14 42236260 15 101149-48 Use the same data, do an unpaired two- sample t-test in SAS. Email to me: t, DF, p, what is the null hypothesis and whether it is rejected.

20
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; 1 12 46 2 32 43 3 222 322 4 65 77 5 55 67 ; 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. Email 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.

21
Xuhua Xia SAS output Obs T C diff 1 12 46 -34 2 32 43 -11 3 222 322 -100 4 65 77 -12 5 55 67 -12 N 5 Sum Weights 5 Mean -33.8 Sum Observations -169 Std Deviation 38.2517973 Variance 1463.2 Skewness -1.9172814 Kurtosis 3.63483537 Uncorrected SS 11565 Corrected SS 5852.8 Coeff Variation -113.171 Std Error Mean 17.1067238 Basic Statistical Measures Location Variability Mean -33.8000 Std Deviation 38.25180 Median -12.0000 Variance 1463 Mode -12.0000 Range 89.00000 Interquartile Range 22.00000 Tests for Location: Mu0=0 Test -Statistic- -----p Value------ Student's t t -1.97583 Pr > |t| 0.1194 Sign M -2.5 Pr >= |M| 0.0625 Signed Rank S -7.5 Pr >= |S| 0.0625 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.

22
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: 3 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 Block 1 Block 2 Block 3 Block 4 1 2 2 1 2 1 1 2 2 1 2 1 1 2 1 2

23
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.

24
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.

25
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

26
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 < 0.05. Why?

Similar presentations

OK

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:

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:

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

E paper display ppt on tv Download ppt on radioactive waste management Ppt on power line carrier communication pdf Ppt on national education day of bangladesh Ppt on non biodegradable waste wikipedia Ppt on moral education in schools Ppt on rbi reforms in education Ppt on retail marketing mix Ppt on tcp/ip protocol suite protocols Ppt on origin of english language