*! version 1.0 20240927

mi impute from -- Impute using an external imputation model

Syntax

mi impute from
ivar [if]
[, options]

options

Main
b(matname) vector of regression coefficients used to impute

v(matname) corresponding matrix of variance/covariances used to impute

qreg quantile regression model for the quantitative variable ivar

mlogit multinomial logistic regression model for the categorical variable ivar

logit logistic regression model for the binary variable ivar

You must mi set your data before using mi impute from;
see [MI] mi set. Factor variables in indepvars are not allowed.

Description

mi impute from fills in missing values using an estimated imputation model estimated in one or multiple studies.
A quantitative missing variable can be imputed passing the estimates of 99 (q=0.01(.01).99) linear predictors of quantile regression models.
A categorical missing variable with k levels can be imputed passing k linear predictors of multinomial logistic regression models.
A binary (0/1) missing variable can be imputed passing the linear predictors of logistic regression models.
The command assumes that variables used in the imputation model are available in the current data.
The mi_impute_from_get is reading the files containing the estimated models, estimate a weighted inverse variance least square model to combine regression coefficients of the imputation model across studies, and formatting matrices to be passed to mi impute from.

Options

Main

b(matname) specifies a vector of regression coefficients for the imputation model to be used for ivar.

v(matname) specifies a matrix of variance/covariances for the imputation model to be used for ivar.

qreg specifies that the matrix b(matname) contains 99 (q=0.01(.01)0.99) linear predictors of the quantitative variable ivar to be imputed.

mlogit the imputation model is a multinomial logistic regression model for the categorical variable ivar.

logit the imputation model is a logistic regression model for the binary variable ivar.

add(), replace, rseed(), double; see
[MI] mi impute.

Example #1: Quantitative variable 100% missing

use http://www.stats4life.se/data/from/qreg_study_1, clear

mi set wide
mi register imputed z

// Get imputation model from one study (tab delimited .txt)

mi_impute_from_get , b(e_qreg_b_s2) v(e_qreg_v_s2) colnames(y x c _cons) imodel(qreg) path(http://www.stats4life.se/data/from/)

mat ib = r(get_ib)
mat iV = r(get_iV)

mi impute from z , add(10) b(ib) v(iV) imodel(qreg)
mi estimate, post eform imp(1/10): logit y x c z

// Get imputation model from 4 different studies

mi_impute_from_get , b(e_qreg_b_s2 e_qreg_b_s3 e_qreg_b_s4 e_qreg_b_s5) v(e_qreg_v_s2 e_qreg_v_s3 e_qreg_v_s4 e_qreg_v_s5) colnames(y x c _cons) imodel(qreg) path(http://www.stats4life.se/data/from/)

mat ib = r(get_ib)
mat iV = r(get_iV)

mi impute from z , add(10) b(ib) v(iV) imodel(qreg)
mi estimate, post eform imp(11/20): logit y x c z

Example #2: Categorical variable 100% missing

use http://www.stats4life.se/data/from/study_mlogit, clear

mi set wide
mi register imputed z

// Get imputation model from one study (tab delimited .txt)

mi_impute_from_get , b(e_mlogit_b_s2) v(e_mlogit_v_s2) values(0 1 2 3) colnames(y x c _cons) imodel(mlogit) path(http://www.stats4life.se/data/from/)

mat ib = r(get_ib)
mat iV = r(get_iV)

mi impute from z , add(10) b(ib) v(iV) imodel(mlogit)
mi estimate, post eform imp(1/10): logit y x c z

// Get imputation model from 4 different studies

mi_impute_from_get , b(e_mlogit_b_s2 e_mlogit_b_s3 e_mlogit_b_s4 e_mlogit_b_s5) v(e_mlogit_v_s2 e_mlogit_v_s3 e_mlogit_v_s4 e_mlogit_v_s5) colnames(y x c _cons) imodel(mlogit) path(http://www.stats4life.se/data/from/) values(0 1 2 3)

mat ib = r(get_ib)
mat iV = r(get_iV)

mi impute from z , add(10) b(ib) v(iV) imodel(mlogit)
mi estimate, post eform imp(11/20): logit y x c z

Example #3: Binary variable 100% missing

use http://www.stats4life.se/data/from/study_logit, clear

mi set wide
mi register imputed z

// Get imputation model from one study (tab delimited .txt)

mi_impute_from_get , b(e_logit_b_s2) v(e_logit_v_s2) colnames(y x c _cons) imodel(logit) path(http://www.stats4life.se/data/from/)

mat ib = r(get_ib)
mat iV = r(get_iV)

mi impute from z , add(10) b(ib) v(iV) imodel(logit)
mi estimate, post eform imp(1/10): logit y x c z

// Get imputation model from 4 different studies

mi_impute_from_get , b(e_logit_b_s2 e_logit_b_s3 e_logit_b_s4 e_logit_b_s5) v(e_logit_v_s2 e_logit_v_s3 e_logit_v_s4 e_logit_v_s5) colnames(y x c _cons) imodel(logit) path(http://www.stats4life.se/data/from/)

mat ib = r(get_ib)
mat iV = r(get_iV)

mi impute from z , add(10) b(ib) v(iV) imodel(logit)
mi estimate, post eform imp(11/20): logit y x c z

Reference

Thiesmeier R., Bottai M, Orsini N. 2024. Systematically missing data in distributed research networks: multiple imputation when data cannot be pooled. Journal of Statistical Computation and Simulation.

Stored results

mi impute from stores the following in r():

Scalars

r(M) total number of imputations

r(N) total number of observations

r(N_incomplete) total number of missing observations

r(M_add) number of added imputations

r(M_update) number of updated imputations

r(k_ivars) number of imputed variables (always 1)

Macros

r(method) name of imputation method (from)

r(ivars) name of imputation variable

r(rngstate) random-number state used