Top Banner
©[email protected] 2012 T Test, ANOVA & Proportionate Test Assoc. Prof . Dr Azmi Mohd Tamil Dept of Community Health Universiti Kebangsaan Malaysia FK6163
84

Statistic IV: t test and ANOVA

Jun 19, 2015

Download

sppippukm

Statistic IV: t test and ANOVA
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 1. T Test, ANOVA &Proportionate TestAssoc. Prof . Dr Azmi Mohd TamilDept of Community HealthUniversiti Kebangsaan [email protected] 2012FK6163

2. [email protected] 2012Independent T-TestStudents T-TestPaired T-TestANOVA 3. Students T-testWilliam Sealy Gosset @Student, 1908. The ProbableError of Mean. [email protected] 2012 4. Students T-Test To compare the means of two independentgroups. For example; comparing the meanHb between cases and controls. 2 variablesare involved here, one quantitative (i.e. Hb)and the other a dichotomous qualitativevariable (i.e. case/control)[email protected] 2012 t = 5. Examples: Students t-test Comparing the level of blood cholestrol(mg/dL) between the hypertensive andnormotensive. Comparing the HAMD score of twogroups of psychiatric patients treatedwith two different types of drugs (i.e.Fluoxetine & [email protected] 2012 6. Examplet-test for Equality of [email protected] 2012Group Statistics35 4.2571 3.1280832 3.8125 4.39529DRUGFSDHAMAWK6N Mean Std. DeviationIndependent Samples Test.48 65 .633 .4446Equal variancesassumedDHAMAWK6t dfSig.(2-tailed)MeanDifference 7. Assumptions of T test Observations are normally distributed ineach population. (Explore) The population variances are equal.(Levenes Test) The 2 groups are independent of eachother. (Design of study)[email protected] 2012 8. Manual Calculation Sample size > 30 Small sample size,equal [email protected] 2012 9. Example comparecholesterol [email protected] 2012 Hypertensive :Mean : 214.92s.d. : 39.22n : 64 Normal :Mean : 182.19s.d. : 37.26n : 36 Comparing the cholesterol level betweenhypertensive and normal patients. The difference is (214.92 182.19) = 32.73 mg%. H0 : There is no difference of cholesterol levelbetween hypertensive and normal patients. n > 30, (64+36=100), therefore use the first formula. 10. [email protected] 2012 t = (214.92- 182.19)________((39.222/64)+(37.262/36))0.5 t = 4.137 df = n1+n2-2 = 64+36-2 = 98 Refer to t table; with t = 4.137, p < 0.001 11. If df>100, can refer TableA1.We dont have 4.137 so weuse 3.99 instead. If t = 3.99,then p=0.00003x2=0.000064.137>3.99pAnalyse>Compare Means>Ind-Samp TTest 17. T-Test in [email protected] 2012 We want to see whetherthere is any associationbetween the mothers weightand SGA. So select the riskfactor (weight2) into TestVariable & the outcome(SGA) into GroupingVariable. Now click on the DefineGroups button. Enter 0 (Control) for Group 1 and 1 (Case) for Group 2. Click the Continue button &then click the OK button. 18. T-Test Results Compare the mean+sd of both groups. Normal 58.7+11.2 kg SGA 51.0+ 9.4 kg Apparently there is a difference ofweight between the two [email protected] 2012Group Statistics108 58.666 11.2302 1.0806109 51.037 9.3574 .8963SGANormalSGAWeight at first ANCN Mean Std. DeviationStd. ErrorMean 19. Results & Homogeneity ofVariancesLevene's Test forEquality of Variances95% ConfidenceInterval of theDifferencet-test for Equality of Means Look at the p value of Levenes Test. If p is notsignificant then equal variances is assumed (use toprow). If it is significant then equal variances is not assumed(use bottom row). So the t value here is 5.439 and p < 0.0005. Thedifference is significant. Therefore there is anassociation between the mothers weight and [email protected] 2012Independent Samples Test1.862 .174 5.439 215 .000 7.629 1.4028 4.8641 10.39405.434 207.543 .000 7.629 1.4039 4.8612 10.3969Equal variancesassumedEqual variancesnot assumedWeight at first ANCF Sig.t df Sig. (2-tailed)MeanDifferenceStd. ErrorDifference Lower Upper 20. How to present theresult?Group N Mean test [email protected] 2012Normal 108 58.7+11.2 kgT testt = 5.439 t>2.75Therefore if t=2.858,0.005

Analyse>Compare Means>Paired-Samples TTest 32. Paired T-Test In [email protected] 2012 We want to see whetherthere is any associationbetween the prescriptionon haematinic toanaemic pregnantmothers and Hb. We are comparing theHb before & aftertreatment. So pair thetwo measurements(Hb2 & Hb3) together. Click the OK button. 33. Paired T-Test Results This shows the mean & standarddeviation of the two [email protected] 2012Paired Samples Statistics10.247 70 .3566 .042610.594 70 .9706 .1160HB2HB3Pair1Mean N Std. DeviationStd. ErrorMean 34. Paired T-Test ResultsPaired DifferencesMean Std. Deviation95% ConfidenceInterval of theDifferenceStd. ErrorMean Lower Uppert df Sig. (2-tailed) This shows the mean difference of Hbbefore & after treatment is only 0.347 g%. Yet the t=3.018 & p=0.004 show thedifference is statistically [email protected] 2012Paired Samples Test-.347 .9623 .1150 -.Pair 1 HB2 - HB3 577 -.118 -3.018 69 .004 35. How to present [email protected] 2012Group N Mean D(Diff.) Test pBeforetreatment(HB2) vsAftertreatment(HB3)70 0.35 + 0.96Paired T-testt = 3.0180.004 36. [email protected] 2012ANOVA 37. ANOVA Analysis of Variance Extension of independent-samples t test Compares the means of groups ofindependent observations Dont be fooled by the name. ANOVA [email protected] 2012not compare variances. Can compare more than two groups 38. One-Way ANOVAF-Test Tests the equality of 2 or more population means Variables One nominal scaled independent variable 2 or more treatment levels or classifications(i.e. Race; Malay, Chinese, Indian & Others) One interval or ratio scaled dependent variable(i.e. weight, height, age) Used to analyse completely randomizedexperimental [email protected] 2012 39. Examples Comparing the blood cholesterol levelsbetween the bus drivers, bus conductorsand taxi drivers. Comparing the mean systolic pressurebetween Malays, Chinese, Indian &[email protected] 2012 40. One-Way ANOVAF-Test Assumptions Randomness & independence of errors Independent random samples are drawn Normality Populations are normally distributed Homogeneity of variance Populations have equal [email protected] 2012 41. [email protected] 2012DescriptivesBirth weight151 2.7801 .52623 1.90 4.7223 2.7643 .60319 1.60 3.9644 2.8430 .55001 1.90 3.79218 2.7911 .53754 1.60 4.72HousewifeOffice workField workTotalN Mean Std. Deviation Minimum MaximumANOVABirth weight.153 2 .077 .263 .76962.550 215 .29162.703 217Between GroupsWithin GroupsTotalSum ofSquares df Mean Square F Sig. 42. Manual [email protected] 2012ANOVA 43. Example:Time To CompleteAnalysis45 samples wereanalysed using 3 differentblood analyser (Mach1,Mach2 & Mach3).15 samples were placedinto each analyser.Time in seconds wasmeasured for eachsample analysis.24.9322.6120.59 44. Example:Time To CompleteAnalysisThe overall mean of theentire sample was 22.71seconds.This is called the grandmean, and is oftendenoted by .XIf H0 were true then wedexpect the group meansto be close to the grandmean.24.9322.6120.5922.71 45. Example:Time To CompleteAnalysisThe ANOVA test isbased on the combineddistances from X.If the combineddistances are large, thatindicates we shouldreject H0.24.9322.6120.5922.71 46. The Anova StatisticTo combine the differences from the grand mean we Square the differences Multiply by the numbers of observations in the groups Sum over the groups( ) ( ) ( )2SSB = 15 X - X + 15 X - X + 15 X -X Mach 1 Mach 2Mach 2* Xwhere the are the group means.32SSB = Sum of Squares Between groups 47. The Anova StatisticTo combine the differences from the grand mean we Square the differences Multiply by the numbers of observations in the groups Sum over the groups( ) ( ) ( )2* Xwhere the are the group means.SSB = Sum of Squares Between groupsNote: This looks a bit like a variance.3222SSB 15 X 1 X 15 X X 15 X X Mach Mach Mach = - + - + - 48. Sum of Squares Between( ) ( ) ( )23 Grand Mean = 22.71 Mean Mach1 = 24.93; (24.93-22.71)2=4.9284 Mean Mach2 = 22.61; (22.61-22.71)2=0.01 Mean Mach3 = 20.59; (20.59-22.71)2=4.4944 SSB = (15*4.9284)+(15*0.01)+(15*4.4944) SSB = [email protected] 2012222SSB 15 X 1 X 15 X X 15 X X Mach Mach Mach = - + - + - 49. How big is big? For the Time to Complete, SSB = 141.492 Is that big enough to reject H0? As with the t test, we compare the statistic tothe variability of the individual observations. In ANOVA the variability is estimated by theMean Square Error, or MSE 50. MSEMean Square ErrorThe Mean Square Erroris a measure of thevariability after thegroup effects havebeen taken intoaccount.MSE 1 2( - )N -K=j iij j x Xwhere xij is the ithobservation in the jthgroup. 51. MSEMean Square ErrorThe Mean Square Erroris a measure of thevariability after thegroup effects havebeen taken intoaccount.MSE 1 2( - )N -K=j iij j x Xwhere xij is the ithobservation in the jthgroup.24.9322.6120.59 52. MSEMean Square ErrorThe Mean Square Erroris a measure of thevariability after thegroup effects havebeen taken intoaccount.MSE 1 2( - )-=j iij j x XN K24.9322.6120.59 53. MSE 1 2( - )[email protected] 2012-=j iij j x XN KMach1 (x-mean)^2 Mach2 (x-mean)^2 Mach3 (x-mean)^223.73 1.4400 21.5 1.2321 19.74 0.722523.74 1.4161 21.6 1.0201 19.75 0.705623.75 1.3924 21.7 0.8281 19.76 0.688924.00 0.8649 21.7 0.8281 19.9 0.476124.10 0.6889 21.8 0.6561 20 0.348124.20 0.5329 21.9 0.5041 20.1 0.240125.00 0.0049 22.75 0.0196 20.3 0.084125.10 0.0289 22.75 0.0196 20.4 0.036125.20 0.0729 22.75 0.0196 20.5 0.008125.30 0.1369 23.3 0.4761 20.5 0.008125.40 0.2209 23.4 0.6241 20.6 0.000125.50 0.3249 23.4 0.6241 20.7 0.012126.30 1.8769 23.5 0.7921 22.1 2.280126.31 1.9044 23.5 0.7921 22.2 2.592126.32 1.9321 23.6 0.9801 22.3 2.9241SUM 12.8380 9.4160 11.1262 54. MSE 1 2( - ) Note that the variation of the means(141.492) seems quite large (more likelyto be significant???) compared to thevariance of observations within groups(12.8380+9.4160+11.1262=33.3802). MSE = 33.3802/(45-3) = [email protected] 2012-=j iij j x XN K 55. Notes on MSE If there are only two groups, the MSE is equalto the pooled estimate of variance used in theequal-variance t test. ANOVA assumes that all the group variancesare equal. Other options should be considered if groupvariances differ by a factor of 2 or more. (12.8380 ~ 9.4160 ~ 11.1262) 56. ANOVA F Test The ANOVA F test is based on the F statisticSSB ( K1) =-MSEFwhere K is the number of groups. Under H0 the F statistic has an F distribution,with K-1 and N-K degrees of freedom (N is thetotal number of observations) 57. Time to Analyse:F test p-valueTo get a p-value wecompare our F statisticto an F(2, 42)distribution. 58. Time to Analyse:F test p-valueTo get a p-value wecompare our F statisticto an F(2, 42)distribution.In our example89.015F = 141.492 2 =33.3802 42We cannot draw the linesince the F value is solarge, therefore the pvalue is so small!!!!!! 59. Refer to F Dist. Table(=0.01).We dont have df=2;42,so we use df=2;40 instead.F = 89.015, larger than 5.18(p=0.01)Therefore if F=89.015,p 89.015) = 0.00000000000008 61. ANOVA TableResults are often displayed using an ANOVA TableSum ofSquares dfMeanSquare F Sig.BetweenGroups 141.492 2 40.746 89.015 p