1 / 62

Simple tests in SPSS

Simple tests in SPSS. Download the slides and data. In your web browser, type in the following address and save the files to your computer: http:// www.sheffield.ac.uk/mash/workshop_materials. Learning outcomes. By the end of this session you should understand:

whitley
Download Presentation

Simple tests in SPSS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Simple tests in SPSS

  2. Download the slides and data In your web browser, type in the following address and save the files to your computer: http://www.sheffield.ac.uk/mash/workshop_materials

  3. Learning outcomes By the end of this session you should understand: • The difference between paired and unpaired data • When to use some simple statistical tests and the types of data that they apply to By the end of this session you should be able to: • Undertake a t-test in SPSS • Undertake a chi-squared test in SPSS • Check the assumptions underlying these tests • Appropriately report the results of these tests

  4. Steps for choosing the right test • Clearly define your research question • Decide which are the outcome (dependent) / explanatory (independent) variables • What data types are they? • How are these summarised? • What charts can you use to display them?

  5. Recap: Data types

  6. Recap: Data types

  7. Steps for choosing the right test • Are you interested: • Comparing groups. How many groups are there? • Assessing/modelling the relationship between variables • Are the observations paired? • Is the pairing due to having repeated measurements of the same variable for each subject? • Does the test you have chosen make any assumptions? Are the assumptions met? e.g. assumption of normality for t-test • Today we are looking at how you test for a difference between two groups: • Continuous outcome (t-test) • Categorical outcome (chi-squared test)

  8. Comparing 2 groups

  9. Paired data • Most commonly, measurements from the same individuals collected on more than one occasion • Can be used to look at differences in mean score: • 2 or more time points e.g. before/after a diet • 2 or more conditions e.g. hearing test at different frequencies Each person listened to a sound until they could no longer hear it at two different frequencies. Would use paired t-test

  10. Continuous outcome

  11. Continuous outcome: Example • Is there a difference my journey to work between term-time and school holidays? • Outcome: journey time – continuous data • Two groups: Term-time/school holidays • Independent samples t-test

  12. Example: Independent samples t-test Analyze Compare Means  Independent-Samples T Test…

  13. Example: Independent samples t-test Analyze Compare Means  Independent-Samples T Test… Move outcome variable Time into the ‘Test Variable(s)’ box Move the group variable When (term-time or holidays) to the ‘Grouping Variable’ box

  14. Example: Independent samples t-test • Click on ‘Define Groups’ to tell SPSS what values of the grouping variable to use. In this case the groups are coded as: • 1: term-time • 2: school holidays • Click Continue • Click OK

  15. Example: Understanding the output Basic statistics comparing the two groups Key output table

  16. Example: Understanding the output Basic statistics comparing the two groups

  17. Statistical significance Null: There is NO difference in the journey times between term-time and school holidays  Alternative: There is A difference in the journey times between term-time and school holidays 

  18. Statistical significance • The significance level is usually set at 5% (0.05) • The smaller the p-value, the more confident we are with our decision to reject the null hypothesis

  19. Example: Reporting the results An independent samples t-test was carried out to examine whether there was a difference in my journey to work between term-time and the school holidays. There is strong evidence to suggest that on average it takes longer to travel to work in term-time than during school holidays (p=0.004) As p = 0.004, there is only a 0.4% chance (or 1 in 250) of rejecting the null when it is true (type 1 error – claiming a significant difference when there is none) What is the difference? For my sample, the journey to work takes an average of 3 minutes longer during term time than during the school holidays (95% CI: 1.1 to 5.3 minutes)

  20. Assumptions for Independent samples t-test • The data in the groups are approximately normally distributed • The variability in the two groups is the same. • Can either look at the value of the standard deviations (should be similar, as a rule of thumb the value of the larger standard deviation should be no more than twice the value of the smaller standard deviation. • Or can test for this using Levene’s test • Groups are independent (no way to test for this, it should be implicit in the design)

  21. Assumption 1: Data in the groups are approximately normally distributed Graphs  Legacy Dialogs  Histogram Add ‘When’ to the Rows Box Don’t need to be perfect, just approximately symmetrical

  22. Assumption 2: Variances are the same Two options: Look at the standard deviations in the Group Statistics table. These look similar enough (don’t expect them to be exactly the same) Look at Levene’s test in the main output table: should be not significant, i.e. p > 0.05, then can assume the variances do not differ from each other If the variances are not equal report results from the second line of output ‘Equal variances not assumed’

  23. Exercise 1: Open the file ‘Birthweight_reduced’ Recode mnocig ‘Number of cigarettes smoked per day’ into smoker/non-smoker (tip: use ‘Transform  Recode into different variable’ and create a new variable ‘Smoker’ with codes 0: non-smoker; 1: smoker) Conduct a t-test to examine whether birthweight differed between women who smoked and women who did not smoke. Don’t forget to look at the assumptions and see if they are met What do you conclude?

  24. Independent t-test options Is the dependent variable normally distributed for both groups? Use the Mann-Whitney U test and report medians No Yes Use adjusted t-test and means Is one SD more than twice the other? Yes No Use standard t-test and report means

  25. Example: Mann-Whitney U test Cost of ticket on the Titanic The data are highly skewed. There appear to be a few individuals who paid more than £300 for their ticket What happens if we exclude them?

  26. Example: Mann-Whitney U test. Cost of ticket on the Titanic (excluding > £300) Even excluding them, the data are still highly skewed

  27. Example: Mann-Whitney U test Analyze Nonparametric Tests  Independent Samples…

  28. Example: Mann-Whitney U test In the Objective tab, make sure that ‘Automatically compare distributions across groups’ is selected Click on the Fields tab Move ‘Cost of ticket’ to the Test Fields box Move ‘Survived’ to the Groups box Click Run

  29. Example: Understanding the output • Note that the Mann-Whitney U test is a test of the distributions of the data in the two groups. It tests the null that the distribution of the data in the two groups is the same • As the p-value is < 0.001, the result is statistically significant. To make sense of the results, look at key statistics, such as the medians in each group and report these. Key (only!) output table The p-value is ‘Sig’. This is recorded in the table as 0.000, but should be reported as p< 0.001

  30. Example: Reporting the results A Mann-Whitney U test was carried out to see if there was a difference in the price paid for a ticket between passengers who died and passengers who survived on the Titanic. There is very strong evidence (p < 0.001) to suggest that ticket price differed between the two groups What is the difference? The median price paid for a ticket was much lower for those who died (£10.50) compared to those who survived (£26)

  31. Paired data • Most commonly, measurements from the same individuals collected on more than one occasion • Can be used to look at differences in mean score: • 2 or more time points e.g. before/after a diet • 2 or more conditions e.g. hearing test at different frequencies Each person listened to a sound until they could no longer hear it at two different frequencies. Would use paired t-test

  32. Paired data: weight loss after diet • The manufacturers claim that their drug will reduce weight without making any dietary changes. Weights before and after the trial were compared for each person • Test: Paired t-test (before/after weights) • Null: The average change in weight loss is 0 • Alternative: The average change in weight loss less than 0(if after – before is calculated)

  33. Paired t-test • A paired t-test is a test of the paired differences (d), NOT the original data • It tests the null hypothesis that the mean of the differences is 0 • For each subject, the difference (change) is calculated • The mean and the SD of the differences are calculated • If there is no change, the mean difference is roughly 0 • These differences need to be normally distributed

  34. Example: Paired t-test Note that the paired data need to be organised in two separate columns ‘After’ and ‘Before’ Analyze Compare Means  Paired-Samples T Test…

  35. Example: Paired t-test Select the pair of variables to be compared. In this case ‘Weight after diet’ and ‘Weight before diet’ Click OK

  36. Example: Understanding the output Basic statistics comparing the two groups IGNORE Key output table

  37. Example: Understanding the output Basic statistics comparing the two groups IGNORE

  38. Example: Reporting the results A paired t-test was conducted to examine whether a particular diet had an impact on weight loss. There is strong evidence to suggest that on the diet did have an impact on weight loss (p=0.004). As p = 0.004, there is only a 0.4% chance (or 1 in 250) of rejecting the null when it is true (type 1 error – claiming a significant difference when there is none) What is the difference? For these data, the average weight loss was 4kgs (95% CI for weight loss: 1.48 to 6.69 kg)

  39. Key assumptions for paired t-test The paired differences are approximately normally distributed Each individual is independent of every other individual(can’t check this statistically, it should be implicit in the design)

  40. Assumption 1: Paired data are approximately normally distributed Graphs  Legacy Dialogs  Histogram Doesn’t need to be perfect, just approximately symmetrical

  41. Exercise 2: Open the file ‘Journey Time’ This file contains data on my journey to and from work. These data are paired by day as each to/from combination represents a particular day Conduct a paired t-test to examine whether it takes me longer to cycle home than it does to cycle to work. Don’t forget to check the assumption that the paired differences are approximately normally distributed (you will need to calculate the differences to do this: (tip: use ‘Transform  Compute variable’ and create a new variable of the differences) What do you conclude?

  42. Paired t-test options Are the paired differences normally distributed? Use the non-parametric Wilcoxon Signed rank test. Report the median of the differences No Yes Paired t-test and report mean difference Analyze Nonparametric tests  Related Samples…

  43. Example: Wilcoxon signed rank test In the Objective tab, make sure that ‘Automatically compare distributions across groups’ is selected Click on the Fields tab Move the two time variables to the Test Fields box Click Run

  44. Example: Understanding the output • Note that the Wilcoxon signed rank test is a test of the median of the differences. It tests the null that the median difference is 0 • As the p-value is 0.013, the result is statistically significant. To make sense of the results, look at key statistics, such as the median difference and report this. Key (only!) output table The p-value is ‘Sig’: 0.013

  45. Categorical outcome

  46. Titanic The Titanic sank in 1912 with the loss of most of its passengers Data: Details can be obtained on 1309 passengers and crew on board the ship Titanic

  47. Example: Chi-squared test Research question: Did class affect survival? Have two categorical variables ‘Class’: First / Second / Third ‘Survival’: Alive / Died Null: There is no relationship between class and survival Alternative:There is a relationship between class and survival This is called a 3 x 2 contingency table

  48. Example: Chi-squared test Analyze Descriptive Statistics  Crosstabs… Move Class to the Rows box and Survived to the Columns box Click on Statistics to open the Statistics dialogue box

  49. Example: Chi-squared test • Click the Chi-squared box • Click on Continue. This will close the • Statistics dialogue box • Back in the main Crosstabs dialogue box click on the Cells box

  50. Example: Chi-squared test • Click Percentages Row box. This will give you the percentages across the row. i.e. within each each level of class (in the columns) it will show the percentage who survived and died • Click Continue. This will close the Cell display dialogue box • Back in the main Crosstabs dialogue box click OK

More Related