<<

STATISTICAL ANALYSIS USING SPSS

Anne Schad Bergsaker 24. September 2020 BEFOREWEBEGIN... LEARNINGGOALS

1. Know about the most common tests that are used in statistical analysis 2. Know the difference between parametric and non-parametric tests 3. Know which statistical tests to use in different situations 4. Know when you should use robust methods 5. Know how to interpret the results from a test done in SPSS, and know if a model you have made is good or not

1 TECHNICALPREREQUISITES

If you have not got SPSS installed on your own device, use remote desktop, by going to view.uio.no.

The data files used for examples are from the SPSS survival manual. These files can be downloaded as a single .zip file from the course website.

Try to do what I do, and follow the same steps. If you missed a step or have a question, don’t hesitate to ask.

2 TYPICAL PREREQUISITES/ASSUMPTIONSFOR ANALYSES WHAT TYPE OF STUDY WILL YOU DO?

There are (in general) two types of studies: controlled studies and observational studies. In the former you run a study where you either have parallel groups with different experimental conditions (independent), or you let everyone start out the same and then actively change the conditions for all participants during the experiment (longitudinal). Observational studies involves observing without intervening, to look for correlations. Keep in mind that these studies can not tell you anything about cause and effect, but simply co-occurence.

3 RANDOMNESS

All cases/participants in a data set should as far as it is possible, be a random sample. This assumption is at the heart of statistics. If you do not have a random sample, you will have problems with unforeseen sources of error, and it will be more difficult to draw general conclusions, since you can no longer assume that your sample is representative of the population as a whole.

4 INDEPENDENCE

Measurements from the same person will not be independent. Measurements from individuals who belong to a group, e.g. members of a family, can influence each other, and may therefore not necessarily be independent. In regular analysis data needs to be independent. For t-tests and ANOVA there are special solutions if you have data from the same person at different points in time or under different test conditions. It is a little more complicated to get around the issue of individuals who have been allowed to influence each other. It can be done, but it is beyond the scope of this course.

5 OUTLIERS

Extreme values that stand out from the rest of the data, or data from a different population, will always make it more difficult to make good models, as these single points will not fit well with the model, while at the same time, they may have a great influence on the model itself. If you have outliers, you may want to consider transforming or trimming (remove the top and bottom 5%, 10%, etc) your data set, or you can remove single points (if it seems like these are measurement errors). Alternatively, you can use more robust methods that are less affected by outliers. If you do remove points or change your data set, you have to explain why you do it. It is not enough to say that the data points do not fit the model. The model should be adapted to the data, not the other way around. 6 LINEARITYANDADDITIVITY

Most of the tests we will run assume that the relationship between variables is linear. A non-linear relation will not necessarily be discovered, and a model based on linearity will not provide a good description of the data.

Additivity means that a model based on several variables is best represented by adding the effects of the different variables.

Most regular models assume additivity. 7 HOMOSCEDASTICITY/CONSTANT

Deviation between the data and the model are called residuals. The residuals should be normally distributed, but they should also have more or less constant spread throughout the model. Correspondingly the variance or spread in data from different categories or groups should also be more or less the same. If the error in the model changes as the input increases or decreases, we do not have homoscedasticity. We have a problem: heteroscedasticity.

8 NORMALITYORNORMALDISTRIBUTION

Most tests assume that something or other is normally distributed (the residuals, the estimates should come from a normal sample distribution, etc.), and use this to their advantage. This is the case for t-tests, ANOVA, Pearson correlation and linear regression. Because of the central limit theorem we can assume that for large data sets (more than 30 cases) the parameter estimates will have a normal sampling distribution, regardless of the distribution of the data. However, if you have much spread in the data or many outliers, you will need more cases. It is usually a good idea to have at least 100 just to be safe. It is still a good idea to check how the data are distributed before we get started on any more complicated analyses. 9 NORMALITY

To check if the data are normally distributed we use Explore Analyze > Descriptive Statistics > Explore

• Dependent list: The variable(s) that you wish to analyze • Factor list: Categorical variable that can define groups within the data in the dependent list. • Label cases by: Makes it easier to identify extreme outliers

10 NORMALITY

Explore: Plots

• Boxplots: Factor levels together - If you have provided a factor variable this option will make one plot with all the groups • Boxplots: Dependents together - If you have provided more than one dependent variable, this will put the different variables together in the same graph • Descriptive: Histogram is usually the most informative choice • Normality plots with tests: Plots and tables that makes it clearer if the data are normal or not 11 NORMALITY

Output: Tests of Normality and Extreme Values

• Tests of Normality: If the data are perfectly normal, sigma will be greater than 0.05. HOWEVER, this hardly ever happens in large data sets. Therefore it is better to look at the plots to decide if they are normal or not. • Extreme values: the five biggest and smallest values.

