What is the relationship between two nominal variables?
Steps
Univariate frequencies and bar charts
Check that there is sufficient data in each category (> ~20)
Consider whether recoding may be necessary
Crosstabs (also known as contingency tables)
Examine contingency table cell frequencies, with marginal totals, and consider also whether it might be useful to provide row and/or column percentages.
Clustered bar chart
Consider whether to use frequencies or percentages on the Y-axis and whether to include data labels.
Effect size: Phi (Φ) or Cramer's V (as correlations (or effect sizes)) for analysing the degree of relationship (or dependence) between two nominal variables.
Phi (Φ) is used for 2 x 2, 2 x 3 or 3 x 2 tables
Cramer's V is is used for >= 3 x 3 tables
Chi-square, phi, and Cramer's V are *non-parametric statistics* which do not rely much on assumptions about distribution.
But you should check for a minimum expected frequency of 5 per cell. Obtain the minimum expected frequency via Descriptives - Crosstabs - Cells - Expected. If you don't have > 5 minimum expected frequency per cell, you should recode the data into fewer categories.
The sign (+ or -) of Phi (Φ) and Cramer's V needs interpretation because there is no pre-set meaningful order to the way the variables are coded (the codes are arbitrary).
What is the relationship between Gender and Belief in God?[edit | edit source]
What is the relationship between Gender and Belief in God? (nominal by nominal)
Check univariate frequencies and bar charts.
Analyze → Descriptives → Frequencies (place Gender and God into the frequencies box). On the right-hand side click on Charts and tick bar charts. Optional: Choose frequencies or percentages.
You should notice in the output that Belief in God has an extra category (3s) which needs to be removed (recode as system missing), plus for this exercise we will just focus on the "believers" (Yes/No), so 2s (Sort of) will be also be recoded as missing.
Recode God into a new variable GodR for which the mis-entered data (the 3s) and the "sort of" responses (the 2s) are missing. Switch the decimal places to 0, and add variable and value labels to GodR, plus drag it next to the original God variable. Check univariate frequencies and bar chart for the recoded variable.
Transform → Recode into Different Variables. Click across God and in the name box rename it "GodR", you can also give it a label (e.g., God (recoded)). You then need to click the Change box to enter the new variable name. Then click "Old and New Values" to recode - you want to keep 0 (No) and 1 (Yes) the same and just get rid of the additional values. This can be done in a number of ways (see example in box below)
Click Continue and Paste. Then go to the syntax screen and run the Recode syntax. Check at the right-hand end of the data file in Data View that a new variable, GodR, has appeared.
Go to Variable View and add Value Labels ((0 = Yes, 1 = No) or copy the value labels from God). Change the decimal points to 0.
Go into Analyze --> Descriptives ---> Frequencies and add in the new GodR variable (God (recoded)) variable to check the frequencies of the recoded variable.
Crosstabs (Gender by God). To test whether there is a dependent relationship between Gender and Belief in God, calculate the chi-square as a test statistic and Phi or Cramer's V for the correlation statistic. To do this go to:
Analyse → Descriptives → Crosstabs and enter Gender and GodR. Also check on the box to get a clustered bar chart.
Statistics (Chi square - Phi and Cramer's V): In the Statistics box, select Chi-Square and Phi/Cramer's V.
Cells (Expected - Row and Column %s): To simply get the observed cell counts, there is no need to change the options in the Cells box. However, in the Cells box you can also choose to get Expected scores and/or Row or Column percentages. Adding both %s into one analysis can make the output confusing to interpret; so try adding row %s to one analysis and column %s to another analysis in order to break it down - see which is most useful/interpretable.
Continue and Paste, and then run the test from the syntax file using the big green play button.
The result should be: χ^{2} (1, 127) = .10, p = .76; Φ = -.03. There is a very, very small relationship such that females were slightly more likely to believe in God than males, however this is not a statistically significant relationship. In other words, the observed relationship in the data could easily have occurred by chance.
Tip: Clustered bar graphs can be generated directly (without using Cross-tabs) via Graphs → Legacy dialogs → Bar → Clustered. Try putting Gender on the Category Axis and Bars Clustered by GodR, with % on the Y-axis; but it could also be drawn the other way with GodR on the Category Axis and Bars Clustered by Gender. Which chart is easiest to interpret?
Recoding
Old ------------------------> New
0 --------------------------> 0
1---------------------------> 1
2---------------------------> System Missing
3---------------------------> System Missing
Syntax
* Gender by Belief in God - Cross-tabs, chi-square, phi and clustered bar graph.
FREQUENCIES VARIABLES=Gender God
/BARCHART PERCENT
/ORDER=ANALYSIS.
RECODE God (0=0) (1=1) (2=SYSMIS) (3=SYSMIS) INTO GodR.
VARIABLE LABELS GodR 'God (recoded)'.
EXECUTE.
FREQUENCIES VARIABLES=GodR
/BARCHART PERCENT
/ORDER=ANALYSIS.
CROSSTABS
/TABLES=Gender BY GodR
/FORMAT=AVALUE TABLES
/STATISTICS=CHISQ PHI
/CELLS=COUNT
/COUNT ROUND CELL.
GRAPH
/BAR(GROUPED)=PCT BY Gender BY GodR.
What is the relationship between Smoking and Snoring?[edit | edit source]
What is the relationship between Smoking and Snoring?
Univariate frequencies, bar chart (Snoring and Smoking): Analyse → Descriptives → Frequencies → enter Smoking and Snoring and request bar charts.
The bar chart for Smoking shows a very positively skewed distribution and thus it would be better if it were recoded into a dichotomous variable which indicates whether each respondent is a non-smoker or a smoker.
To recode Smoking: Transform → Recode into Different Variables. Enter Smoking and rename it as SmokingR. Change the label (e.g., Smoking status) and then click Change. Then click Old and New Variables – remove any rules that were placed there from the previous exercise.
Add 0 as old value and 0 as new value (i.e., non-smokers will keep the same coding).
For the second rule, select Range Through to HIGHEST and enter .01 (this will include anyone who reports smoking but smokes less than 1 cigarette per day) and make the new value 1. This means that all non-zero values will become 1 (Smoker).
Click Continue, Paste, and run from the syntax file.
Add Value labels via Variable View to the new SmokingR variable (e.g., 0 = Non Smoker, 1 = Smoker) and change the number of decimal places to 0. Run and check frequencies and bar chart for the new variable (SmokingR).
Crosstabs, with Statistics (Chi-square and Phi/Cramers V) and Clustered Bar Chart. To test the significance, use Chi-square. Analyse → Descriptives → Crosstabs. The chosen statistics from last time should have been saved so you can just click Paste and Run.
Examination of the clustered bar chart(s) and contingency table (with cell row and/or column percentages) should reveal that: Smokers are almost twice as likely to report Snoring than Non-smokers, with χ^{2} (1, 188) = 8.07, p = .004; Φ = -.21.
However, be careful with the interpretation of causality - e.g., the observed relationship could be because:
Smoking increases the likelihood of snoring (e.g., by restricting airway)
Snoring may cause smoking (e.g., snoring might make people tired and then more likely to smoke)
The relationship may be bidirectional - i.e., they cause each other
The relationship may be due to a third variable (e.g., age or weight)
Syntax
* Smoking and Snoring - Cross-tabs, chi-square, phi and clustered bar graph.
GRAPH
/BAR(SIMPLE)=PCT BY Snoring.
GRAPH
/HISTOGRAM(NORMAL)=Smoking.
FREQUENCIES VARIABLES=Snoring Smoking
/ORDER=ANALYSIS.
RECODE Smoking (0=0) (.01 thru Highest=1) INTO SmokingR.
EXECUTE.
VARIABLE LABELS Smoking 'Smoking (recoded)'.
GRAPH
/BAR(SIMPLE)=PCT BY SmokingR.
FREQUENCIES VARIABLES=SmokingR
/ORDER=ANALYSIS.
CROSSTABS
/TABLES=Snoring BY SmokingR
/FORMAT=AVALUE TABLES
/STATISTICS=CHISQ PHI
/CELLS=COUNT
/COUNT ROUND CELL
/BARCHART.
Possible graphical depictions of such a relationship include: scatterplot (with point bins and line of best fit), bar chart (showing the mean interval/ratio value for each dichotomous value), or error-bar chart (as per the bar chart, but with confidence also indicated)
Compute the product-moment correlation (r).
Interpret the r taking into account the direction of coding for the dichotomous scale.
Note that the significance test for a r_{pb} is equivalent to an independent samples t-test.
What is the relationship between Gender and Australianness?[edit | edit source]
What is the relationship between Gender (dichotomous) and Australianness (interval)?
Examine univariate frequencies and bar graphs. Analyse → Descriptives → Frequencies - Enter Gender and Australianness.
Three different types of graphs could be drawn to depict this bivariate relationship:
Scatterplot - Gender and Australianness: Because there is interval data we should look at a scatterplot. To create go to Graphs → Legacy Dialogs → Scatter/Dot → Simple scatter → Define. Then add the predictor variable Gender to the x axis, and the dependent variable, Australianness to the y axis, click Paste and then run the syntax.
To edit the chart:
Double-click chart editor to go into chart editor
Double click on a data point and change to point bins
Add line of best fit ("add fit line to total")
Alternative ways of graphing this data include:
Bar graph - with mean of Australianness on the Y-axis and Gender on the X-axis (category axis)
Error-bar graph - with Australianness as the (dependent) variable and Gender as the X-axis (category axis)
To obtain the correlation and its significance, go to Analyze → Correlate → Bivariate - Add Gender and Australianness (order doesn't matter) - Paste and Run
The result should be r_{pb} = -.04, p = .62, N = 189. This indicates that there is a very small, slightly negative and non-significant linear relationship. Males (coded as 0) in the sample perceive themselves as very slightly more Australian then females (coded as 1), but this result is likely to have come about by chance.
What is the relationship between two interval/ratio variables?
Steps
Statistical tasks/techniques
Scatterplot
Scatterplot with markers to consider the relationship for sub-groups
Product-moment correlation or Pearson's correlation for analysing the linear relationship between two continuous (or near continuous e.g., interval > \~5 categories data) variables
What is the relationship between Gender Role and Australianness?[edit | edit source]
Graphs → Legacy Dialogs → Scatter/Dot → Simple scatter → Define. Add the predictor variable (Gender_role) to the x axis, and the dependent variable (Australianness) to the y axis and paste and run.
Double-click the chart to enter the chart editor.
Add line of best fit ("Add fit line to total").
Obtain the product-moment correlation and its statistical significance - Analyse → Correlate → Bivariate - enter Australianness and Gender_role (order is arbitrary)
r is .12, p = .100, N = 185
This is larger than the r_{pb} between Gender and Australianness, but is still very small (r^{2} is .01 (i.e., 1% of shared variance)) and non-significant.
There may be heterogenous samples. So, to further consider the role of Gender:
Create a new scatterplot, adding Gender to the "Set markers by" box. Paste and Run. The scatterplot will then use green for predominantly female points and blue for predominantly male points. Double-click the chart and add the overall line of best fit. Then add lines of best fit for subgroups (button next to “add fit line at total”) – this should show that females who score high on femininity also score high on Australianness and males who score high on masculinity also score high on Australianness. Note: There is a bug in SPSS v.23. To fit linear lines of best fit at the sub-group level: (a) add a total line of best fit, then undo (so it disappears) (CTRL-Z), then (b) add fit lines for sub-groups.
To test for significance of correlations separately for males and females, split the file by gender, then re-run the correlation command.
Data → Split File → Compare Groups by Gender. Then click OK or Paste and Run.
Then re-run the correlations either from existing syntax or Analyse → Correlation → Bivariate: Australianness and Gender_role. The output will provide correlations for males and females separately.
Interesting results! The correlation for males is moderately positive (.50; 25% shared variance - see coefficient of determination) and the correlation for females is small and negative (-.23; 5% shared variance). Both these correlations are statistically significant (p < .05) even though the overall correlation (.12) was non-significant. Therefore:
gender role is related to Australianness, but in different directions for males and females (being more masculine for males is associated with higher Australianness, whereas being more feminine for females is associated with higher Australianness), and
Australian men’s national identity is more strongly tied (25% shared variance) to their gender identity than it is for females (5% of shared variance).
Syntax
* Femininity-Masculinity and Australianess - Scatterplot and Point bi-serial correlation.
GRAPH
/BAR(SIMPLE)=PCT BY Gender_role.
FREQUENCIES VARIABLES=Australianness Gender_role
/BARCHART PERCENT
/ORDER=ANALYSIS.
GRAPH
/SCATTERPLOT(BIVAR)=Gender_role WITH Australianness
/MISSING=LISTWISE.
CORRELATIONS
/VARIABLES=Australianness Gender_role
/PRINT=TWOTAIL NOSIG
/MISSING=PAIRWISE.
GRAPH
/SCATTERPLOT(BIVAR)=Gender_role WITH Australianness BY Gender
/MISSING=LISTWISE.
SORT CASES BY Gender.
SPLIT FILE LAYERED BY Gender.
CORRELATIONS
/VARIABLES=Australianness Gender_role
/PRINT=TWOTAIL NOSIG
/MISSING=PAIRWISE.