TFV0103 Tölfræði og fræðileg vinnubrögð TFV0103 Tölvutími 5 Dæmi 1 (t-próf, Excel) Sheepskin Mattress Experiment/Tilraun In a long stay hospital ward, over a three-month period, ten patients laid on a mattress covered with a normal sheet (Control/Samanburðarhópur), while another ten hospital patients laid on a sheepskin covered mattress (Intervention/Inngrip). At the end of the threemonth period, the number of pressure sores (legusár) for each patient was observed as follows: Control 10, 8, 12, 13, 11, 10, 15, 7, 11, 10 Intervention 6, 4, 8, 7, 5, 6, 5, 10, 7, 5 Calculate the results of an independent t-test/óháð t-próf. (2-tailed test/tvíhliða próf, assume unequal variances) What significant level (marktektarstig) is reached? What is the size of the effect (stærð áhrifa)? Dæmi 2 (chi-squared test, Excel) Chi-square test/kí-kvaðrat próf. Data in the form of cross-tabulation or contingency tables/krosstöflur eða tenglsatöflur can be analyzed using the chi-square test. Consider the following table showing the number of smokers/reykingamenn and non-smokers/menn sem reykja ekki who either have or do not have cancer/krabbamein. The formula for chi-square is shown below the table. Observed/Fengitíðni Smokers Cancer 230 No cancer 465 Non-smokers 78 652 (O - E) 2 E all cells 2 In the formula, O stands for the observed frequency/fengitíðni in the cell/reitur and E stands for the expected frequency/væntitíðni in the cell. To calculate E, you first calculate the row, column and grand totals. Observed/Fengitíðni Smokers Cancer 230 No cancer 465 695 1 Non-smokers 78 652 730 308 1117 1425 TFV0103 Tölfræði og fræðileg vinnubrögð The expected frequency/væntitíðni E in a cell is given by (row total x column total/grand total). The expected frequencies are: Expected Cancer No cancer Smokers 150,2175 544,7825 Non-smokers 157,7825 572,2175 Enter the observed and expected data into Excel. In Excel, in a separate part of the spreadsheet, calculate (O-E)2/E for each cell. You should obtain: 42,37348145 40,34187617 11,68400384 11,12381187 In Excel check that the value of chi-square when you add these numbers together is 105,5231733. The degrees of freedom/frígráður is given by (R-1)x(C-1) where R is the number of rows and C is the number of columns. Here the degrees of freedom is 1. With a degree of freedom equal to 1, chi-square has to be bigger than 6,63 to obtain a p value of 0,01 or has to be greater than 10,83 to obtain a p value of 0,001. The null hypothesis/núlltilgatan that the independent variable/óháð breyta (smoking/nonsmoking) has no effect on the dependent variable/háð breyta (cancer/no cancer) is rejected at the 0,001 level. We can conclude that smoking has an effect. In Excel you can get the exact probability of obtaining the value of chi-square or greater by using the CHITEST function. You can use the value of probability and the degrees of freedom involved to obtain the actual value of chi-square by using the CHIINV function. Chi-square critical values calculator http://www.stat.sc.edu/~west/applets/chisqdemo.html 2