环境数据分析课件 (19).pdf
Chapter 6 T testsWe are different or not?Significance level is the boss!4 Single sample t-test Dependent(Paired)samples t-testCONTENTS Independent-samples t-test T-test F-test T-testIndependent-sample t-testAssumption for independent-sample t-test Continuous Normally distribution Random sample Enough data Similar spread between groupse.g.a Proportion:Two Proportion Z-Test e.g.not:Mann-Whitney U-Test Bias or tendency 30 Independent Sample Z-TestHomogeneity of varianceIndependent-sample t-testVariancea sensitive measure of dispersion;how far from the mean.Independent-sample t-testIMPORTANT:Two samples are independent,from normal population,variance are equal.The normality and homogeneity of variance test before t-test.Independent-sample t-testF testAn assumption of the independent samples t-test and ANOVAstating that all comparison groups have the same variance.Ronald A.FisherSimply a ratio of two variances.2221ssF Homogeneity of variance testIndependent-sample t-testF testTheoremLet and denote the two sample variances.Then the df has an F distribution with where n1 for sample 1 size,and n2 for sampe 2 size.21s22s2221ssF 1,12211ndfndfIndependent-sample t-testF test-homogeneity of variance testNull hypothesis:Alternative hypothesis:Specify the level of significance Identify the degrees of freedom Determine the Critical value:One-tailed,use the Two-tailed,use the Calculate the test statistic:22210:H22211:H21&dfdf212221ssF rejected if the ratio differs by too much from 1Independent-sample t-testMake a decision to accept or reject H0.df1=n1-1 df2=n2-1F test-homogeneity of variance testTwo sided:F(1-/2)(df1,df2)F F(/2)(df1,df2)Left sided:F F(1-)(df1,df2)Right sided:F 1,F F()(df1,df2)Independent-sample t-testF test-homogeneity of variance testIndependent-sample t-testExample1-2 George and Peppa collected 10-day forecast of X and Y Cities.Temperatures of both fluctuate similarly?Temperature data of X and Y were collected as below().X32.230.931.533.331.930.932.533.732.831.1Y28.229.431.031.431.930.927.327.730.130.229.3Independent-sample t-testExample221220:,:YXYXssHssH10,9,423.0,349.2,993.02222YXYXYXdfdfssFss05.0105.)10,9,423.0()423.0(:3)10,9()10,9(,78.3)10,9,025.0(,252.0)10,9,975.0(:2,78.3)10,9(,252.0)10,9(:1025.0975.0025.0975.0FDISTFpFFFFINVFINVFFSimilar!Single-sample t-testTips:Excel equation:f(x)=var(x1,x2,x3.),886.0,993.0252LHss4 Single sample t-test Dependent(Paired)samples t-testCONTENTS Independent samples t-test T-test F-test T-testIndependent-sample t-testIf we want to know diff in population means,best guess is diff in sample means.Fig.The difference of the two means of two independent samples.210:HIndependent-sample t-testHypothesis (the two population means are equal)(the two population means are not equal)OR (the difference between the two population means is equal to 0)(the difference between the two population means is not 0)where 1 and 2 are the population means for group 1 and group 2,respectively.210:H211:H0:210H0:211HIndependent-sample t-testAfter the F-test,independent-sample t-test statisticSize matters21212121x2-x1tnnnnsxxsxxp2)1()1(s21222211222211pnnsnsndfsdfsdf221nnf d22214343:,4:,3:8.3,3.3,5.3,1.3:0.4,5.3,0.3:212121 xxwwwxxtThey are equal in SDsIndependent-sample t-testAssumption for independent-sample t-test Continuous Normally distribution Random sample Enough data Similar spread between groupse.g.a Proportion:Two Proportion Z-Test e.g.not:Mann-Whitney U-Test Bias or tendency 30 Independent Sample Z-TestHomogeneity of varianceIndependent-sample t-testAfter the F-test,independent-sample t-test statisticVariance weighted as:212121212221tnsnsxxsxxxx2212)1(1dfkdfkdf222211xxxsssk1001.01:,1000001.01:,1.09.2:,01.000.3:222121wwxxThey arent equal in SDs2221Inverse variance methodIndependent-sample t testDetermination e.g.=0.05 Accept H0Two sidedLeft sidedRight sided2/ttttt,0ttt,0Independent-sample t testExample1-3 If temperatures of two cities are similar then they will choose the city for travelling without consideration of temperature!Lets help them to find out if difference exists!YXYXHH:1:0,Independent samples t-testVariances equalOnly if the means of both are similar!Independent-sample t-testExample01.00003.)1,19,4.34(01.00007.)2,19,06.4()4.34(TDISTTDISTtpExtreme difference!,71.1,19,10,9,349.2,993.02222LHLLHHLHYXdfdfsdfsdfsdfdfdfss06.4,76.29,08.322121nnnnsxxtxxLHLHone tailed more sensitiveUnacceptable?