12 NORMALITY

• Histogram: Here we see that the data are a little skewed, but overall they are almost normal • Box plot: Shows much the same as the histogram

13 NORMALITY

• Normal Q-Q plot: The black line shows where the data should be if it is perfectly normal.Except for the right tail, the data lie fairly close to the line • Detrended normal Q-Q plot: This shows the deviation between the data and the more clearly. There is no clear trend in the deviation, which is a good sign, but we see even more clearly that the right tail is more heavy than expected according to the normal distribution. 14 HELP, MY DATA DO NOT FULFILL THE REQUIREMENTS!

In some cases you will be able to choose a non-parametric test instead, which does not have the same strict prerequisites. Trim the data: Remove the highest and lowest 5%, 10%, 15%, etc, alternatively trim based on standard deviation (usually a bad idea as the standard deviation is heavily influenced by outliers). Windsorizing: Replace the values of extreme data points with the highest (or lowest) value that is not an outlier. Bootstrapping: Create many hypothetical sets of samples, based on the values you already have, and do the same types of analysis on all these samples, to obtain interval estimates Transform variables that deviate greatly from the normal

distribution 15 BOOTSTRAPPING

Bootstrapping is a form of robust analysis, and it is the most commonly used one. It is also very easy to implement in SPSS. Bootstrapping is a method where you get SPSS to treat your sample as a kind of population. New cases are drawn from your sample (and then returned), to create a new sample consisting of N cases. Usually N is equal to the number of cases in your sample. This is done as many times as you want, typically at least 1000 times, to create the same number of new samples. For each sample, the statistical parameters you ask for are calculated. Based on the results from all of the samples, interval estimates for each parameter is given, e.g.˙for mean or correlation coefficient.

16 TRANSFORMATION OF ’ABNORMAL’ DATA

Last resort, as it can make it harder to interpret the results.

17 NUMBEROFCASES/DATA MEASUREMENTS

There is no single number of cases needed to use a specific statistical test, or to obtain significance. It will depend on the type of analysis and the size of the effect your are looking for. The smaller the effect, the more cases you need. The central limit theorem states that even though the population the data is taken from is not normal, the estimates you create will have a normal sample distribution as long as you have enough data, typically you need at least 30 cases. However, 30 cases is the absolute minimum, and is not always enough. If you have data with a high variance, you will need more than 30 cases, and if you wish to compare groups, the different groups should also have more than 30 cases each.

18 EXPLORERELATIONSHIPBETWEEN VARIABLES CORRELATION

Correlation measures the strength of the linear relationship between variables. If two variables are correlated, a change in one variable will correspond with a change in the other. Correlation is given as a number between -1 and 1, where 1 indicates a perfect correlation. If one variable increases in value, the other will increase. This does not mean that an increase of 1 in one variable, will give an equal increase in the other. Correlation equal to -1 is also a form of perfect correlation, but it indicates that an increase in one variable corresponds to a decrease in the other variable. This is called a negative correlation. Correlation equal to 0 means that there is no relationship between the variables. If one increases, the other will change at random. Pearson correlation is a parametric test. Spearman correlation and Kendall’s tau are non-parametric. If you have significant outliers you should use one of these instead. 19 CORRELATION

20 CONDITIONSFORREGULAR/PEARSON CORRELATION

You need two (or more) continuous variables The relationship between the variables should be linear There should not be any very distinct outliers The variables should be approximately normal, but this is only very important if you have small data sets. If you wish to study correlation between ordinal and continuous variables you should use Spearman or Kendall’s tau. If you have non normal data, or fewer cases than 30 you can use either Spearman or Pearson correlation in combination with bootstrap.

21 CORRELATION

Find correlation between two continuous variables: Analyze > Correlate > Bivariate We use the data set survey.sav. Select the variables you want to investigate. Make sure that Pearson and Two-tailed are selected. If you are unsure which type of correlation to calculate, select Spearman and Kendall’s tau too.

22 HANDLING OF MISSING DATA

Choose Exclude cases pairwise, to include as much data as possible in the analysis. This will only exclude cases when there is a missing value in one of the two variables being compared at a time. Exclude cases listwise will exclude all cases that have missing data points in at least one of the variables included in the analysis. In this case it makes no difference, as we have two variables, but with more than two it can make a difference.

23 BOOTSTRAPPING

If you are not sure if you have enough data for the central limit theorem to save you from a lack of a normal distribution, you can get SPSS to run a quick bootstrapping at the same time. Select Perform bootstrap, and choose how many samples. 1000 is default and is usually enough, but if you want, you can increase it to 2000. Choose Bias corrected accelerated. 24 CORRELATION

The bootstrapping calculates confidence intervals for our estimates of the sample mean and correlation coefficients. The CIs support what the significance suggests, i.e. that we have a significant correlation, and that in this case, the variables are highly correlated. (Small effekt: r≥0.1, Medium: r≥0.3, Large: r≥0.5).

