coding closed questions training session 5 gap toolkit 5 training in basic drug abuse data...

34
Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Upload: aron-mills

Post on 26-Dec-2015

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Codingclosed questions

Training session 5

GAP Toolkit 5 Training in basic drug abuse data management and analysis

Page 2: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Objectives

• To establish a set of practical coding rules for closed questions • To explain the importance of assigning numbers to

characteristics• To construct a framework for recording missing values• To introduce identification numbers as a method of ensuring the

anonymity of respondents, while maintaining a link between files and questionnaires

Page 3: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Components of a data file

• Cases or observations• Variables• Values

Page 4: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Coding

• The identification of the possible values of a variable and the assignment of numbers to those values

• The numbers, representing the values, are stored in a data file

Page 5: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Closed questions/categorical variables

• A limited number of values• The values are mutually exclusive• The values are collectively exhaustive• Code by assigning a number to each value

Page 6: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Example

• Coding gender• Possible values: male; female• Coding scheme: 1 = Male; 2 = Female

Page 7: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Why numbers?

• Efficient use of computers• Quicker to enter• Not subject to spelling mistakes

Page 8: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Why numbers?

• Some statisticians define measurement as necessarily resulting in numbers

• “To measure a property means to assign numbers to units as a way of representing that property.”

(D. S. Moore, Statistics: Concepts and Controversies, 2nd ed. (New York, W. H. Freeman Press, 1985)).

Page 9: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Pre-code

• Coding takes place before the questionnaire is delivered• The possible responses to a question are anticipated• The coding appears on the questionnaire

Page 10: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Coding rules

• Codes must be:– Mutually exclusive– Collectively exhaustive– Consistent across variables

(J. Fielding, “Coding and managing data”, Researching Social Life, N. Gilbert, ed. (London, Sage Publications, 1993) and D. De Vaus, Surveys in Social Research (London, Routledge, 2002)).

Page 11: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Continuous variables

• Do not generally require coding as:– They are already numerical– There is a potentially infinite number of categories

Page 12: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Coding in SPSS

• The Values column in Variable View is used to implement coding in SPSS

• Numbers are allocated to each of the categories of a variable

Page 13: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Example: coding Drug

• In data file Ex1.sav, a variable called Drug was defined as a string variable and a number of drugs were entered

Drug

1 Heroin

2 Alcohol

3 Hashish

4 Bhang

5 Heroin

6 Hashish

Total N 6

Case summariesa

a Limited to first 100 cases.

Page 14: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Coding Drug

• Decide on a set of numeric labels for the different categories, in this case drugs:– 1 = Heroin– 2 = Alcohol– 3 = Hashish– 4 = Bhang

Page 15: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Coding Drug

• Create a new variable Drug2:type = numeric; width = 2; decimals = 0;label = Drug Coded

• Click on the Values column and then on the three dots that appear to the right of the Values box to generate the following dialogue box:

Page 16: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Click to register code

Page 17: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis
Page 18: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Frequency Percentage Valid percentage

Cumulative percentage

Valid Heroin 2 33.3 33.3 33.3

Alcohol 2 33.3 33.3 66.7

Hashish 1 16.7 16.7 83.3

Bhang 1 16.7 16.7 100.0

Total 6 100.0 100.0

Drug Coded

Frequency count for Drug Coded:

Page 19: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Note

• Coding data does not change the level of measurement• The level of measurement is a guide to the selection of

appropriate statistics

Page 20: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

SPSS

• Value labels can be assigned to numeric variables and string variables of eight or fewer characters

• By default, SPSS sets all numeric variables to Scale variables

Page 21: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Exercise: coding

ID Drug Age ConditionDAP1-007 Mandrax 27 RecoveredDAP1-008 Mandrax 21 RelapsedDAP1-009 Alcohol 45 RecoveredDAP1-010 Hashish 52 RelapsedDAP1-011 Mandrax 22 RelapsedDAP1-012 Alcohol 28 Relapsed

Page 22: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Frequency count of Drug

Frequency Percentage Valid percentage

Cumulative percentage

Valid Alcohol 3 25.0 25.0 25.0

Bhang 1 8.3 8.3 33.3

Hashish 3 25.0 25.0 58.3

Heroin 2 16.7 16.7 75.0

Mandrax 3 25.0 25.0 100.0

Total 12 100.0 100.0

Drug

Page 23: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Frequency count of Condition

Frequency Percentage Valid Percentage

Cumulative percentage

Valid Recovered 5 41.7 41.7 41.7

Relapsed 7 58.3 58.3 100.0

Total 12 100.0 100.0

Condition Coded

Page 24: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Missing values

Page 25: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Missing values: causes

• The question is not applicable• The respondent does not know• The respondent refuses to answer• No response is marked on the questionnaire (i.e., truly

missing and there is no clue why)(De Vaus, 2002)

Page 26: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Coding missing values

• Use codes outside of the range of common values:– e.g., 9, 99, -99, 999

• If possible, retain the same codes for the various missing options for all variables

• The default missing value in SPSS is a full stop . and is called the “system’s missing value”

Page 27: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

SPSS: missing values

• Part of the variable definition• Variable View: Missing column

– Click on the Missing cell in the row defining the variable– Click on the three buttons that appear to the right of the

Missing cell and the following dialogue box will appear:

Page 28: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis
Page 29: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Exercise

• Three additional observations are obtained for Ex1.sav:– DAP1-0013; Alcohol; 39; ------------– DAP1-0014; Hashish; --; Recovered– DAP1-0015; ---------; 16; Relapsed

• Code necessary missing values for the variables• Run a frequency count on Drug and Condition,

comparing percentage and valid percentage

Page 30: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Identification numbers

Page 31: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

ID numbers: purpose

• An ID number:– Ensures anonymity– Links a row in the data file to a physical questionnaire

Page 32: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

ID numbers: characteristics

• A unique identifier• Sometimes contains information in a compound form

Page 33: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Example

• DAP1-001, DAP1-002, … :– DAP is short for Drug Assessment Programme– 001, 002 are consecutive numbers that uniquely identify each

questionnaire or respondent – There must be at most 999 respondents, as space has only

been made available for 999 unique ID numbers

Page 34: Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis

Summary

• Coding closed questions• Value labels• Frequency counts• Missing values• ID numbers