Table of Contents

1 Week 1 Lab

1.1 Starsign

Does your star sign have an effect on whether you believe astrology is scientific??

1.2 Measures of association

We have discussed the following measures of association, defined for 2*2 tables:

  • Difference in proportions
  • Relative rate or ratio of proportions
  • Odds ratio

Calculate each of these measures for the following table:

  Outcome    
  No Yes Total
Type 1 380 120 500
Type 2 420 80 500
Total 800 200 1000

1.2.1 With a spreadsheet…

This spreadsheet will allow you to explore these measures a bit more. You can change the numbers in the "Type 1/Outcome Yes" and "Total/Outcome Yes" cells and the three measures are calculated for you. Use it to check what you have calculated by hand.

For "Total/Outcome Yes" values of 100, 200, 400, 800 and 900, do the following:

  • Find what values of "Type 1/Yes" give you a difference in

proportions of 0.2 for each of these totals

  • Find what values of "Type 1/Yes" give you a relative rate of 2.0

(or as close as possible) for each total

  • Find what values of "Type 1/Yes" give you odds ratio of 2.0

(or as close as possible) for each total

Keep a note of your numbers and compare their patterns. What do you notice?

1.3 Putting tables into Stata

We can enter tables into Stata quite easily using the following strategy. Given a table that looks like this:

  Agree Disagree Total
Male 122 223 345
Female 268 1632 1900

we can put it into Stata like this:

input gender att count
1 1  122
1 2  223
2 1  268
2 2 1632
end

label define gndr 1 "Male" 2 "Female"
label values gender gndr
label define agree 1 "Agree" 2 "Disagree"
label values att agree

tab gender att [freq=count]

Run this syntax, and run a χ2 test. Do help tab if you need a hint for the χ2 test.

1.4 Adding capabilities to Stata

Lots of people write additional procedures for Stata, and many of these are easily available. See help net and help ssc for an overview. We are going to use one such add-on, TAB_CHI, today. Do net search tab_chi first, just to see how to search. One place it is found is the Stata web site, and another is the Repec economics article archive. Either of the two following commands should install it:

net install tab_chi

or

ssc install tab_chi

The former looks on the Stata website, the latter on the Statistical Software Components archive.

1.5 Analysing a real table

This is a table relating social class of origin and highest educational qualification:

                   |               qual
             class |      Univ  2nd level  Incomplet |     Total
-------------------+---------------------------------+----------
          Prof/Man |      1025       1566        767 |      3358 
Routine non-manual |       124        687        713 |      1524 
    Skilled manual |        31        483        464 |       978 
    Semi/unskilled |        18        361        716 |      1095 
-------------------+---------------------------------+----------
             Total |      1198       3097       2660 |      6955 

Source: British Household Panel Survey 2001

By hand, calculate the odds ratio comparing prof/man versus semi/unskilled in their chances of having a university education (university versus anything else). Interpret it.

Do the same for routine-non-manual versus semi/unskilled and skilled versus semi/unskilled. Is there a pattern in the three ORs?

Enter the table in Stata, and use tab and tabchi to do the following

  • Analyse the pattern of percentages (tab a b, row)
  • Analyse the pattern of expected values and raw residuals (observed minus expected, tabchi a b, raw)
  • Analyse the adjusted residuals (tabchi a b, adj)
  • Run the χ2 test and interpret

Author: brendan

Created: 2021-02-02 Tue 15:41

Validate