25 CORRELATION

Find grouped correlation between two variables

• In order to find correlation between variables for different groups in your sample, you can use Split File. • Data > Split File > Compare groups • Run the same correlation analysis 26 PARTIAL CORRELATION

Analyze > Correlate > Partial Used when you wish to see how correlated two variables are, while taking into account variation in a third variable, that may or may not influence the two variables you are interested in. Move the variables of interest into the box labeled Variables, and the one you wish to control for into Controlling for. 27 PARTIAL CORRELATION

It is useful to select Zero-order correlations. This gives you something to compare with, as SPSS will then also show the correlation between variables without taking into account variation in the control variable.

28 PARTIAL CORRELATION

Correlation where we control for variation in one or more other variables can be compared to the correlation without. If these are identical, the control variable has no effect. In most cases the correlation will be somewhat reduced, but sometimes the change will be large enough to reduce the correlation substantially (confounding).

29 LINEARREGRESSION

This is used to look for a linear relationship between variables. Is it possible to "predict" how someone is likely to score on one variable, based on where they score on others? The errors we make (deviation between sample and population) must be independent Should have many more cases than variables. Rule of thumb is N>50+8m, where m is the number of independent variables. This rule is somewhat oversimplified. It is a common misconception that independent variables must have a normal distribution, but this is not necessary. Deviation between measurements and predicted values are called residuals, and these need some extra attention after you

have created your model. 30 NUMBEROFCASESNEEDED

The number of cases needed will not only depend on the number of predictors/independent variables, but also on the size of the effect you are looking for. (Based on a figure from Field (2017).)

31 ASSUMPTIONSOFLINEARREGRESSION

You should have a continuous dependent variable, and one or more continuous or dichotomous independent variables. There should be a linear relationship between the dependent variable and all the independent variables, and the combined effect of all the dependent variables should best be expressed as a sum of all the contributions. Observations should be independent, and you should not have extreme outliers. Data should be homoscedastic (check after you have made the model) The residuals should have a normal distribution (check after you have made the model) If you have more than one independent variable, these should not be strongly correlated with each other, i.e. no multicollinearity. 32 LINEARREGRESSION

Analyze > Regression > Linear We use the data set survey.sav. Move the dependent variable to the box labeled Dependent, and start with a selection of independent variables that you want to include in your model, and move them into the box labeled Independents. Click Next.

33 LINEARREGRESSION

Add the rest of the independent variables you want to include in the box labeled Independents. If you wish to compare with an even more complicated model you can click Next again and add more variables. If you want all variables to be included from the start, you add all variables in the first block, without making more . 34 LINEARREGRESSION

Linear Regression: Statistics Make sure that Estimates and Confidence intervals are selected in Regression Coeff., and include Model fit, R squared change, Descriptives, Part and partial correlations, Collinearity diagnostics and Casewise diagnostics. This will give a good overview of the quality of the model.

35 LINEARREGRESSION

Linear Regression: Options

Go with the default option. This is one of few analyses where it is better to use Exclude cases listwise rather than Exclude cases pairwise. If you use pairwise exclusion, you risk getting absurd results from your model, e.g. that it explains more than 100% of the variation and such. 36 LINEARREGRESSION

Linear Regression: Plots The most useful thing to look closer at is the residuals. Therefore we plot the standardized predicted values (ZPRED) against the standardized residuals (ZRESID). In addition we choose Histogram, Normal probability plot and Produce all partial plots.

37 LINEARREGRESSION

Linear Regression: Save

To check if we have any outliers we should be concerned with, or any cases that are overly influential, we save a few variables associated with the residuals and the predicted values. These are added as separate variables on the right end of your data set.

38 LINEARREGRESSION

Descriptives provide the usual descriptive statistics for all included variables, both dependent and independent. Correlations present the Pearson correlation between the different variables. Here you can check if the independent variables correlate with the dependent variable, and if any of the independent variables are very highly correlated. Correlation between independents over 0.9 is a bad sign. 39 LINEARREGRESSION

R Square indicates how much of the variation in the dependent variable is explained or described by the model (multiply with 100 to get %). The ANOVA table indicates if the model in itself is significant. In this case both models are significant, but model 2 describes more of the variation in the dependent variable.

40 LINEARREGRESSION

Coefficients lists the parameters that indicates the effect of each variable (B), and if these are significant (Sig.). Beta lets you compare the effect of each variable with the other, as if they were measured on the same scale. VIF is a measure of multicollinearity. Values over 10 are a cause for concern.

41 LINEARREGRESSION

