24
Data Cleaning and Data Cleaning and Missing Data Analysis Missing Data Analysis Dan Merson Dan Merson [email protected] [email protected] India McHale India McHale [email protected] [email protected] April 13, 2010 April 13, 2010

Data Cleaning, Missing Data Analysis, & Weighting Brownbag

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

Data Cleaning and Data Cleaning and

Missing Data AnalysisMissing Data Analysis

Dan MersonDan [email protected]@psu.edu

India McHaleIndia [email protected]@psu.edu

April 13, 2010April 13, 2010

Page 2: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

OverviewOverview

Introduction to SACSIntroduction to SACS

What do we mean by What do we mean by ““Data CleaningData Cleaning”” and why and why do we do it?do we do it?

The SACS data cleaning procedureThe SACS data cleaning procedure

The importance of addressing missing dataThe importance of addressing missing dataTypes of Types of missingnessmissingness

Why we careWhy we care

Missing data analysis procedureMissing data analysis procedure

What do we do when data are missing?What do we do when data are missing?

An introduction to weightingAn introduction to weighting

Page 3: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

StudentStudent--Athlete Climate StudyAthlete Climate Study

National, anonymous, population survey of National, anonymous, population survey of studentstudent--athletes' perceptions and experiences athletes' perceptions and experiences pertaining to campus climate and its impact on pertaining to campus climate and its impact on studentstudent--athletesathletes‘‘: : –– Academic successAcademic success

–– Athletic successAthletic success

–– Athletic identityAthletic identity

Almost 9,000 studentAlmost 9,000 student--athletes from all three athletes from all three divisions and all NCAA sportsdivisions and all NCAA sports

Focuses on the voices of those who have Focuses on the voices of those who have traditionally not been heardtraditionally not been heard

SACS

Page 4: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

What do we mean by What do we mean by ““Data Data

CleaningCleaning”” and why do we do it?and why do we do it?

Find and eliminate data entry and other Find and eliminate data entry and other

errorserrors

Examine missing data and perhaps Examine missing data and perhaps

account for it in some way (statistically)account for it in some way (statistically)

Prepare the data for analysisPrepare the data for analysis

Data Cleaning

Page 5: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

General data cleaning processGeneral data cleaning process

1. Define and determine error types

2. Search for and identify error instances

3. Correct errors

4. Document error types and instances

5. Modify data entry process to reduce

future errors

Data Cleaning

Page 6: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

The SACS data cleaning procedureThe SACS data cleaning procedure

1.1. Check for and delete duplicate data entries Check for and delete duplicate data entries (use (use SPSS SPSS ““Identify Duplicate CasesIdentify Duplicate Cases”” procedure or procedure or ““Data Data PreparationPreparation”” module).module).

2.2. Perform descriptive statistics to see if the data Perform descriptive statistics to see if the data make sense. make sense. (e.g., Do the max and min values fall (e.g., Do the max and min values fall within the questionwithin the question’’s expected range? Does the mean s expected range? Does the mean ““make sensemake sense”” for that question?)for that question?)

1.1. Frequency tables for categorical variables Frequency tables for categorical variables

2.2. Histograms for Histograms for LikertLikert/ordinal/continuous variables/ordinal/continuous variables

3.3. ScatterplotsScatterplots for writefor write--in continuous variables (e.g. in continuous variables (e.g. age) to look for outliers and nonsense valuesage) to look for outliers and nonsense values�� Use frequency tables & histograms to examine the normality Use frequency tables & histograms to examine the normality

of distributions, the range, and extreme skew and kurtosis.of distributions, the range, and extreme skew and kurtosis.

Data Cleaning

Page 7: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

The SACS data cleaning procedureThe SACS data cleaning procedure

3.3. Add to the list of new variables created for analysis Add to the list of new variables created for analysis purposes, including dummy variables (Appendix A). purposes, including dummy variables (Appendix A). �� Also consider combining variables. There may be sets of Also consider combining variables. There may be sets of

questions that could be combined into a metric beyond the questions that could be combined into a metric beyond the factor scales already identified (Appendix B).factor scales already identified (Appendix B).

4.4. Make sure dichotomous variables are coded with 1=the Make sure dichotomous variables are coded with 1=the category of interest and 0=not.category of interest and 0=not.

5.5. Fix variable & value labels (e.g., typos, wrong scale).Fix variable & value labels (e.g., typos, wrong scale).

6.6. Make sure variables are of the appropriate type Make sure variables are of the appropriate type (numerical/string) and variable measures are of the right (numerical/string) and variable measures are of the right level (SPSS language: scale/ordinal/nominal).level (SPSS language: scale/ordinal/nominal).

