Table of Contents

1 Week 2 Lab

1.1 An ordinal view

Re-generate this table in Stata, using the method from last week's lab:

                   |               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

Note that both variables have an ordinal interpretation.

  • Calculate the correlation and the Spearman Rank Correlation:
corr class qual
spearman class qual
  • Run and interpret the gamma test
  • What does it tell you? Compare with the pattern of association shown in the adjusted residuals with the gamma, and consider which gives you the better summary.

1.2 Spurious association and suppression

Use the scouting example to explore an association that differs when you take account of more variables.

tab s d [freq=n], row
tab3way s d c [freq=n]

(Note that tab3way will need to be installed the first time: ssc install tab3way.)

Start by calculating a measure of association for the scouting by delinquency table, then for each of the sub-panels (Odds Ratios would be a good idea, since this is 2X2). Then do the same for the three subtables in the church by scouting by delinquency table. Finally, figure out how the three subtables without association add up into a 2-way table with association.

1.3 Tables and complex association


Agresti uses data on race and the death penalty (use code above) to illustrate the possible complexity of a three-way relationship. The data classifies the sentence handed down in murder trials in Florida, by defendent's race and victim's race.

Look first at the defendent/penalty table, then at the three-way table (ie, defendent/penalty controlling for victim's race). Calculating odds ratios would also be useful here. What is going on with this data set?

1.4 Maths and Height

Load the following data:


This is the maths/height example considered yesterday. Examine the correlations between the variables, numerically and graphically (corr varlist and scatter yvar xvar). Then regress maths on height: reg maths height. Interpret the output, and relate it to the scatter plot.

Consider controlling for year. First, compare the maths/height scatterplot across year:

scatter maths height, by(year)

What does this tell you? Does this command make it clearer?

bysort year: pwcorr height maths, sig

Then fit the regression including year as well as height as explanatory variables: reg maths height year. Interpret the output.

Author: brendan

Created: 2021-02-02 Tue 15:41