Especially the Mahal. Distance and the Cook’s distance are useful to see if you have outliers and unusually influential cases. With four independent variables the critical upper limit for Mahalanobis is 18.47. The case in the data set that has a value of 18.64 can be located in the data set, but it is only mildly larger than the critical value, so we will not worry about it. Critical value for Cook’s is 1. Anything below that is fine.

42 LINEARREGRESSION

The residuals are fairly close to a normal distribution, so there is no reason to be worried about violating this assumption. If there had been, we should have tried with bootstrapping, to obtain more reliable CIs and significance measures.

43 LINEARREGRESSION

The P-P plot shows the actual residuals plotted against what you would expect, given a normal distribution.These should follow the black line, and in this case they do, strengthening the assumption that the residuals are normally distributed.

44 LINEARREGRESSION

Predicted values plotted against residuals can be used to check if the data are homoscedastic. If the points have a funnel shape, it indicates heteroscedasticity, and we should use more robust methods. The blob shape that we have is what you want.

45 LINEARREGRESSION

Final check of linearity and correlation is to look at the scatter plots of all independent variables against the dependent variable. Not surprisingly we see little indication of correlation between the dependent variable and the two independent variables that were not significant.

46 LINEARREGRESSION

Plotting the standardized residuals against the independent variables we can check if we have independence of errors. Here we want no clear trends.

47 EXPLORE THE DIFFERENCE BETWEENGROUPS A SMALLDISCLAIMER

Even though t-tests and ANOVA usually are presented as techniques that are completely different from linear regression, when the fact of the matter is that they are based on the same basic mathematical model. The reason they are kept separate is more historical than anything else, and SPSS holds on to this separation even though it is quite artificial.

48 T-TEST

Compare data from two different groups, in order to determine if the two are different. t-tests are usually used to analyze data from controlled studies. Be aware that there are generally two different types of t-tests; one for independent groups, and one for paired samples, where data are collected from the same participants at two different times (repeated measures) If the assumptions of the t-test are not met, you can use Mann Whitney U test (for independent samples), Wilcoxon Signed Rank test (repeated measures), t-test combined with bootstrap, or a robust version of the standard t-test.

49 ASSUMPTIONSOFTHEINDEPENDENTT-TEST

You need a continuous dependent variable and a dichotomous categorical variable. Independent observations/groups. This means that each participant can only be part of one of the groups, e.g. men and women, smokers and non-smokers, etc. Random selection No extreme outliers If you have a small sample (less than 30), the dependent variable should be normally distributed within each of the categories defined by the independent variable. The variance of the dependent variable should be approximately equal in the two categories defined by the categorical variable. The groups should also be similar in size. 50 T-TEST

Analyze > Compare Means > Independent Samples T Test

We will use the data set survey.sav. Move the dependent continuous variable into the box labeled Test Variable(s), and the independent categorical variable into Grouping Variable. Even if you can test more than one dependent variable at a time, you should not do so. Use MANOVA instead.

51 T-TEST

Click Define Groups...

Here you have to remember how you have coded the categorical variable. Indicate what the two groups are. In this case sex is coded as 1=Man and 2=Woman, so we write 1 and 2 and click Continue. If the codes had been 0 and 1, we would have written those values.

52 T-TEST

Group Statistics provides some descriptive statistics relating to the different groups, such as mean, standard deviation. Independent Samples Test shows what the difference between the groups are (Mean difference), and if the difference is significant (Sig. 2-tailed). If Levene’s test is not significant (column 2), we can look at the results from the first row (Equal assumed). The t-test in this case is not significant.

53 MANN WHITNEY U TEST

Non-parametric version of a standard t-test for independent samples. You need a continuous dependent variable and a dichotomous independent variable. If you have many extreme outliers you might consider using this test.

Analyze > Nonparametric Tests > Independent Samples

Choose Customize analysis and click Fields

54 MANN WHITNEY U TEST

Choose Use custom field assignments, and move the dependent variable into the box labeled Test Fields. Move the independent variable to Groups, and click on Settings.

55 MANN WHITNEY U TEST

Go to the Settings tab. Under Choose tests, select Mann-Whitney U (2 samples), and click Paste.

56 MANN WHITNEY U TEST

The summary of the test shows the hypothesis we are testing against (no difference between groups), and what the conclusion of the test is, based on significance. In this case there is no significant difference between the groups, and we retain the null hypothesis.

57 MANN WHITNEY U TEST

The significance value of the test, with corresponding test statistic is shown in the table Independent Sampes Mann-Whitney U.... The histograms of the two groups supports the result of the test, that there is no significant difference between the groups.

58 ASSUMPTIONSOFREPEATEDMEASUREST-TEST

You need a continuous dependent variable measured at two different times, or under two different conditions Random selection There should be no extreme outliers in the difference between the two sets of measurements The difference between the two measurements should be normally distributed, at least if you have a small sample The data should be organized so that each participant has one row, with two different variables representing the data from the two different points in time/conditions

