** This syntax file contains the commands to produce an extended version of the Week 10 Wednesday session example analysis,
** when applied to the data file corresponding to Warwick students, as interviewed by students attending earlier versions of SO201.
**
** After the syntax for each command is a commentary on key points corresponding to the application of, or results from applying,
** that command.
FREQUENCIES VARIABLES=view4
/ORDER=ANALYSIS.
** Only 15.9% of those within the sample of Warwick students who gave 'concrete' answers agreed with bringing back the death penalty.
CROSSTABS
/TABLES=year view5 partyid1 BY view4
/FORMAT=AVALUE TABLES
/STATISTICS=CHISQ PHI
/CELLS=COUNT ROW
/COUNT ROUND CELL.
** The relationships between view on bringing back the death penalty and both view on whether those breaking the law should receive
** stiffer sentences and also party identification were found to be statistically significant (p<0.05), with the former relationship being stronger
** (Cramer's V = 0.193 > 0.153).
** However, a problem with small expected frequencies means that the chi-square test corresponding to the second of these
** relationships is invalid.
** The relationships between view on bringing back the death penalty and year of survey was not found to be statistically significant, although
** the likelihood ratio chi-square statistic suggests otherwise!
RECODE view4 (1 thru 2=1) (3 thru 8=0) (ELSE=SYSMIS) INTO view4rv.
EXECUTE.
** To allow logistic regression to be used, with view on bringing back the death penalty as the (binary) categorical dependent variable,
** the view on bringing back the death penalty variable was recoded.
RECODE partyid1 (98=98) (0 thru 3=Copy) (4 thru 8=4) (ELSE=SYSMIS) INTO pidrv.
EXECUTE.
** Given the problem with the small categories in the party identification variable, minor parties were recoded into a single, 'Other Party'
** category.
LOGISTIC REGRESSION VARIABLES view4rv
/METHOD=ENTER year
/CRITERIA=PIN(.05) POUT(.10) ITERATE(20) CUT(.5).
** Again, the effect of year was found to be statistically non-significant (p > 0.05), this time within a logistic regression which treated the
** year as an interval-level variable.
LOGISTIC REGRESSION VARIABLES view4rv
/METHOD=ENTER pidrv
/METHOD=ENTER view5
/CONTRAST (pidrv)=Indicator(1)
/CONTRAST (view5)=Indicator
/CRITERIA=PIN(.05) POUT(.10) ITERATE(20) CUT(.5).
** When the recoded party identification variable and view on whether those breaking the law should receive stiffer sentences were
** included sequentially as the independent variables within a logistic regression, the effects of both were statistically significant
** controlling for each other, although the evidence for the former effect (see the Wald statistic) was reduced considerably when the
** latter variable was included.
** While none of the pairwise comparisons between categories for the party identification variable was in itself statistically significant,
** the odds ratio for the second category (Conservative) could be seen to be markedly higher than those for the other categories
** including the implicit odds ratio of 1 for the first category, i.e. the reference category (None).
RECODE pidrv (0=0) (1=1) (2 thru 98=0) (ELSE=SYSMIS) INTO pidrv2.
EXECUTE.
** The party identification variable was recoded to compare Conservative with all other possibilities.
LOGISTIC REGRESSION VARIABLES view4rv
/METHOD=ENTER view5
/METHOD=ENTER pidrv2
/METHOD=ENTER pidrv
/CONTRAST (pidrv)=Indicator(1)
/CONTRAST (view5)=Indicator
/CONTRAST (pidrv2)=Indicator(1)
/CRITERIA=PIN(.05) POUT(.10) ITERATE(20) CUT(.5).
** When this second recoding of the party identification variable was included in the regression alongside view on whether those
** breaking the law should receive stiffer sentences, it improved the fit of the model significantly (chi-square change 10.225, 1 d.f., p=0.001), but differentiating between the other
** parties by subsequently adding the more detailed recoding did not (2.656, 4 d.f., p=0.617).
** Thus the party identification effect can be seen to relate simply to the distinction between Conservative and all other possibilities.
LOGISTIC REGRESSION VARIABLES view4rv
/METHOD=ENTER view5 pidrv2
/METHOD=ENTER year
/CONTRAST (view5)=Indicator
/CONTRAST (pidrv2)=Indicator(1)
/CRITERIA=PIN(.05) POUT(.10) ITERATE(20) CUT(.5).
** When year is added to the logistic regression, it now has a statistically significant effect! (p=0.019 < 0.05).
** This result, which implies that the odds of agreeing with bringing back the death penalty have been declining
** among Warwick students over time, all other things being equal, reflects the suppression of this effect by an
** increasing tendency of Warwick students to be Conservative and (especially) to support stiffer sentences.
** (This can be shown using bivariate analyses which are not included here).
LOGISTIC REGRESSION VARIABLES view4rv
/METHOD=ENTER view5 pidrv2 year
/METHOD=ENTER pidrv2*year
/CONTRAST (view5)=Indicator
/CONTRAST (pidrv2)=Indicator(1)
/CRITERIA=PIN(.05) POUT(.10) ITERATE(20) CUT(.5).
** A test for an interaction between the effects of party identification and year found this interaction to be
** statistically non-significant, although the negative sign for the interaction effect (i.e. its B) would have
** implied, had it been significant, that the (positive) effect of being Conservative on the odds of favouring
** bringing back the death penalty has been diminishing over time... in fact the magnitude of the non-
** significant interaction effect would suggest that any party identification effect would have disappeared
** by about 2015, which suggests that the sample size isn't really adequate to establish whether a
** substantively interesting interaction exists!
**
** Note that the apparently ridiculously big (but non-significant) party identification effect in the final set of results
** reflects this effect now corresponding to the reference value (i.e. value of zero) for year, which in this case is
** the year 1900!