Data Cleaning

Page 8: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

The SACS data cleaning procedureThe SACS data cleaning procedure

7.7. Examine writeExamine write--in text for in text for ““OtherOther”” responses and recode responses and recode into alreadyinto already--existing categories.existing categories.

8.8. Recode Recode ““InstitutionInstitution”” writewrite--in values to IPEDS institutional in values to IPEDS institutional codes (ID variable for merging institutional data).codes (ID variable for merging institutional data).

9.9. Clean qualitative answers, but retain the respondentClean qualitative answers, but retain the respondent’’s s voice. Edit the punctuation and grammar, but donvoice. Edit the punctuation and grammar, but don’’t t change the meaning of the response.change the meaning of the response.

10.10. Code missing data properly (skipped due to skip pattern Code missing data properly (skipped due to skip pattern = 999999, unanswered for any other reason (system = 999999, unanswered for any other reason (system missing) = missing) = sysmissysmis). Check any items where SRC coded ). Check any items where SRC coded 0=No Response and bring to the group for discussion.0=No Response and bring to the group for discussion.

Data Cleaning

Page 9: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

The SACS data cleaning procedureThe SACS data cleaning procedure

11.11. Reverse recode if necessary to ensure the conceptual Reverse recode if necessary to ensure the conceptual consistency of items within a group of questions. consistency of items within a group of questions. Reverse value labels as well. Reverse value labels as well. �� Also run correlations on the set of questions. Negative Also run correlations on the set of questions. Negative

correlations are further evidence that reverse coding may be correlations are further evidence that reverse coding may be necessary. necessary.

To reverse code, use the following equation: To reverse code, use the following equation:

New Value = (High Value + 1) New Value = (High Value + 1) -- Original ValueOriginal Value

For example, if the High Value for a metric is 5, we For example, if the High Value for a metric is 5, we obtain the New (transformed) Value by subtracting each obtain the New (transformed) Value by subtracting each Original Value from 6 (i.e., 5 + 1).Original Value from 6 (i.e., 5 + 1).

Data Cleaning

Page 10: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

The SACS data cleaning procedureThe SACS data cleaning procedure

12.12. Create placeholder variables that will help us find Create placeholder variables that will help us find variables when using point and click and will make the variables when using point and click and will make the dataset more readabledataset more readable——use CAPS for the placeholder use CAPS for the placeholder variable NAMES and LABELS.variable NAMES and LABELS.

13.13. Perform descriptive statistics again. Make sure Perform descriptive statistics again. Make sure everything still makes sense (e.g., check to make sure everything still makes sense (e.g., check to make sure the dummy variables add up to the number of cases).the dummy variables add up to the number of cases).

14.14. Perform a missing data analysis to determine survey Perform a missing data analysis to determine survey fatigue and if there is a pattern to the missing data. fatigue and if there is a pattern to the missing data. Follow the procedure outlined in Missing Data Analysis Follow the procedure outlined in Missing Data Analysis Procedure.docProcedure.doc..

Data Cleaning

Page 11: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

The importance of addressing The importance of addressing

missing datamissing data

Why are there missing data?Why are there missing data?

–– FatigueFatigue

–– SensitivitySensitivity

–– Lack of knowledgeLack of knowledge

–– Not applicableNot applicable

–– Data processing errorsData processing errors

–– Programming errorsProgramming errors

Missing Data

Page 12: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

Types of Types of MissingnessMissingness

Missing Completely at Random (MCAR)Missing Completely at Random (MCAR)There is no patternThere is no pattern——the cases with the cases with missing data are indistinguishable from missing data are indistinguishable from those that are complete. Awesome!those that are complete. Awesome!

Missing at Random (MAR)Missing at Random (MAR)Only vary depending on other observable Only vary depending on other observable variables (e.g. income and parental variables (e.g. income and parental education).education).��Want key IVs to be MAR with respect to the DV.Want key IVs to be MAR with respect to the DV.

Missing not at Random (MNAR)Missing not at Random (MNAR)Not random, but Not random, but missingnessmissingness cannot be cannot be predicted by variables in the modelpredicted by variables in the model��Not ignorableNot ignorable Missing Data

Page 13: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

Why do we care?Why do we care?

Independent Variables (IVs)Independent Variables (IVs)Sample size and statistical powerSample size and statistical power

Bias—Data no longer be representative

Dependent Variables (Dependent Variables (DVsDVs))Sample size and statistical powerSample size and statistical power

GeneralizabilityGeneralizability��We must limit our conclusions to the cases We must limit our conclusions to the cases

which do not have missing data and, therefore, which do not have missing data and, therefore, limit our generalization to populations which limit our generalization to populations which share the same qualities as those cases. share the same qualities as those cases.