59 T-TEST (REPEATED MEASURES)

Analyze > Compare Means > Paired Samples T Test

We will use the data set experim.sav. Move the variable containing measurements from time 1 to the box called Paired Variables. Move then the variable containing the second set of measurements into the same box.

60 T-TEST (REPEATED MEASURES)

Paired Samples Statistics shows descriptive statistics such as mean and standard deviation for the two different variables. Paired Samples Correlations provides the correlation between measurements from the two different variables.

61 T-TEST (REPEATED MEASURES)

The final table shows if the test is significant or not, and what the average difference is. Here the difference is 2.67, and the test is highly significant (p<0.001).

62 WILCOXON SIGNED RANKTEST

Non-parametric alternative to the repeated measures t-test. You need a continuous variable measured on two different occasions. This test is more suitable than a t-test if you have many outliers. Analyze > Nonparametric Tests > Legacy Dialogs > 2 Related Samples

Move the data from time 1 to Test Pairs, then the data from time 2. Check the box next to Wilcoxon.

63 WILCOXON SIGNED RANKTEST

Two-Related-Samples: Options Select Quartiles (and Descriptives if you want some basic descriptive statistics as well).Exclude cases test-by-test will include all cases that have data on both occasions, but that may still miss data in other variables.

64 WILCOXON SIGNED RANKTEST

Descriptive Statistics presents the quartiles. Here we can see that there are signs of differences between the two sets of measurements, since all quartiles from time 2 are lower than for time 1. Test Statistics confirms this (p<0.001). The effect size can be calculated by using r=z/(2*N) where N is number of cases, in this case -4.18/(2*30)=0.54, corresponding to a large effect.

65 ANOVA -

Compare continuous data from two or more different groups, to see if the groups differ This test must be adjusted to whether you have independent groups (different people in each group), or if you have repeated measures (the same people in each of the groups). ANOVA assumes that all groups have similar variance. Alternative if assumptions are not met: Kruskal Wallis test, Friedman’s ANOVA, bootstrap and other robust methods

66 ASSUMPTIONSOFINDEPENDENT ANOVA

You need a continuous dependent variable, and a categorical independent variable with at least two categories. Independent measurements. Participants can only belong to one of the categories in the independent variable, and different participants should not be able to affect each other. Random sample No extreme outliers The dependent variable should be approximately normally distributed within each of the categories in the independent variable. The variance in each group should be similar. Groups should also be of similar sizes. 67 ANOVA - ANALYSIS OF VARIANCE

Analyze > Compare Means > One way ANOVA

We will use the data set survey.sav. Move the dependent variable to the box labeles Dependent List, and the categorical variable to Factor.

68 ANOVA - ANALYSIS OF VARIANCE

One way ANOVA: Options

Select Descriptive, Homogeneity of variance, Brown-Forsythe and Welch under Statistics, and choose Means plot. To include as much data as possible in your analysis, choose Exclude cases analysis by analysis.

69 ANOVA - ANALYSIS OF VARIANCE

One way ANOVA: Post Hoc Multiple Comparisons

You can choose from a wide selection of post hoc tests. Check the SPSS documentation for details about each test. We choose Tukey (if we have more or less equal variance and group sizes), Bonferroni (controls for type I errors) and Games-Howell (in case of difference in variance).

70 ANOVA - ANALYSIS OF VARIANCE

Descriptives shows some basic descriptive statistics for the dependent variable for each of the groups in the independent variable.

71 ANOVA - ANALYSIS OF VARIANCE

Test of Homogeneity... shows if we can assume equal variances. Here the null hypothesis is that they are equal, so we want Sig. to be greater than 0.05. Robust Test of Equality of Means shows the test results we should use if the variances are different. In this case there are significant differences between the groups.

72 ANOVA - ANALYSIS OF VARIANCE Since we can assume equal variances, we can also look at the regular ANOVA, which supports the conclusion of the robust tests, that there is a singificant difference between groups (Sig.=0.01). The results of the post hoc tests show which groups differ. Here we can see that there is only a significant difference between the oldest and the youngest participants. 73 ANOVA - ANALYSIS OF VARIANCE

The mean of the dependent variable in each age group is plotted against age group, and indicates a clear trend with increasing optimism with age.

74 KRUSKAL WALLIS

Non-parametric alternative to ANOVA for independent groups. You need a continuous dependent variable and a categorical independent variable with two or more groups. Analyze > Nonparametric parametric Tests > Independent Samples

In the Fields tab, move the dependent varialbe to Test Fields, and the independent categorical variable to Groups.

75 KRUSKAL WALLIS

Under Settings, choose Kruskal-Wallis 1-way ANOVA, and make sure that Multiple comparisons is set to All pairwise. Choose Test for Ordered Alternatives if the categorical variable is ordinal. Click Paste.

