Title: Self test: Measures of association
Course: UGQuants (SSPS) > Section: Association for Nominal and Ordinal Variables

Exercise 1

This self-test has 5 exercises with a total of 25 questions.

1. In the ESS round 5 Practice dataset, which of these variables has the strongest association with gender:

marsts, netuse_bin, ppwwkp, mainact?

Before making this comparison, recode the variable mainact into a new variable which takes only three categories: 'working', 'unemployed'  and 'inactive' (permanently ill or disabled + retired + keeping house + students + community service + others). Remember that once you have created your new variable, you need to name its categiries and also save the new version of your dataset.

Exercise 1 - Answer

When using PRE measures of association, treat gender as an independent variable (can you see why?).

Note how insensitive the lambda measure is when the modal category of the other variable does not change between the two values of the gender variable.

Exercise 2a

2. This table shows the number of men and women who regularly use the internet.

a. Calculate Yule's q for this table. [Remember the formula Q = (ad – bc) / (ad + bc)]

Exercise 2a - Answer

= (78 x 257) – (79 x 186) / (78 x 257) + (79 x 186)

= (20046 – 14694) / (20046 + 14694)

= 5352 / 34740

= 0.154

Exercise 2b

2b. Calculate Phi for this table, using the following steps.

- First calculate the number of cases to be expected in each cell if there were no relationship between the variables, by dividing the product of the marginals corresponding to each cell by the total number of cases in the table
- Calculate the residuals for each cell by subtracting the expected number of cases were there no association between the variables, from the actually observed number of cases.
- Square these residuals.
- Divide by number of expected cases for each cell, and then total up the results from each of the four cells.
- Divide by N, and then take the square root of this number.

Exercise 2b - Answer

- First calculate the number of cases to be expected in each cell if there were no relationship between the variables, by dividing the product of the marginals corresponding to each cell by the total number of cases in the table

(cell a) = 157 x 264 / 600 = 69.08

(cell b) = 157 x 336 / 600 = 87.92

(cell c) = 443 x 264 / 600 = 194.92

(cell d) = 443 x 336 / 600 = 248.08

- Calculate the residuals for each cell by subtracting the expected number of cases were there no association between the variables, from the actually observed number of cases.

(cell a) = 78 – 69.08 = 8.92

(cell b) = 79 - 87.92 = -8.92

(cell c) = 186 - 194.92 = -8.92

(cell d) = 257 - 248.08 = 8.92

- Square these residuals.

8.92 x 8.92 = 79.57

- Divide by number of expected cases for each cell, and then total up the results from each of the four cells.

(cell a) = 79.57 / 69.08 = 1.15

(cell b) = 79.57 / 87.92 = 0.91

(cell c) = 79.57 / 194.92 = 0.41

(cell d) = 79.57 / 248.08 = 0.32
Total of the four cells = 2.79

- Divide by N, and then take the square root of this number

= √2.79 / 600

= 0.068

Exercise 2c

2c. Calculate Lambda for this table

Exercise 2c - Answer

If we take the modal value of internet users (regular users), without taking account of their gender, and use this to guess the net-surfing behaviour of all cases, we make 157 errors (all the non-users) in 600 classifications.
Taking account of gender: We take the modal value for men ('uses internet at least once per month') and using this to guess whether they use the internet, we make 78 errors (all the non-users) in 264 classifications. We take the modal value for women (aso 'uses internet at least once per month') and using this to predict that all women use the internet regularly, we make 79 errors (for all those cases in which the respondent does not use the www) from 336 classifications.
The reduction in error is therefore 157 - (78 + 79) = 0
The proportional reduction in error is 0/ 157 = 0.0

(You could also say:

Lambda = (186 + 257) – 443 / 600 – 443 = 0/157 = 0)

Exercise 2d

2d. Finally check your answers against those calculated by SPSS in exercise 2a.

The values for both Phi and Yule’s Q (Gamma) are low, reflecting the fact that the proportions of men and women who smoke are not very different. So now do these calculations again using the data from the following table.

In the table below the proportions of men and women using the internet have been altered, keeping the table marginals the same, so that the difference between the proportion of males and females who use the internet is much greater: less than half of males use the internet, but over three quarters of women do so. You should obtain much higher values for Q and for Phi. Do the calculations and see how they come out.

 | Male | Female | All
does not or rarely use internet | 141 | 16 | 157
uses internet at least once per month | 123 | 320 | 443
All | 264 | 336 | 600

Exercise 2d - Answer

  - Yules's Q

Q = (ad – bc) / (ad + bc)

= (141 x 320) – (16 x 123) / (141 x 320) + (16 x 123)

= (45120 – 1968) / (45120 + 1968)

= 43152 / 47088

= 0.916

  - Phi

Since the marginals of the table are unchanged we will have the same results as before
(133*145)/ 278 = 69.37
(133*133) /278 = 63.63
(145*145) /278 = 75.63
(145*133) /278 = 69.37

Calculate the residuals

(cell a) = 141 – 69.08 = 71.92

(cell b) = 16 - 87.92 = -71.92

(cell c) = 123 - 194.92 = -71.92

(cell d) = 320 - 248.08 = 71.92

