new Lab 10

Applying Weights

Purpose

  • To Practice applying weights to survey data
  • To Use the Weight command to enter published tables into SPSS

Main Points

  • The samples from which survey data are collected often do not match the population they are intended to represent.
  • Researchers therefore often weight their data for analysis.
  • Data sets often contain one of more data weights for use in analysis.
  • Consulting the codebook will provide information on the appropriate .weights to use
  • The SPSS command is: Weight by
    • With PPIC data the appropriate variable is weight. So the command should read:
      weight by weight.
    • In the ANES the appropriate variable is generally V160102, though see the codebook for dealing with data from only a specific wave or mode of the survey. Usually, the command will read:
      weight by V160102.
    • The weight command should appear at the very beginning of your syntax.

Example 1

Data Set

PPIC Oct 2016

Syntax

*Weighting the Data*.
weight by weight.
*Recoding MJ Index Items*.
recode q21 (1=1) (2=0) into MJPropD.
value labels MJPropD 1 'yes' 0 'no'.
recode q36 (1=1) (2=0) into MJLegalD.
value labels MJLegalD 1 'yes' 0 'no'.
recode q36a (1=1) (2=.5) (3=.0) into MJTry.
value labels MJTry 1 'recent' .5 'not recent' 0 'no'.

*Constructing an Index with alpha = .777*.
compute RawMJ3 = (MJPropD + MJLegalD + MJTry).

*Recoding the Index*.
recode RawMJ3 (0, .5=0) (1 thru 2= .5) (2.5, 3 =1) into MJ3.
value labels MJ3 0 'low' .5 'med' 1 'hi'.

*Creating IV Indicators of Party Identification & Ideology*.
recode q40c (1=0) (3=.5) (2=1) into Democrat.
value labels Democrat 1 'Democ' .5 'Indep' 0 'Repub'.
recode q37 (1,2=1) (3=.5) (4,5= 0) into liberal3.
value labels liberal3 1 'liberal' .5 'middle' 0 'conserv'.

*Crosstabulation of MJ3 by Democrat & Liberal*.
crosstabs tables = MJ3 by Democrat,liberal3
  / cells = column count
  /statistics = btau.

Output

Support for Recreational Marijuana by Partisanship

Support for Recreational MJ Partisanship
Repub Indep Democ
Low 57.4% 28.0% 30.6%
Medium 23.5% 28.0% 32.2%
High 19.1% 43.9% 37.1%
Total 230 371 369

Taub = .147
Source: PPIC October 2016

Support for Recreational Marijuana by Ideology

Support for Recreational MJ ldeology
conserv middle liberal
Low 57.3% 31.3% 19.3%
Medium 20.6% 32.3% 32.4%
High 22.1% 36.5% 48.3%
Total 335 288 358

Taub = .284
Source: PPIC October 2016
Interpretation

These percentages and measures of association differ somewhat from those reported in Lab 9.

These figures more closely represent the population values than those reported in Lab 9.

Example 2

Entering Published crosstabulations into SPSS

  • Another use of the Weight command is to enter crosstabulated data.
  • This is handy when you wish to calculate measures of association (or statistical significance) for a published crosstabulation.
  • On the data list command the variable names are listed DV first and IV second. A third variable called count represents the number of cases in a cell.
  • The cell entries are entered using the coordinates for the table. The first number defines the row, the second defines the column. The third number is the number of cases in the cell defined by the row and column numbers.
  • Variable labels and value labels are entered as usual.
  • The weight command tells SPSS how many cases to put in the cells.
  • The crosstabulation command follows the usual pattern.
  • Pasting this syntax into a new syntax window will produce the crosstabulation and summary statistics.
  • The example here reproduces the table appearing just above. Generally you will use this approach to enter tables you encounter in your reading to analyze them further

Entering Crosstabulated Data

(Using data from the MJ3 by liberal3 table using PPIC Oct 2016)

*Support for Recreational Marijuana by Ideology*.
data list free / MJ3 liberal3 count.
begin data.
1 1 192
1 2 90
1 3 69
2 1 69
2 2 93
2 3 116
3 1 74
3 2 105
3 3 173
end data.
variable labels MJ3 "Attitude toward recreational marijuana".
value labels MJ3 1 'low' 2 'med' 3 'hi'. 
variable labels liberal3 "Political Ideology".
value labels liberal3 1 'liberal' 2 'middle' 3 'conserv'.

weight by count.
crosstabs tables = MJ3 by liberal3
 /cells = column count
 /statistics = all.

Example 3
This example takes up some of the syntax presented at the end of Lab 2. They provide an quick introduction to the analysis of the American National Election Study data. Refer to the ANES codebook and the variable list which come with the data set to identify additional variables.

Data Set

ANES 2016

Syntax (adapted from Lab 2)

*Weighting the data*.
Weight by V160102.
*Creating Presidential Vote as DV*.
recode v162034a (1=1) (2=2) into PresVote.
value labels PresVote 1 'Clinton' 2 'Trump'.

*wall*.
recode V161196 (1=1) (2=3) (3=2) into wall.
value labels wall 1 'favor' 2 'neither' 3 'oppose'.

*intelligence*.
FREQUENCIES VARIABLES=V168017.
missing values V168017 V168018 V168019 (-8, -1).
recode v168017 (1=1) (2=2) (3,4,5=3) into intell.
value labels intell 1 'very high' 2 'faily high' 3 'average or less'. 

*skintone*.
missing values V162368 (-9 thru -5).

*heathcare*.
missing values v161114x (-1).

*creating ideology
Fre var V161127.
missing values v161127 (-9, -8, -1).
recode V161127 (1=1) (2=3) (3=2) into Ideol.
value labels Ideol 1 'liberal' 2 'moderate' 3 'conservative'.

*recoding gender*.
recode v161342 (1=0) (2=1) into female.
value labels female 0 'male' 1 'female'.

crosstabs tables = PresVote by wall Intell V162368 V161114x Ideol female 
 /cells = column count 
 /statistics = phi ctau d.