76 KRUSKAL WALLIS

Hypothesis Test Summary shows what the null hypothesis is, and if it should be rejected. In this case the test states that we should go with the alternative hypothesis, that there is a significant difference between groups. Specific test statistics and significance is shown inn Independent-Samples Kruskal-Wallis...

77 KRUSKAL WALLIS

Boxplots of the data from the different age groups look like they support our conclusion that optimism is higher in older participants.

78 KRUSKAL WALLIS

Pairwise comparisons... show that there is only a significant difference between the first and the last age groups.

79 ASSUMPTIONSOFREPEATEDMEASURES ANOVA

You need a continuous variable measured at two or more occasions or experimental conditions Random selection No extreme outliers The dependent variable should be approximately normally distributed at each of the occasions The variance of the dependent variable should be similar for all occasions The variance of the difference between all possible combinations of occasions should be more or less equal for all combinations (called sphericity). If sphericity cannot be assumed, correction must be made. 80 ANOVA - ANALYSIS OF VARIANCE (REPEATED MEASURES)

Analyze > General Linear Model > Repeated Measures

We will use the data set called experim.sav. First we must ’create’ the factor variable indicating the different occasions or experimental conditions. All we have to do is provide a name and the number of levels, and click Add.

81 ANOVA - ANALYSIS OF VARIANCE (REPEATED MEASURES)

After clicking Add, this factor will appear in the window below. We can then go ahead and click Define.

82 ANOVA - ANALYSIS OF VARIANCE (REPEATED MEASURES)

The three levels of the factor we created are listed as three separate variables. These must be defined by clicking level 1, and move the variable containing the measurements of the dependent variable at time 1 over to the box labeled Within-Subjects Variables.

83 ANOVA - ANALYSIS OF VARIANCE (REPEATED MEASURES)

When all the variables representing different occasions / experimental conditions are added, it will look like this. All three levels in the factor have been defined by a variable in the data set.

84 ANOVA - ANALYSIS OF VARIANCE (REPEATED MEASURES)

Repeated Measures: Model

Make sure that Full factoral is selected.

85 ANOVA - ANALYSIS OF VARIANCE (REPEATED MEASURES)

Repeated Measures: Options

Choose Descriptive statistics and Estimates of effect size. If you wish you can also select Parameter estimates.

86 ANOVA - ANALYSIS OF VARIANCE (REPEATED MEASURES)

Repeated Measures: Profile Plots

Move time to Horizontal axis, and click Add. Choose either Line chart or Bar chart (depending on what you prefer). Select Include Error Bars.

87 ANOVA - ANALYSIS OF VARIANCE (REPEATED MEASURES)

Repeated Measures: Estimated Marginal Means

Choose time and move it to Display Means for. Check the box labeled Compare main effects and choose Bonferroni (it is the strictest). Click Continue and Paste.

88 ANOVA - ANALYSIS OF VARIANCE (REPEATED MEASURES)

Descriptive Statistics shows the mean and standard deviation for the dependent variable for each of the different occasions. Multivariate Tests shows significance. Here you can choose the test that is most usual to use in your field. Sig. less than 0.05 indicates a significant difference.

89 ANOVA - ANALYSIS OF VARIANCE (REPEATED MEASURES)

Mauchly’s test of sphericity shows if sphericity can be assumed or not. The null hypothesis is that sphericity can be assumed. If Sig. is less than 0.05, then we need to reject the null hypothesis, and this must be kept in mind when interpreting the rest of the results.

90 ANOVA - ANALYSIS OF VARIANCE (REPEATED MEASURES)

Since we cannot assume sphericity, we must base our conclusion on the three other measures of significant difference. The strictest is Lower, and in this case even this test is significant. We also have significance for the test that there is a linear relationship between the time factor and our dependent variable (see Tests of within-subjects contrasts table). 91 ANOVA - ANALYSIS OF VARIANCE (REPEATED MEASURES)

The mean of the dependent variable at each time is shown with the corresponding standard error and confidence interval are presented in Estimated Marginal Means. Pairwise comparisons show that there is a significant difference between all levels, together with the corresponding average difference.

92 ANOVA - ANALYSIS OF VARIANCE (REPEATED MEASURES)

The mean at each of the three occasions is plotted against time, including the uncertainty given by the confidence intervals. This graph shows the linear trend in the participants’ fear of statistics, and how it decreases with time.

93 FRIEDMAN’S ANOVA

Non-parametric alternative to the repeated measures ANOVA. You need a continuous dependent variable that has been measured at two or more occasions/conditions. Analyze > Nonparametric Tests > Legacy Dialogs > K Related Samples

Move the variables representing the different occasions/conditions to the box labeled Test Variables.

94 FRIEDMAN’S ANOVA

Several Related Samples: Statistics. Select Quartiles and (if you wish) Descriptives.