Square the residuals = 71.92 x 71.92 = 5172.49

Divide by number of expected cases

(cell a) = 5172.49 / 69.08 = 74.88

(cell b) = 5172.49 / 87.92 = 58.83

(cell c) = 5172.49 / 194.92 = 26.54

(cell d) = 5172.49 / 248.08 = 20.85

Add the total of the four cells = 181.1

Divide by N and take the square root
= √181.1 / 600 = 0.549

  - Lambda

Lambda = 157 - (123 + 16) / 600 – 443 = 0.114

(Notice how small Lambda is while the other measures are large. This is because Lambda measures the improvement of our ability to predict the right value. Since we already predicted over 73% of all cases correctly due to most people using the internet these days, gender could not contribute as much to the prediction improvement despite its high association with internet use [in our manipulated figures, that is]).

Exercise 3a

3. In order to visually examine a table for a relationship between two variables it is best to:

a. Compare the vertical and horizontal marginals of the table

- False
Feedback: Correct!
- True
Feedback: Incorrect

Exercise 3b

3. In order to visually examine a table for a relationship between two variables it is best to:

b. Ensure the values are in the correct order

- False
Feedback: Correct!
- True
Feedback: Incorrect

Exercise 3c

3. In order to visually examine a table for a relationship between two variables it is best to:

c. Put the dependent variable in the head of the table and compare column percentages along the rows

- False
Feedback: Correct!
- True
Feedback: Incorrect

Exercise 3d

3. In order to visually examine a table for a relationship between two variables it is best to:

d. Put the independent variable in the head of the table and compare column percentages along the rows

- True
Feedback: Correct!
- False
Feedback: Incorrect

Exercise 3e

3. In order to visually examine a table for a relationship between two variables it is best to:

e. Put the independent variable in the head of the table and compare row percentages down the columns

- True
Feedback: Correct!
- False
Feedback: Incorrect

Exercise 4a

4. Look at the table and answer the questions below.

a. The ‘independent’ variable is:

- The respondent's gender
Feedback: Correct!
- Male and Female
Feedback: Incorrect
- Plan having child within next 3 years
Feedback: Incorrect
- Count
Feedback: Incorrect

Exercise 4b

4. Look at the table and answer the questions below.

b. The value codes of the dependent variable are:

- Definitely not, probably not, probably yes, definitely yes
Feedback: Correct!
- Definitely not, probably not, probably yes, definitely yes and total
Feedback: Incorrect
- Male
Feedback: Incorrect
- Female
Feedback: Incorrect

Exercise 4c

4. Look at the table and answer the questions below.

c. The value labels for the independent variable are:

- male and female
Feedback: Correct!
- Definitely not, probably not, probably yes, definitely yes
Feedback: Incorrect
- count and % in gender
Feedback: Incorrect

Exercise 4d

4. Look at the table and answer the questions below.

d. Which of the following is/are true?

1. There is evidence of a relationship between plans for having a child within the next three years and the gender of the respondent.
2. The majority of people ‘definitely not’ wanting children are women.
3. There are proportionately more females than males who definitely want to have a child within the next three years.
4. Most men and women are not planning to have a child in the nearer future.

- All of the statements are true
Feedback: Correct!
- Statement 1
Feedback: Incorrect
- Statement 2
- Statement 3 and 4

Exercise 5a

5. Answer true or false

a. Yule's Q always takes a value between 0 and +1.

- False
Feedback: Correct!
- True
Feedback: Incorrect

Exercise 5b

5. Answer true or false

b. Yule' Q always takes a value between -1 and +1 for 2x2 tables.

- True
Feedback: Correct!
- False
Feedback: Incorrect

Exercise 5c

5. Answer true or false

c. Gamma will give the same result as Phi.

- False
Feedback: Correct!
- True
Feedback: Incorrect

Exercise 5d

5. Answer true or false

d. Cramer's V will give the same result as Phi for a 2x2 table

- True
Feedback: Correct!
- False
Feedback: Incorrect

Exercise 5e

5. Answer true or false

e. Different measures of correlation will give the same value for the same pair of variables

- False
Feedback: Correct!
- True
Feedback: Incorrect

Exercise 5f

5. Answer true or false

f. A probability of 0.5 is the same as odds of 2

- False
Feedback: Correct!
- True
Feedback: Incorrect

Exercise 5g

5. Answer true or false

g. Odds of 1 are the same as a probability of 0.5

- True
Feedback: Correct!
- False
Feedback: Incorrect

Exercise 5h

5. Answer true or false

h. In a table the proportion is the same as the probability

- True
Feedback: Correct!
- False
Feedback: Incorrect

Exercise 5i

5. Answer true or false

i. The chance of being in the non-base category of a variable is the same as the odds

- False
Feedback: Correct!
- True
Feedback: Incorrect

Exercise 5j

5. Answer true or false

j. Phi is calculated by fitting a model of non association to the data in a table

- True
Feedback: Correct!
- False
Feedback: Incorrect

Exercise 5k

5. Answer true or false

k. In a contingency table cell the residual is the difference between the observed cases and the number of cases expected in the cell were there no association

- True
Feedback: Correct!
- False
Feedback: Incorrect