Missing Data

Page 14: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

Missing Data Analysis ProceduresMissing Data Analysis Procedures

1.1. Check for drop out/fatigue.Check for drop out/fatigue.

2.2. Create dummy variables representing cases that Create dummy variables representing cases that are missing data.are missing data.

3.3. Test to see if the missing data are biased or if Test to see if the missing data are biased or if they are randomly distributed along each of the they are randomly distributed along each of the other IVs and other IVs and DVsDVs of interest. of interest.

Chi Square test for categorical variablesChi Square test for categorical variables

TT--test for continuous variablestest for continuous variables

LittleLittle’’ss Chi Square Test for MCARChi Square Test for MCAR

4.4. SPSS SPSS ““Data PreparationData Preparation”” and and ““Missing Values Missing Values AnalysisAnalysis”” modulesmodules Missing Data

Page 15: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

What do we do when Data are What do we do when Data are

Missing?Missing?

If the Data are MCARIf the Data are MCAR

ListwiseListwise ((casewisecasewise) deletion: uses only ) deletion: uses only complete casescomplete cases

PairwisePairwise deletion: uses all available deletion: uses all available cases (different cases, different Ns)cases (different cases, different Ns)�� ListwiseListwise is preferred over is preferred over pairwisepairwise when when

sample size is large in relation to the sample size is large in relation to the number of cases that have missing data number of cases that have missing data ((≈≤≈≤5%). 5%).

Missing Data

Page 16: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

What do we do when Data are What do we do when Data are

Missing?Missing?

Methods of Missing Data ReplacementMethods of Missing Data Replacement

–– Mean substitution: substitute mean Mean substitution: substitute mean value computed from available casesvalue computed from available cases

–– Regression methods: predict value Regression methods: predict value based on regression equation with other based on regression equation with other variables as predictors (assumes MAR)variables as predictors (assumes MAR)

Missing Data

Page 17: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

What do we do when Data are What do we do when Data are

Missing?Missing?

Hot Deck: identify the most similar case Hot Deck: identify the most similar case to the case with missing data and to the case with missing data and impute the value impute the value

Approximate Bayesian Bootstrap (ABB): Approximate Bayesian Bootstrap (ABB): use logistic regression to estimate the use logistic regression to estimate the probability of response/nonprobability of response/non--response on response on the dependent variable.the dependent variable.

Missing Data

Page 18: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

What do we do when Data are What do we do when Data are

Missing?Missing?

Maximum Likelihood Estimation (MLE): Maximum Likelihood Estimation (MLE): use all available data to generate use all available data to generate maximum likelihoodmaximum likelihood--based statistics. based statistics. EM in SPSS. (Assumes MAR)EM in SPSS. (Assumes MAR)

Multiple Imputation: combines methods Multiple Imputation: combines methods of MLE to produce multiple data sets of MLE to produce multiple data sets with imputed values for missing caseswith imputed values for missing cases�� Most recent method. Good because the Most recent method. Good because the

variance/covariance structurevariance/covariance structure’’s preserved.s preserved.

�� More computationally demandingMore computationally demanding

Missing Data

Page 19: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

WeightingWeighting

A value assigned to each case in the data file.A value assigned to each case in the data file.

Normally used to make the statistics computed from the Normally used to make the statistics computed from the data more representative of the population.data more representative of the population.

The value indicates how much each case will count in a The value indicates how much each case will count in a frequency distribution, crossfrequency distribution, cross--tab, or other descriptive tab, or other descriptive statistics of a central tendency (i.e., percent, mean)statistics of a central tendency (i.e., percent, mean)–– A weight of 2 would mean that the case would count as if it wereA weight of 2 would mean that the case would count as if it were

two identical cases.two identical cases.

–– A weight of 1 would mean that a case only counts as one case A weight of 1 would mean that a case only counts as one case ((unweightedunweighted data)data)

–– Weights are often fractions, but always positive and nonWeights are often fractions, but always positive and non--zero.zero.

Only one weight per case can be used. If we weight for Only one weight per case can be used. If we weight for different characteristics, these weights must be different characteristics, these weights must be combined together into one weight.combined together into one weight.

Weighting

Page 20: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

Common Types of WeightingCommon Types of Weighting

Design WeightsDesign Weights

–– Normally used to compensate for overNormally used to compensate for over-- or or underunder--sampling of specific cases.sampling of specific cases.

–– Used to present statistics that are Used to present statistics that are representative of the population.representative of the population.

PostPost--Stratification (NonStratification (Non--response) Weightsresponse) Weights