Several Related Samples: Exact. Choose Exact under Exact tests.

95 FRIEDMAN’S ANOVA

Descriptive statistics show quartiles for each occasion.Ranks provide the mean rank at each of the three different times. Average rank seems to decrease with time, suggesting that there is a relationship between time and fear of statistics. Test Statistics tells if the test is significant or not (Asymp. Sig.<0.05).

96 MIXED ANOVA

This is used when you want to compare both independent groups, while also looking at measurements on the same individuals from different times/conditions. Analyze > General Linear Model > Repeated Measures Like regular repeated measures ANOVA, we have to create the factor that includes the different times/conditions. Give it a name, provide the number of levels and click Add, before

clicking Define. 97 MIXED ANOVA

Move the variables corresponding to the different levels of the dependent repeated measures variable to the window Within-subjects variables. Move the factor containing independent groups to the window Between-subjects factors.

98 MIXED ANOVA

Repeated Measures: Options

Choose Descriptive statistics, Estimates of effect size, Parameter estimates and Homogeneity tests.

99 MIXED ANOVA

Repeated Measures: Profile Plots

Move the repeated measures factor (here time) to Horizontal Axis, and the factor with independent groups to Separate Lines, and click Add. Select Line Chart and check the box for Include Error Bars.

100 MIXED ANOVA

Mean and standard deviation for the two independent groups at each of the three time points.

101 MIXED ANOVA This is a test of covariance between different groups and times. The null hypothesis is that covariance is equal. If this test is not significant, we can assume that covariance does not vary, i.e. that correlation between different times within different subgroups defined by the independent variable are the same, which is what we want. Keep in mind that this test can give significant results for large data sets, even when covariances are equal. 102 MIXED ANOVA

The first four rows in Multivariate tests indicate that there is a significant effect of time. The next four rows indicate that there is no significant effect of the combined factor containing time and groups.

103 MIXED ANOVA

Levene’s test suggests that there is constant variance in the error that the model makes, as none of the tests are significant. Tests of Between Subjects effects shows that the groups in the independent variable are not significantly different from each other (p=0.81).

104 MIXED ANOVA

The graph of fear of statistics vs. time for the two different groups strengthens the impression that there is no significant difference between the groups, as the two lines follow each other pretty closely.

105 ANOVA - ANALYSIS OF VARIANCE

Other types of ANOVA

• Two way ANOVA - More than one independent categorical variable. This allows you to look at difference between more than one type of group, e.g. not just gender, but also age group as well. • ANCOVA () - Perform ANOVA, while also taking into account one or more continuous variables. • MANOVA (Multiple ANOVA) - Look at differences between groups, within more than one continuous dependent/outcome variable at the same time

106 CATEGORICAL OUTCOME VARIABLES CHISQUARED(χ2) TEST

You can use this to test if the distribution of data within categorical variables is random or not, i.e. if there is a correlation between categorical variables. This is a non-parametric test, so here we do not need to worry so much about data distribution. However, assuming a random distribution, none of the groups defined by the categorical variables should be too small. If you use two variables with two groups each, this results in 2 × 2 = 4 subgroups. None of these subgroups should have an expected frequency less than 5. For greater tables, at least 80% of the groups should have an expected frequency of 5 or more. Observations should be independent, so the two variables should for instance not represent pre/post test. If you have data like this you should use McNemar’s test instead. 107 CHISQUARED(χ2) TEST

Analyze > Descriptive Statistics > Crosstabs...

We use the data set survey.sav. Move one of the categorical variables to Row(s) and the other to Column(s). Select Display clustered bar charts if you want.

108 CHISQUARED(χ2) TEST

Crosstabs: Exact Choose Exact instead of Asymptotic only. That way you run Fisher’s exact test, which is useful especially if you have few cases or low expected frequencies in subgroups. If this is not the case, no correction will be applied to the data anyways, and no harm is done. 109 CHISQUARED(χ2) TEST

Crosstabs: Statistics Select Chi-square, Contingency coefficient, Phi and Cramer’s V and Lambda, so that we get the correct test (χ2) and a measure of effect size (Phi/Cramers V). Lambda provides a measure of how much smaller the error we get is, if group membership within one variable is predicted based on group membership in the other variable. 110 CHISQUARED(χ2) TEST

Crosstabs: Cell Display

Select both Observed and Expected in Counts. In addition, select Row, Column and Total in Percentages, and Standardized in Residuals.

111 CHISQUARED(χ2) TEST

The contingency table shows how cases are distributed between the (in this case) four different subgroups, as well as the expected frequencies. The residuals show the difference between the real frequencies and the expected frequencies. If the residual is greater than 2.0 (for a 2×3 table or greater), the difference is much greater than expected.

112 CHISQUARED(χ2) TEST

