I'm trying to update some imputation code that currently is written using ice to mi impute (and eventually to R and SAS)
Some background: The dataset is a health survey. I'm trying to impute drinking status (drinkstat, binary = current or not) and amount (logdra0 - log transformation) for non-participants.
I have the age, sex, level of education, indicator of whether they've experienced alcohol-related harm (harmalc), and indicator of whether they've died (mortall) for all individuals in the survey, and sampling weights (int_wt) for the participants only (non-participant's weights are set to 1).
I'm running Stata 14.
Currently, the code (written by a previous researcher in my post) is
Code:
#delimit; xi: ice age age2 harmalc mortall logdra0 drinkstat int_wt [pw=int_wt], m(70) eq(drinkstat: age age2 harmalc mortall int_wt, logdra0: age age2 harmalc mortall int_wt) cmd(logdra0: regress, drinkstat: logit) match(logdra0) matchpool(10) conditional(logdra0: drinkstat==1) by(i.sex i.education) seed(12345); #delimit cr
Code:
#delimit; mi impute chained (logit, augment) drinkstat (pmm, knn(10) cond(drinkstat== 1)) logdra0 = age age2 i.harmalc i.mortall int_wt [pw=int_wt], by(sex education) add(70) replace rseed(12345); #delimit cr
The error is:
Code:
mi impute: VCE is not positive definite The posterior distribution from which mi impute drew the imputations for logdra0 is not proper when the VCE estimated from the observed data is not positive definite. This may happen, for example, when the number of parameters exceeds the number of observations. Choose an alternate imputation model. error occurred during imputation of drinkstat logdra0 on m = 1 -- above applies to sex = Female, education = Post-doc
There are not too many missing values in comparison with the other groups (33 missing / 269 total). I've collapsed the number of education categories into 3, and the last group still runs into the same error, so I'm assuming its not a problem with the data itself.
It is potentially a problem with the weights - if I exclude the declaration of [pw=int_wt] then it is able to run successfully - keeping the weight variable in as a predictor variable only.
I've tested the effect of excluding the declared weights in the working ice code, and the results are different, so I do need them.
Does anyone have any suggestions of any work arounds?
Thanks in advance,
Megan
0 Response to Translating ice to mi impute and a not positive definite VCE
Post a Comment