–– Used to compensate for that fact that persons Used to compensate for that fact that persons with certain characteristics are not as likely to with certain characteristics are not as likely to respond to the survey.respond to the survey.

Weighting

Page 21: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

Calculating WeightsCalculating Weights

Design WeightsDesign Weights

–– If we know the sampling fraction (ratio of If we know the sampling fraction (ratio of

sampling size to population size) for each sampling size to population size) for each

case, the weight is merely the inverse of the case, the weight is merely the inverse of the

sampling fraction.sampling fraction.

PostPost--Stratification (NonStratification (Non--response) Weightsresponse) Weights

–– Base on population estimates.Base on population estimates.

Weighting

Page 22: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

Calculating WeightsCalculating Weights

When weighting on multiple characteristics When weighting on multiple characteristics

we must use a more complicated we must use a more complicated

procedure that I havenprocedure that I haven’’t learned yet.t learned yet.

–– Weight each separately but sequentiallyWeight each separately but sequentially

–– Use a huge X row by Y column tableUse a huge X row by Y column table

–– Manual iterationManual iteration

–– Automatic iteration (Ranking)Automatic iteration (Ranking)

–– Logistic regressionLogistic regression

Weighting

Page 23: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

Problems with WeightsProblems with Weights

Standard errors are more difficult to Standard errors are more difficult to

evaluate.evaluate.

The process can be difficult, with little The process can be difficult, with little

clear advice.clear advice.

–– Creating practical weights requires arbitrary Creating practical weights requires arbitrary

choices about inclusion of weighting factors choices about inclusion of weighting factors

and interactions, pooling of weighting cells, and interactions, pooling of weighting cells,

and truncation of weights.and truncation of weights.

Weighting

Page 24: Data Cleaning, Missing Data Analysis, & Weighting Brownbag

Reference ListReference ListSPSS Missing ValuesSPSS Missing Values™™ 17.0. (2007). Chicago, IL: SPSS Inc.17.0. (2007). Chicago, IL: SPSS Inc.

Allison, P. D. (2001). Allison, P. D. (2001). Missing DataMissing Data. Thousand Oaks, CA: SAGE Publications.. Thousand Oaks, CA: SAGE Publications.

Chapman, A. D. (2005). Chapman, A. D. (2005). Principles and Methods of Data CleaningPrinciples and Methods of Data Cleaning. Copenhagen, Denmark: . Copenhagen, Denmark:

Global Biodiversity Information Facility.Global Biodiversity Information Facility.

Garson, G. D. (2009, January 14). Sampling. Garson, G. D. (2009, January 14). Sampling. StatnotesStatnotes: Topics in Multivariate Analysis: Topics in Multivariate Analysis

Retrieved April 13, 2010, from http://faculty.chass.ncsu.edu/garRetrieved April 13, 2010, from http://faculty.chass.ncsu.edu/garson/PA765/sampling.htmson/PA765/sampling.htm

Garson, G. D. (2009, November 18). Data Imputation for Missing VGarson, G. D. (2009, November 18). Data Imputation for Missing Values. alues. StatnotesStatnotes: Topics : Topics

in Multivariate Analysisin Multivariate Analysis Retrieved January 22, 2010, from Retrieved January 22, 2010, from

http://faculty.chass.ncsu.edu/garson/PA765/missing.htmhttp://faculty.chass.ncsu.edu/garson/PA765/missing.htm

GelmanGelman, A. (2007). Struggles with survey weighting and regression mode, A. (2007). Struggles with survey weighting and regression modeling. ling. Statistical Statistical

Science, 22Science, 22(2), 153(2), 153--164. 164. doidoi: 10.1214/088342306000000691: 10.1214/088342306000000691

Little, R. J. A. (1988). A Test of Missing Completely at Random Little, R. J. A. (1988). A Test of Missing Completely at Random for Multivariate Data with for Multivariate Data with

Missing Values. Missing Values. Journal of the American Statistical Association, 83Journal of the American Statistical Association, 83(404). (404). doidoi: :

10.2307/229015710.2307/2290157

Little, R. J. A., & Rubin, D. B. (1987). Little, R. J. A., & Rubin, D. B. (1987). Statistical analysis with missing dataStatistical analysis with missing data. New York: John . New York: John

Wiley & Sons.Wiley & Sons.

MaleticMaletic, J. I., & Marcus, A. (2000, October 20, J. I., & Marcus, A. (2000, October 20--22). 22). Data cleansing: Beyond integrity analysis.Data cleansing: Beyond integrity analysis.

Paper presented at the Conference on Information Quality (IQ2000Paper presented at the Conference on Information Quality (IQ2000), Boston, MA.), Boston, MA.

References