For larger tables, the most important value in Chi-Square Tests is Pearson Chi-Square. For us (with a 2×2) we should rather use Continuity Correction. Since this is not significant, there is no significant difference between smoking for men and women. With a 2×2 Small effect: 0.1, Medium effect: table, we should report phi 0.3, Large effect: 0.5. as a measure of effect. For larger tables you should use Cramer’s V instead. 113 CHISQUARED(χ2) TEST

The bar chart shows what the test has already shown, that there is no significant difference between men and women when it comes to smoking, as the bars are almost the same sizes for men and women.

114 LOGISTICREGRESSION

This is used when you have a categorical outcome variable, i.e. when you are trying to predict group membership based on continuous and/or categorical variables. Not dependent on normal distribution, but it is important that all groups/categories are well represented. Multicollinearity between independent variables is important to watch out for.

115 ASSUMPTIONSOFLOGISTICREGRESSION

You need a dependent categorical variable, where the categories are mutually exclusive. It cannot be possible to belong to more than one category or group You have one or more independent variables that are either continuous or categorical Observations are independent If you have several continuous independent variables, these should not be heavily correlated All categories in the categorical variable should be well represented There should be a linear relationship between predictor and the logit transformation of the outcome variable 116 LOGISTICREGRESSION

Analyze > Regression > Binary Logistic

We will use the data set sleep.sav. Move the dependent variable to Dependent and the independent variables you wish to include, into Covariates. Click Categorical...

117 LOGISTICREGRESSION

Logistic Regression: Define Categorical Variables

All categorical variables must be specified as categorical, in order for them to be handled correctly. Here you can choose which category is going to be the reference category. Click the variable, select First or Last, and click Change. 118 LOGISTICREGRESSION

Logistic Regression: Options

Select Hosmer-Lemeshow goodness-of-fit, Casewise listing of residuals, CI for exp(B) and Include constant in model. Click Continue and Paste.

119 LOGISTICREGRESSION

The first part of the output provides information on the number of cases, and how the outcome variable is coded. This is useful to remember when interpreting the rest of the results. The reference group for the outcome is coded as 0, in this case no.

120 LOGISTICREGRESSION

Corresponding coding for all the independent categorical variables, including frequencies for each category. Groups coded as 0 are reference groups, because we chose the first group to be the reference. Classification table shows the results of the model we compare with, i.e. the simple model with no independent variables.

121 LOGISTICREGRESSION

Omnibus test shows the significance of the whole model, which should be below 0.05. Cox & Snell R Square and Nagelkerke R Square estimates how much variation in the outcome is described by the model. Hosmer-Lemeshow tells us if the model is good. Here we want Sig. greater than 0.05.

122 LOGISTICREGRESSION

With our model, we can now correctly predict 75.1% of the outcomes, compared to 57.3% with the simple model. For those cases where prediction is incorrect, the cases with a greater residual than 2 are listed in Casewise list. If the residuals are greater than 2.5, these should be examined more closely. There might be a reason why these particular cases are not described well by the model.

123 LOGISTICREGRESSION

The model itself is presented in Variables in the Equation. Column B and Exp(B) show effect size, and Sig. shows significance. If Exp(B) is greater than 1 for a specific variable, it means that the odds of ending up in group 1 in the outcome, is greater if you either increase the value of the predictor (continuous), or belong to that specific group rather than the reference group (categorical). Those who struggle to fall asleep (prob fall asleep=1) have 2.05 times higher odds of having problems sleeping (prob sleep=1).

124 LOGISTICREGRESSION

To test linearity, you can calculate the natural logaritm of all continuous variables (e.g. LN(age), LN(hourwnit)). The interactions LN(variable)×variable can then be included in the logisitic regression model. If these interactions are not significant, the assumption is correct.

125 LOGISTICREGRESSION

To check for multicollinearity, you must use ordinary linear regression, but with exactly the same dependent and independent variables as in the logistic regression model. Select Collinearity Diagnostics under Statistics in the dialog box. VIF<10 is the requirement.

126 BACK TO THE STUDY HALL/OFFICE

Start using SPSS as quickly as possible on your own data (or someone else’s for that matter)! The only way to improve your understanding of statistics and SPSS, is to use it. Learning by doing. Make sure you have good textbooks and online resources when you need to check something. A decent online tutorial can be found e.g. at https://libguides.library.kent.edu/SPSS If SPSS throws a warning at you saying something about how "validity of subsequent results cannot be ascertained", it REALLY means that you CANNOT trust your results, even if they look good. You need to change your analysis. Ask google or youtube when you get stuck. If that doesn’t help, ask us ([email protected])! 127 SUGGESTEDBOOKS

In SPSS: SPSS Survival manual by Julie Pallant

In statistics and SPSS: Discovering statistics using IBM SPSS and An adventure in statistics by Andy Field

128