*! version 1.1 21dec2016

Title

[MI] mi impute wlogit -- Weighted multiple imputation for binary variables using logistic regression

Syntax

mi impute wlogit
ivar [indepvars] , md(varname)
[options]

options

Main
impute_options any option of mi impute except noupdate and by().

* md(varname) specify variable containing the marginal distribution of ivar.

marginal use marginal weights in weighted multiple imputation; default is conditional weights.

* md(varname) is required.

The data must be mi set before using mi impute wlogit;
see [MI] mi set.

ivar must be mi register as imputed before using mi impute wlogit; see [MI] mi set.

indepvars may not contain factor variables; dummy variables for indepvars must be created prior to using mi impute wlogit.

Menu

Statistics > Multiple imputation

Description

Population-calibrated inference for incomplete binary/categorical variables via weighted multiple imputation

mi impute wlogit fills in missing values of a binary variable
ivar by using a weighted logistic regression imputation method, where weights are calculated
using the population-level marginal distribution of ivar.

For some variables in certain datasets, their corresponding marginal distributions in the population
can be obtained from external data sources (e.g., population surveys or censuses). If our study samples
in truth come from such a population, the population information can be fed into the imputation model
to calibrate inference to the population. In weighted multiple imputation, the population distribution
of ivar can be used to calculate probability weights, which are then used in multiple imputation
such that the post-imputation distribution matches the population level.

Imputaion procedure

In the imputation step, marginal/conditional weights calculated using the population marginal distribution of ivar
are attached to the complete cases, and a logistic regression model is fitted to the weighted complete
cases to obtain the maximum likelihood estimates of imputation model parameters theta and
their asymptotic sampling variance U. New parameters are then drawn from the large-sample
approximation N(theta, U) to its posterior distribution assuming non-informative priors.
Finally, imputed values are simulated from the logistic regression using these newly drawn parameters.

Derivation of marginal and conditional weights

Let the dataset of size N contain n_obs subjects with observed ivar and n_mis subjects with
missing ivar. The first set of weights is termed marginal weights, which only depend on the population
distribution of ivar. For each category j of ivar, the proportion of this category required
in the imputed data is calculated as p_imp = (p_pop*N - p_obs*n_obs)/n_mis, where p_pop and p_obs
denote the proportions of category j in the population and observed in the dataset, respectively.
Marginal weight for subjects with observed values of ivar in category j is therefore given by
w_m = 1/(p_obs/p_imp).

If there are covariates indepvars in the imputation model, their associations with ivar are not
reflected in marginal weights. Alternatively, weights can be calculated such that they account for the
effects of covariates in the imputation model. These weights are termed conditional weights, and can be derived
using the distribution of ivar obtained after estimating parameters of an imputation model
assuming MAR using the complete cases. Suppose the estimated proportion of category j of
ivar in the complete data after fitting a MAR imputation model to the complete cases is p_j,
then the proportion of this category required in the imputed data is given by p_imp = (p_pop*N - p_j*n_obs)/n_mis,
which implies that the conditional weight for this group is given by w_c = 1/(p_j/p_imp).

Options

impute_options include add(), replace, rseed(),
double, dots, noisily, nolegend, force; see
[MI] mi impute for details.

md(varname) specifies the variable containing the marginal distribution of ivar, which is used to derive marginal/conditional weights in weighted multiple imputation.

marginal specifies that weighted multiple imputation is performed using marginal weights; conditional weights are used by default when marginal is not stated.

Remarks

mi impute wlogit works by calling the uvis (univariate imputation
sampling) command, which imputes missing values in the single variable ivar based
on multiple regression on indepvars.

mi impute wlogit requires Stata version 14.1 and the ice command from SSC.

Option replace currently works only with mi styles wide; data must be mi set before using mi impute wlogit.

indepvars may not contain factor variables; dummy variables for indepvars must be created prior to using mi impute wlogit.

Example

Generate full data of binary covariate X and binary outcome Y

. set seed 715209

. clear

. set obs 100000

. local beta0 = ln(0.5)

. local betax = ln(1.5)

. gen byte x = rbinomial(1, 0.7)

. gen byte y = runiform() < invlogit(`beta0' + `betax'*x)

Fit the model of interest to full data

. logit y x

Population marginal distribution of X is assumed to be the same as full-data distribution

. gen mdx = 0.7 if x

. replace mdx = 0.3 if !x

Generate missing data in X such that X is MNAR conditional on X and Y

. local phi0 = -0.75

. local phix = -1.5

. local phiy = -1

. gen byte x_mnar = x if runiform() >= invlogit(`phi0' + `phix'*x + `phiy'*y)

Fit the model of interest to the complete cases

. logit y x_mnar

Declare data and register x_mnar as imputed

. mi set wide

. mi register imputed x_mnar

. mi register regular y

Impute x_mnar using weighted multiple imputation with marginal weights

. mi impute wlogit x_mnar y, md(mdx) marginal add(10) noi dots

Impute x_mnar using weighted multiple imputation with conditional weights

. mi impute wlogit x_mnar y, md(mdx) replace

Fit the model of interest to each imputed dataset and combine results using Rubin's rules

. mi estimate, or: logit y x_mnar

Check if the post-imputation distribution of x_mnar matches the population level

. mi estimate: proportion x_mnar

Stored results

mi impute wlogit stores the following in r():

Scalars

r(negw) 1 if negative weight is detected; 0 otherwise

r(M) total number of imputations

r(M_add) number of added imputations

r(M_update) number of updated imputations

r(k_ivars) number of imputed variables

r(N_g) number of imputed groups

Macros

r(wtype) type of imputation weights used

r(method) name of imputation method (wlogit)

r(ivars) names of imputation variables

r(rngstate) random-number state used

Matrices

r(pwmi) imputation weights by categories of ivar

r(N) number of observations in imputation sample

r(N_complete) number of complete observations in imputation sample

r(N_incomplete) number of incomplete observations in imputation sample

r(N_imputed) number of imputed observations in imputation sample

Author

Tra My Pham, University College London, London UK.

tra.pham.09@ucl.ac.uk

Acknowledgement

I would like to thank Tim Morris for his suggestions to improve this command.

References

Royston P. 2004. Multiple imputation of missing values. Stata Journal 4(3):227-241.

Also see

mi impute
mi impute logit
mi impute wmlogit
mi estimate