Teaching home - Stats - Department - University - Resources - Contact - NPHolmes' lab - NPHolmes' personal
Teaching home - Course #PYM0S1-2

SPSS #3: Syntax, nonparametric tests, & GPower


  1. Using SPSS syntax windows
  2. The question variables in the survey data
  3. COMPUTE to create new variables
  4. Editing & re-running syntax
  5. CASE SUMMARIES to check computed variables: Controlling appearance of items in output
  6. Recall dialogue box (shortcut to save going through the menu)
  7. RECODE before computing a new variable
  8. Analysing the new variables
  9. A non-parametric test: Mann-Whitney vs. independent t-test
  10. Estimating study effect size from t-test output
  11. Choosing between parametric and non-parametric tests
  12. Other non-parametric tests
  13. Saving & re-using syntax
  14. Power analysis with GPower

Note: SPSS is of little use for examining effect sizes and power, so we will use GPower to look at power analysis in this practical.

  1. Using SPSS syntax windows
  2. Start SPSS, re-open the survey data file from your M drive, that you saved previously. I assume that you have defined suitable missing values for all variables, & variable labels for the discrete variables sex, ethnicgp & skill. If not, look back at the previous worksheets & define these before going on.

    So far, all the procedures you have performed have been run from the menu using the dialogue boxes. But these settings are temporary, & don't provide a record of what you did. It is often extremely useful to store a record of the procedures that you used, enabling you to run the same commands later, or on a different dataset. This is achieved by means of a Syntax Window.

    A Syntax Window contains SPSS program statements which specify the analyses requested from a dialogue box. The program statements are written in a simple language. You don't have to learn this language, SPSS writes it for you, but it's easy to understand.

    The statements can be saved, giving a permanent record of your procedures. In addition, as shown below, the Syntax Window can be used to run procedures, as an alternative to going through the dialogue boxes.

    Try this out first by repeating an analysis that you ran before, either Crosstabs to test the association between sex & ethnicgp, or an independent-sample t-test to compare mean age between males & females.

    Re-open the dialogue box for Crosstabs or Independent-Samples T-test.

    Somewhere in the dialogue box there is a button marked Paste. This is used to create syntax statements. At the moment it is probably greyed out - it will not work until you have set up the variables, etc., needed for the procedure.

    Set up the variables in the dialogue box. For Crosstabs, define a row & column variable, click Statistics & choose a test. For Independent-samples T-test, insert the grouping variable, click Define Groups & insert the number values of the two groups, then insert a Test variable (the dependent variable).

    Do not click OK. You will use the Paste button before running the test.

    When you have defined enough parameters for the test to run, the Paste button will become available. Click on it.

    SPSS does not run the procedure, but instead "pastes" a statement specifying this procedure into a new window called a Syntax Editor.

    Look at the Syntax Window; it may appear automatically, but if you can't see it, you can reach it via Window in the main menu, or from the Windows Taskbar.

    Now run the commands you pasted, from the Syntax window, as follows:

    Make sure you are in the Syntax Window.

    You can run the whole of the syntax, or select just one command or a few commands that you wish to run. To select command(s), highlight with the mouse. A command is a section of syntax beginning with a keyword such as CROSSTABS or T-TEST, & ending with a full stop(.).

    To run the syntax, or the selected commands, click the button on the tool bar, or use Run from the Syntax Editor menu. Notice what happens; examine the output.

    The output is the same as what you would obtain if you run the same procedure from the dialogue box. (If you want to check this, re-open the dialogue box, don't change anything, click OK; the same output will be produced. You now have two identical bits of output. You can delete one by clicking on it in the left pane of the output viewer, and pressing Delete.)

    Every time you paste the syntax from any dialogue box, it will be added to the currently open Syntax Window.

    Save your syntax to drive M:\ regularly; select File | Save when in the Syntax Window. The first time you do this it will ask for a file name, so specify one. SPSS automatically adds the extension .sps.

    After saving syntax, do not close the Syntax Window: either minimise it, or switch back to the data or output window. The Syntax Window remains available, & next time you Paste, the new syntax will be appended to the window.

    Throughout the rest of this handout, always use the Syntax Window, either in addition to, or instead of, clicking OK in the dialogue box. There are several different ways to use syntax, examples will be given in the following sections.

    Get accustomed to using Syntax Windows & files. We will expect you to save your syntax when carrying out SPSS course assessments, so that your report can include a list of the commands used.

  3. The question variables in the survey data
  4. We will now focus on variables quest1 to quest13 (workers' responses to questions about their work). In the next section you will learn what the questions are, & convert the scores to more interpretable variables. First, ensure that their missing-values and value labels are defined.

    All these variables must have 0 defined as a missing value: You may have done this last session, but if not, do it now.

    Define value labels for all variables quest1-quest13 as follows:

    1=Strongly negative; 2=Negative; 3=Undecided; 4=Positive; 5=Strongly positive.

    You don't need to do this 13 times: Define the value labels for one of them (in Variable View, click on its Values cell, then on the button, & add the 5 labels). Then copy the contents of this cell to the Values cell of all the other quest variables.

    Save the file.

  5. COMPUTE to create new variables
  6. Here is what the quest variables refer to:

    VariableQuestionResponse 5 =
    quest1Commitment (how strongly I want to stay with this employer)High commitment
    quest2-54 questions on job satisfaction
    quest2 & quest4
    quest3 & quest5

    High satisfaction
    Low satisfaction
    quest6-94 questions on autonomy (how much freedom of choice at work?)High autonomy
    quest10-134 questions on routine (how boring or unvarying is work?)High routine

    We will use the scores from these questions to make 4 new variables: Measures of commitment, satisfaction, autonomy, & routine.

    The COMPUTE procedure is used to create new variables. This is a common practice when analysing questionnaires. The 4 new variables will be as follows:

    commit: Equal to score on quest1 (commitment to employer)

    satis: Sum of scores from the 4 questions on job satisfaction, quest2-quest5. But, note that quest3 & quest5 scores must first be changed because they are "reverse-coded" (high score=low satisfaction)

    auton: Sum of scores from 4 questions on autonomy, quest6-quest9 (all same coding, high score=high autonomy)

    routine: Sum of scores from 4 questions on routine, quest10-quest13 (all same coding, high score=high routine)

    Start with new variables commit, auton, & routine which are simpler - satis will be done later as it needs more preparation.

    From the menu, click on Transform. The resulting menu includes Compute (also Recode which you will use later). Select Compute Variable....

    This dialogue box allows you to compute a new (Target) variable using one or more existing variables. The computation formula is written in the Numeric expression box, using the existing variable names (from the list on the left) &, if required, the calculator keypad or the functions (on the right). The following examples should make this clear.

    The following sections will illustrate various ways of using syntax. Sometimes you run the procedure from the dialogue box, then paste the syntax; sometimes only paste and run the syntax; sometimes edit and run syntax without using a dialogue box.

    Your first COMPUTE simply makes the new variable commit equal to quest1.

    To achieve this, type commit in the text box labelled Target Variable. In the large text box Numeric Expression, either type in quest1, or select this variable from the list on the left side of the dialogue box, & click the arrow to copy it into the Numeric Expression text box.

    Click OK to run the procedure. Do not paste syntax yet.

    Go to the last (right-hand) column of the Data Editor & you should see the new variable added.

    Look at case number 7. In the commit cell there is no score, but a full stop (.). This is called a system-missing value. It means that SPSS has recognised it as a missing value even though you didn't define a specific missing-value code for commit. Why? Look at case 7's value for quest1 & you should see why.

    So you need not define Missing Values for computed variables (unless you want a new type of missing-value code that did not apply to the original variables) - SPSS automatically assigns a system-missing value if a source variable value (quest1 in this case) is missing.

    If all the above has happened, you know the procedure has run successfully. Re-open the dialogue box, do not change anything, click Paste. Look in the Syntax Window: You should see the added syntax beginning COMPUTE.... There is no need to run the syntax as the variable has already been created. The syntax simply records what you have done.

    COMPUTE has other features. Re-open the dialogue box and look at its parts. The numeric keypad is there to help you create numeric expressions, you will do this in a moment. The Functions box at the bottom right contains a long list of functions to perform various mathematical operations (e.g., to compute a new variable that is the logarithm of an old one). (If you want to know more, select Help | Topics | Index from the menu, search for Functions, then display the type of function you are interested in, e.g., Arithmetic, Statistical etc.)

    Now create variable auton which equals quest6+quest7+quest8+quest9. Type auton in the Target Variable box. Highlight the first old variable quest6, transfer it to the Numeric Expression box; then click on in the keypad; continue until the complete formula is in the Numeric Expression box.

    This time, do not click OK, click Paste & the appropriate COMPUTE statement is added to the Syntax Window. Note that it is followed by EXECUTE - this is a necessary part of the syntax.

    Highlight the new syntax (including EXECUTE). Do not highlight any of the previous syntax as you do not wish to re-run it. Click the Play button.

    Look at the right-hand end of the Data Editor & you should find that the new variable auton has been added.

    You should of course check that auton has been computed correctly; you will do this for all the new computed variables later.

    Try what happens if you now run the same COMPUTE procedure again from the dialogue box. Re-open the box and click OK. SPSS asks Change existing variable? because it knows that auton already exists, so it checks whether you really want to re-compute it (sometimes that could be an error). You do not need to re-compute it, so click Cancel.

  7. Editing & re-running syntax
  8. You now want to compute a third new variable, routine which equals quest10+quest11+quest12+quest13. You could do this similarly to auton, by opening the dialogue box & typing in the new target variable & the new numeric expression. But often, when computing variables, it is quicker to do it within the Syntax Window, by copying, editing, & running existing syntax. Try it.

    Go to the Syntax Editor window.

    Highlight the last new block of syntax, which computed auton. Remember to include EXECUTE.

    Click Edit | Copy. Place the cursor after the end of the text. Click Edit | Paste.

    Edit the copied syntax to create the formula for computing routine. Be careful: You need to edit both the new variable name & the quest numbers.

    Highlight only the edited syntax (including the EXECUTE statement which follows it) and click Play.

    Check that the new variable has been added to the Data Editor.

    You can run procedures, such as COMPUTE, using dialogue boxes or only syntax: Sometimes one is more convenient, sometimes the other. Whichever way you do it, remember to add the syntax to the Syntax Window as a record, whether or not you actually run the syntax.

  9. CASE SUMMARIES to check computed variables: Controlling appearance of items in output
  10. The CASE SUMMARIES procedure prints the values of selected variables, for selected cases. If you wish to check, e.g., that auton has been correctly computed as the sum of quest6, quest7, quest8 & quest9, you can do so by printing just those 5 variables, for a sample of cases.

    Select Analyze | Reports | Case Summaries. In the list on the left, the new variables auton, commit etc. should appear, along with the old ones. Highlight auton & the 4 quest variables that make it up, & transfer them to the Variables box. At the bottom left you see Limit cases to first.... The default number of cases is 100, but you only need to list a few, enough to check that auton is correctly computed.

    (With the Case Summaries procedure you have various other options, e.g., not to list missing values (by selecting the Show only valid cases option). You can group your displayed cases by another grouping variable, & also compute some summary statistics or add a title, by means of the Statistics & Options buttons. For the moment, however, we just want a simple list of the data.)

    Paste the syntax; you see it begins with the word SUMMARIZE. Run the new syntax, and check the listing in the Output Window. Does auton have the correct value in every case?

    You may not be able to check that the auton values are correctly added if SPSS has printed the value labels for the satis variables ("Strongly positive", etc.), rather than the number values.

    To change this, select Edit | Options | Output labels & set it to display variable values in Pivot Tables as values only, without labels. When you have done this, run the procedure again (from the dialogue box or syntax) & the new output should show number values.

    If there are errors, check that the syntax used to compute auton is correct. If anything is wrong, edit the syntax, run it again, & repeat the CASE SUMMARIES procedure.

    It is advisable to repeat the check for variable routine.

    Instead of using the dialogue box, copy & edit the SUMMARIZE syntax so that it will display the values of routine & its 4 quest components. Run it & check the output.

    Missing values. None of these 50 cases has a missing value on the variables quest6 to quest13, which were used to compute auton & routine. Consider what should happen if they did. If any of the component variables is "missing", the new variable cannot be computed, & it too should become "missing". That is just what SPSS does in such cases, as you saw in the case of commit & quest1 in Section 3 (& for the next computed variable satis...).

  11. Recall dialogue box (shortcut to save going through the menu)
  12. In the preceding sections you re-opened the same dialogue boxes (COMPUTE, etc.) several times, either to paste the syntax, or to re-run or modify an earlier procedure. SPSS offers a neat short-cut to save going back through the menu every time.

    Place the cursor over the following icon . It is near the left-hand end of the toolbar. (The pop-up description box says Dialog Recall.) Click on the icon, & a list appears which shows the SPSS procedures most recently-used on this machine. Compute Variable & Summarize Cases should be at the top, being the most recently-used by you. Click on Compute Variable, & the dialogue box re-appears, with the same settings as last time. You can do this for any dialogue box in the list.

    Certain procedures (Save, for example) do not appear in the Dialog Recall list. You have to re-open these boxes from the menu.

  13. RECODE before computing a new variable
  14. The other new variable satis will be made by combining quest2-5. But, as is common in questionnaires, some of those questions are coded "in reverse" to compensate for "acquiescence bias" (a general tendency to agree). In real life, this should be done for more than two items!

    From Sections 2 & 3, note that for quest2 & quest4, "Strongly positive" (coded "5") would indicate very high satisfaction, but for quest3 & quest5, "Strongly positive" would mean very low satisfaction. If we wish to add together the responses to the four questions into an overall measure of satisfaction, scores on quest3 & quest5 must first be reversed. Score "5" must be changed to "1", "4" changed to "2", etc. This can be done with the RECODE procedure.

    Select Transform | Recode, which gives you two options: Into Same Variables or Into Different Variables.

    Into Different Variables is used if you want to keep the original variable as well as the recoded version, so it is always "safe", you never lose the original data. If you use Into Same Variables, the original values are permanently changed. In the present case, we will not need the original versions of quest3 & quest5, so Into Same Variables is appropriate (but does require care to remember what you have done).

    Before proceeding, make a note of the values of quest3 & quest5 from the first two or three rows, so you can check that they are changed correctly.

    Choose Into Same Variables to produce the following dialogue box:

    Transfer the variable(s) you wish to recode - in this case, both quest3 & quest5 - from the list on the left, into the Variables box.

    Click on Old and New Values....

    Here you specify the values you wish to recode on the left hand side. There are several options available to specify the values. You want to recode "5" as "1", so under Old Value, next to Value enter "5". Then, under New Value, click on the button next to Value & enter "1" in this text box. Finally click on Add. The recoding "5" - "1" will be written in the box labelled Old-New.

    Follow the same steps to recode "4" to "2", "2" to "4", & "1" to "5". You need not change code "3" or code "0", which mean "Undecided" & "Not Known" (missing value) respectively. Your Old-New box should finally contain the following:

    5 - 1

    4 - 2

    2 - 4

    1 - 5

    When you are satisfied that the recoding is correct, click Continue, then OK. The values of quest3 & quest5 should be changed in the Data Editor - check them against the old values that you noted down.

    Next, paste the syntax of the RECODE procedure as a record of what you did - but do not run it again - the quest3 & quest5 values would change back!

    Having recoded quest3 & quest5, you can now construct the new variable satis by adding quest2, quest3, quest4, & quest5. As you know there are several different ways to carry out this COMPUTE procedure. (Remember that if you want to re-open a dialogue box you can use the Dialog Recall icon.) Whichever way you do it, ensure that the syntax is added to the Syntax Editor.

    Check the computation of satis by means of a CASE SUMMARIES procedure which displays satis plus the quest variables which compose it.

    You will notice that one of the quest variables has the missing value of 0 in certain cases, therefore satis has been set to a "system-missing value" for those cases, as noted previously.

    The four new computed variables probably have the default format (8 digits, 2 decimal places). You can leave them this way, but it is untidy.

    In Variable View, change the decimals to zero. What about the number of digits? commit is a single-digit variable (quest1) but the other variables are each the sum of four quest variables, so how many digits are needed? Change the Width to this number.

  15. Analysing the new variables
  16. (If you have time: Practise applying the hypothesis-testing procedures from the first two sessions to some of the four new variables commit, satis, auton, & routine.)

    If you are short of time, go on to Section 9.

    It is not sensible to run CROSSTABS (for contingency tables) with these variables

    Why not?

    However you can try EXPLORE, CORRELATE, or various kinds of t-test. If you need any reminders about these, look back at the previous sessions' worksheets.

    Think of a statistical question or hypothesis that you can test which involves one or more of these variables (& perhaps one of the old variables as well).

    Run the appropriate test, & note the findings, whether the significance test is 2-tailed or 1-tailed, the statistic, its degrees of freedom, p-value, & your conclusion.

    And: Remember to paste the syntax!

  17. A nonparametric test: Mann-Whitney vs. independent t-test
  18. Previously, you checked the normality of the distribution of variables, within a whole sample, or sub-samples, before carrying out (parametric) Student's t-tests. Parametric tests assume, among other things, a normal distribution. Researchers commonly use parametric tests even when data deviate somewhat from normality (most commonly, it is not known or tested whether they deviate!), & often it makes little difference to the conclusions.

    However, if you do not want to take the risk, if your sample size is very small, or you know that the data fail to meet parametric assumptions, you can run a non-parametric test. These tests make fewer or weaker assumptions, & do not require variables to be normally distributed. Here, we will run a popular non-parametric test, the Mann-Whitney U-test, which is similar to the independent-samples t-test. We will compare the results obtained from the Mann-Whitney U-test with those of a t-test on the same data.

    The Mann-Whitney U-test, like independent-samples t, compares two groups of cases measured on a numeric dependent variable, & asks whether the central tendencies of the two groups are different. It assumes that the dependent variable has an ordinal scale of measurement (i.e., that its values can be ranked). It does not assume a normal distribution. The appropriate measure of central tendency is the median, a rank-based statistic, rather than the mean.

    Which of the variables has an ordinal scale of measurement & only four values?

    It is not safe to treat this variable as normally distributed. It will be informative to use it as a dependent variable, & to compare the results from the Mann-Whitney U-test & the independent-samples t-test.

    Another interesting variable is income. We previously found that it deviates from normality and has an outlier.

    It is not necessary to check normality before running the Mann-Whitney U-test, but it is interesting to do so; it shows how far the data depart from t-test assumptions.

    (If you have time: Run EXPLORE & test th normality of the distributions of the two dependent variables: The ordinal variable& income, within the male & female sub-samples separately.)

    Does the ordinal variable depart significantly from normality, in either females or males?

    Does income depart from normality, in either group?

    You probably remember that the independent-samples t-test procedure prints the means of the two groups. Unfortunately the Mann-Whitney U-test does not print the groups' medians. So, before running the test, determine their medians on the two dependent variables. Thus, you will know the direction of any effect:

    Do males have higher or lower values, on average, than females?

    Run COMPARE MEANS. Set it up to compare the means of the sexes (sex is the independent variable) on both variables. This procedure does not produce medians by default, so click Options & insert Median as well as Number of Cases in the Cell Statistics box. Write the results in a table like this:

    (ordinal variable)

    To run the Mann-Whitney U-test, select Analyze | Nonparametric Tests...

    Which of the options in the sub-menu is appropriate? Click it...

    The dialogue box is somewhat similar to that for Independent-samples t, requiring a Grouping Variable & at least one Test Variable. Several different tests are offered: If you want to know more about them, use the Help.

    Make sure that the Mann-Whitney U box is ticked.

    Make sex the grouping variable. There is a Define groups button, the same as for the independent-samples t-test. Click this & insert the number values of the two groups, male & female, then click Continue.

    Insert your two Test Variables, namely income & the ordinal variable. Click Options & inspect it:

    Missing values is relevant if there is more than one test (dependent) variable. Test-by-test means that cases with a missing value on a particular DV will be omitted from tests on that DV only. Listwise means that cases with missing values for any DV will be omitted from all tests. Here the default, Test-by-test, is better.

    Descriptive statistics looks as if it might be useful, but isn't! It gives the mean, range, etc. across all cases, not (as you might hope) separately for the two sex groups. Furthermore, it does it for both the dependent & the grouping variable, which is useless. So, you should run COMPARE MEANS first, to obtain medians for the two groups.

    Click Continue. Run the procedure, remembering to Paste the syntax either before or after running it.

    SPSS first reports the Mean Rank & Sum of Ranks for each group on each variable. Note down one of these values for each of your variables & groups (it doesn't matter which, since mean=sum/N, you can interchange them easily).

    The rank means & sums are reported, rather than means or medians of the raw scores, because the ranks are used to compute the test.

    Compare the group mean ranks to the group medians that you noted previously.

    Does the group with the higher Mean Rank income, have the higher or the lower median income?

    Answer the same question for the ordinal variable.

    The higher mean rank doesn't always go with the higher median, but almost always does.

    The above tells you the direction of the effect, if any: Which group tends to have higher-ranking values on a test variable.

    To assess statistical significance of the difference, look at the second part of the output. It shows two equivalent versions of the test statistic: U & W, & a z-score conversion of the U & W statistics, whose significance can be assessed like any other z-score.

    But, it is more accurate to use the p-value labelled Asymp. Sig. (2-tailed). This is the probability of obtaining a U or W value as extreme as this or more extreme, if the null hypothesis were true, for a 2-tailed test. (Ignore the other one called Exact Sig. for the moment.)

    Note down the 2-tailed p-values for each of the test variables.

    Is the difference significant (p≤.05), for either test variable? Which?

    Is it marginally significant, for either test variable? Which?

    Imagine a 1-tailed test on the difference in income. What direction of effect would you look for? (i.e., which sex would you expect to have the higher income?)

    Which sex has the higher median income?

    If this goes in the direction you were expecting, you can proceed with the 1-tailed test.

    How do you modify the 2-tailed test p-value, to perform a 1-tailed test?

    Is the sex difference in income significant, 1-tailed?

    Note your conclusions from the tests on income.

    Because these results were obtained with a non-parametric test, they are reliable even if the dependent variables are not normally distributed.

    Now run the independent-samples t-test procedure to make the same two comparisons.

    Note the mean scores of males & females on each of the two test variables.

    Do the means of the groups differ in the same direction as the medians?

    Is the Levene test for unequal variances (testing another assumption of parametric tests) significant, for either of the test variables?

    Which version of t will you use? EQUAL VARIANCE ASSUMED or EQUAL VARIANCE NOT ASSUMED?

    Note the t, its degrees of freedom, & 2-tailed p-value for each of the test variables.

    Do these results different in any major way from those of the Mann-Whitney U/W tests?

    You may have found similar conclusions, despite the non-normality of the variables, & despite the presence of an outlier on income. This sometimes happens, but not always.

  19. Estimating study effect size from t-test output
  20. SPSS does not compute effect sizes (except for with certain types of ANOVA). However it's easy to estimate Cohen's d for a 2-group study from the t-test output, because it shows the means & SDs of both groups. d is the difference between means, divided by their shared SD. If the sample sizes are similar, the average of the SDs of the two groups can be used as an estimate of the shared SD. If sample sizes are unequal, a better estimate is the pooled SD, which is weighted by sample size (see any statistics book for the formula).

  21. Choosing between parametric & non-parametric tests
  22. There are no hard-&-fast rules, but here are some guidelines:

  23. Other non-parametric tests
  24. (The Nonparametric Tests menu in SPSS offers a wide range of useful tests, some mentioned in the statistics revision session). This section describes briefly what they do and how to use them, but you are not expected to run them now.)

    If short of time, go on to Section 13.


    This is the One-Way Chi-square test (not two-way Chi-Square which is obtained though CROSSTABS). CHI-SQUARE can be used for variables with any number of values. If a variable has only two values, BINOMIAL may be used as an alternative.

    WILCOXON SIGNED RANKS (matched-pairs) TEST

    This tests whether the central tendency of one variable is significantly higher or lower than that of another variable, measured on the same or on matched subjects (i.e. it is comparing two conditions or measures within subjects).

    Select Nonparametric Tests | 2 Related Samples. The dialogue box is similar to the paired-samples t-test. Click both selected variables in the left-hand box (holding down the Ctrl key), then click the arrow to transfer the pair to the Test Pair(s) list. Add other pairs if you want to make further comparisons. Ensure that the Wilcoxon box is ticked.

    Under Options, unlike the Mann-Whitney U-test, the Descriptives function is useful. The Descriptives give an impression of which variable has the higher scores, but you should be aware that, if the data deviate greatly from normality :

    The output contains a table which shows the numbers of Negative Ranks, Positive Ranks, & Ties, with an explanation beneath. If the two variables you are comparing are X & Y, Negative Ranks is the number of cases for which Y is less than X (Y < X), Positive Ranks is the number for which Y is greater than X (Y > code>X). It is these ranks that are used to compute the test.

    Look at whether Positive or Negative Ranks predominate: This tells you whether Y tends to be higher than X or vice versa. The direction of difference will probably be the same as it is for the means or medians, but the ranks result is more meaningful because it reflects the way that the Wilcoxon test is actually computed.

    Finally you see a z-score & Asymp. Sig. (2-tailed), the p-value for a 2-tailed test. These are interpreted in a similar way to the Mann-Whitney output.


    These provide alternatives to the parametric one-way ANOVA for comparing three or more conditions or measures, either between- or within-subjects. We will cover parametric ANOVAs with SPSS later in the course. The non-parametric ANOVAs are useful when you are not confident that the data satisfy parametric ANOVA assumptions. You will find them under K Independent Samples (Kruskal-Wallis test) & K Related Samples (Friedman test). The dialogue boxes are somewhat similar to the Mann-Whitney & Wilcoxon boxes. If you want to know more about the options, explore the Help. The K Independent Samples tests include the Jonckheere, which is a non-parametric equivalent of a trend test.

    Note: The K Related Samples dialogue box, like the 2 Related Samples one, allows you to display descriptive statistics (means, etc.) for the variables that you are comparing, via the Options button, & this can be helpful, as noted under the Wilcoxon test above. However, the K Unrelated Samples Options button provides a Descriptive Statistics option which is not so useful, for the same reason as in the case of the Mann-Whitney.

    These two procedures, of course, offer only one-way analyses. If you wish to carry out two-way or more complex ANOVAs, only parametric tests are readily available. See Section 11 for more options on choosing between parametric & nonparametric methods.

    Several other useful techniques are available under Nonparametric Tests that I have not described: The Help tells you about them.

  25. Saving & re-using syntax
  26. Save your syntax file so you have a permanent, repeatable record of your analyses.

    Go to the Syntax Window, select File | Save or Save As. SPSS automatically adds to the file name an extension of .sps, indicating that this is an SPSS syntax file.

    When saved, close the Syntax Window.

    Exit SPSS. It will ask if you want to save the output file. But if you have saved both the data file & a syntax file which records the syntax of all the procedures you ran, it is not necessary to save the output too (although you can do so if you wish). You can re-run all or part of what you did, & recreate the output, as shown below. It makes sense to do it this way because output files take a lot of disk space, whereas data & syntax files are lighter.

    Open the folder in which you saved your files. This icon: , this is the syntax file. Copy your files to your floppy or USB stick &/or your M:\ or N:\ drives.

    To re-run your procedures and re-create the output: Restart SPSS. Open the data file. Open the syntax file with File | Open | Syntax. You should see a list of any syntax files (with extension .sps) that are in the folder, including the one from this session. Open this file & it will appear in a Syntax Window.

    Highlight any one or more parts of the syntax that you wish to re-run (remember to include the full stop (.) symbol at the end), & click the Play button. The output will be written to the Output Viewer window.

  27. Power analysis with GPower
  28. GPower is an excellent statistical software tool for power analysis. It's free - there is no excuse not to use it!

    Hopefully, you will have downloaded and used GPower for the preparatory questions for this week's stats session, so this should be a quick reminder. If not, now is your time to learn power analysis with GPower. There will be questions on power analysis and GPower in the exam...

    Open GPower. There should be an icon on the desktop. If not, find it in the Start menu. If it's still not there, panic. (or ask a demonstrator).

    In the menu bar at the top, the most useful item is tests. Explore the options. Choosing one of these tests will update the three menus in the lower panel...

    In the lower panel, there are three main menus for selecting the power analysis you want to perform: Test family, Statistical test, & Type of power analysis.

    Test family

    Statistical test

    Many, many options, depending on what you chose in the Test family menu. For more information on one of the tests - Google it. There are published papers & many stats tutorials for GPower.

    Type of power analysis

    Perhaps the two most common types of power analysis are:

    GPower offers three more kinds of power analysis (compromise, criterion, & sensitivity). When might you use these other options?

    Example power analyses

    If you did not use GPower to calculate power for this week's stats lecture, then do it now for the example questions.

    If you did, then your work here is done. Bye!

Teaching home - Stats