Transcription of Handling missing data in Stata: Imputation and likelihood …
1 IntroductionMultiple ImputationFull information maximum likelihoodConclusionHandling missing data in Stata: Imputation andlikelihood-based approachesRose MedeirosStataCorp LP2016 Swiss Stata Users Group meetingMedeirosHandling missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionMissing ValuesMissing values are ubiquitous in many disciplinesRespondents fail to fully complete questionnairesFollow-up points are missingEquiptment malfunctionsA number of methods of Handling missing values have beendevelopedMedeirosHandling missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionTraditional MethodsComplete case analysis analyze only those cases with completedata on some set of variablesPotentially biased unless the complete cases are a random sample ofthe full sampleHot deck picking a fixed value from another observation with thesame covariatesNot necessarily deterministic if there were many observations with thesame covariate patternMean
2 Imputation replacing with a meanRegression Imputation replacing with a single fitted valueThe last three methods all suffer from too little variationReplace each missing value with a single good estimateMedeirosHandling missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionPrincipled MethodsMethods that produceUnbiased parameter estimates when assumptions are metEstimates of uncertainty that account for increased variability due tomissing valuesThis presentation focuses on how to implement two of thesemethods StataMultiple Imputation (MI)Full information maximum likelihood (FIML)Other principled methods have been developed, for exampleBayesian approaches and methods that explicitely modelmissingnessMedeirosHandling missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionMissing data MechanismsThe classic typology of missing data mechanisms, introduced by Rubin.
3 missing completely at random (MCAR)Missingness onxis unrelated to observed values of other variablesand the unobserved values ofxMissing at random (MAR)Missingness onxuncorrelated with the unobserved value ofx, afteradjusting for observed variablesMissing not at random (MNAR)Missingness onxis correlated with the unobserved value ofxMI and FIML both assume that missing data is either MAR or MCARM edeirosHandling missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionAn ExampleThe example used throughout this presentation uses data from theNational Health and Nutrition Examination Survey II contained ll regress diastolic blood pressure (bpdiast) on body massindex (bmi) and age in years (age)The starting dataset contains no missing values on the analysisvariablesMissing values were created forbmiandageThe missing values are MARM edeirosHandling missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionAnalysis with Complete data .
4 Webuse nhanes2. regress bpdiast bmi ageSource | SS df MS Number of obs = 10,351-------------+-------------------- -------------- F(2, 10348) = | 2 Prob > F = | 10,348 R-squared = +---------------------------------- Adj R-squared = | 10,350 Root MSE = | Coef. Std. Err. t P>|t| [95% Conf. Interval]-------------+----------------- ---------------------------------------- -------bmi | .9303882 .023599 .8841295 .9766469age | .1530495 .0067377 .1398423 .1662567_cons | .6425594 missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionSummarizing missing ValuesSwitching to the version of the dataset with missing values, we can summarize the missingvalues. use nh2miss. misstable summarizeObs<.
5 +------------------------------| | UniqueVariable | Obs=. Obs>. Obs<. | values Min Max-------------+--------------------------------+------------------------------age | 976 9,375 | 55 20 74bmi | 1,858 8,493 | >500 missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionMissing Value Patterns. misstable patternsMissing-value patterns(1 means complete)| PatternPercent | 1 2------------+-------------76% | 1 1|14 | 1 06 | 0 14 | 0 0------------+-------------100% |Variables are (1) age (2) bmiMedeirosHandling missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionEstimation Using Complete Case AnalysisBy default,regressperforms complete case analysis. regress bpdiast bmi ageSource | SS df MS Number of obs = 7,915-------------+--------------------- ------------- F(2, 7912) = | 2 Prob > F = | 7,912 R-squared = +---------------------------------- Adj R-squared = | 7,914 Root MSE = | Coef.
6 Std. Err. t P>|t| [95% Conf. Interval]-------------+----------------- ---------------------------------------- -------bmi | .7273228 .0255498 .6772383 .7774072age | .1215468 .0066455 .1085198 .1345738_cons | .6638102 missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionComparing Complete data to Listwise missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionWhat is Multiple Imputation ?Multiple Imputation (MI) is a simulation-based approach foranalyzing incomplete dataMultiple Imputation :replaces missing values with multiple sets of simulated values tocomplete the data Imputation stepapplies standard analyses to each completed dataset data analysisstepadjusts the obtained parameter estimates for missing -datauncertainty pooling stepThe objective of MI is to analyze missing data in a way that results inin valid statistical inference (Rubin 1996)MI does not attempt to produce imputed values that are as close aspossible the missing valuesMedeirosHandling missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionPreparing the data for ImputationFirst, we need to tell Stata how to store the imputations.
7 Stata call mi set wideNext we tell Stata what variables we plan to impute. mi register imputed bmi ageOptionally, we can also tell Stata what variables we don t plan to impute. mi register regular bpdiastMedeirosHandling missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionImputing missing Values. mi impute mvn bmi age = bpdiast, add(20)Performing EM optimization:note: 398 observations omitted from EM estimation because of all imputationvariables missing observed log likelihood = at iteration 8 Performing MCMC data augmentation ..Multivariate Imputation Imputations = 20 Multivariate normal regression added = 20 Imputed: m=1 through m=20 updated = 0 Prior: uniform Iterations = 2000burn-in = 100between = 100------------------------------------- -----------------------------| Observations per m|-------------------------------------- --------Variable | Complete Incomplete Imputed | Total-------------------+--------------- --------------------+----------bmi | 8493 1858 1858 | 10351age | 9375 976 976 | 10351----------------------------------- -------------------------------(complete + incomplete = total; imputed is the minimum across mof the number of filled-in observations.)
8 MedeirosHandling missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionObtaining MI Estimates. mi estimate: regress bpdiast bmi ageMultiple- Imputation estimates Imputations = 20 Linear regression Number of obs = 10,351 Average RVI = FMI = DF = 10348DF adjustment: Small sample DF: min = = = F test: Equal FMI F( 2, ) = VCE type: OLS Prob > F = | Coef. Std. Err. t P>|t| [95% Conf. Interval]-------------+----------------- ---------------------------------------- -------bmi | .9283816 .0263465 .8766788 .9800844age | .1510538 .0076479 .1360076 .1660999_cons | .7051584 missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionComparing MI missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionAdding Categorical VariablesIf the analysis model includes categorical variables, we ll want toinclude those in the Imputation model as wellTo demonstrate we ll add three categorical variables to our analysismodelThe analysis model is nowregress bpdiast bmi age s race (race) takes on 3 values and has missng valuesResondent s sex (female) is binary and has missing valuesRegion of the (region)
9 Takes on 4 values and is completeMedeirosHandling missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionImputing Categorical VariablesThe multivariate normal model implemented inmi impute mvnassumes all variables follow a multivariate normal distributionHowever, it turns out to be surprisingly robust to nonnormality(Schafer 1997; Demirtas et al. 2008), even when imputingcategorical variables ( , Lee and Carlin 2010)To includeraceandregionin a model usingmi impute mvnwewould need to createk 1 dummy variables to use in the imputationmodelAn alternative is to use the multivariate Imputation by chainedequations (MICE) approach to impute the missing valuesMedeirosHandling missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionMICEMICE allows us to specify the method used to impute each of thevariables in our modelIn Stata, MICE is implemented inmi impute chainedFor our example, we will useA linear model (regress) to imputebmiandageA logistic model (logit) to imputefemaleA multinomial logit model (mlogit)
10 To imputeracemi impute chainedallows the user to specify models for avariety of variable types, including binary, ordinal, nominal,truncated, and count variablesMedeirosHandling missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionUsingmi impute chainedAs before, we prepare the data for Imputation . mi set wide. mi register imputed bmi age race female. mi register regular bpdiast regionThen we can run the Imputation model. mi impute chained (regress) bmi age (logit) female ///(mlogit) race = bpdiast , add(20)Conditional models:age: regress age bmi bpdiast : regress bmi age bpdiast : logit female age bmi bpdiast : mlogit race age bmi bpdiast chained iterations ..Multivariate Imputation Imputations = 20 Chained equations added = 20 Imputed: m=1 through m=20 updated = 0 Initialization: monotone Iterations = 200burn-in = 10 MedeirosHandling missing data in StataIntroductionMultiple ImputationFull information maximum likelihoodConclusionmi impute chained(continued)bmi: linear regressionage: linear regressionfemale: logistic regressionrace.