Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: midiagplots for mi impute chained command: multiple imputation in stata


From   "O'Keeffe, Linda" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: midiagplots for mi impute chained command: multiple imputation in stata
Date   Tue, 28 Jan 2014 13:34:58 +0000

Hi STATA USERS

I am using  mi impute chained command in stata.

I have used dryrun to test that my models are appropriate and converge first of all and have now imputed with customised equations 5 datasets for 4 variables BMI(continuous) and smoking, binge before pregnancy and binge during which are binary categorical variables.

I am using a number of other variabels with some (very few) missing values to impute these data. The models converge and everything looks ok.

I next go to do midiagplots to look at some diagnostics of observed vs. imputed values etc. However, I am getting an error message that I seem to not be able to resolve and cannot figure out what I am doing wrong. I include all of my syntax below.

***********************************************************************************************************
*STEP 1 Telling STATA dateset is wide
mi set wide

***********************************************************************************************************
*STEP 2 Register variables as imputed, regular or passive
mi register imputed Any_binge_before Any_binge_pregnancy BMI Any_smoking_preg 

mi register regular Insurance_status Low_birthweight q9 pregnancy_intention Mothers_age q12 q1 ///
Preterm_birth Physical_last_guidelines folic_acid_first q11 q10 Physical_before_guidelines q32 folic_acid_before q75 ethnicity_2gp q43 ///
Prepregnancy_alcohol_consumption Modeofdelivery Any_alcohol education_2gp depression_postpartum

*************************************************************************************************************
*STEP 3 REAL IMPUTATION WITH CUSTOMISED EQUATIONS FOR EACH VARIABLE AND 5 IMPUTED DATASETS
mi impute chained ///
(regress, omit (i.Any_alcohol i.education_2gp)) BMI ///
(logit, omit (i.Any_alcohol i.education_2gp)) Any_smoking_preg ///
(logit, omit (i.Preterm_birth i.Low_birthweight i.Prepregnancy_alcohol_consumption i.Modeofdelivery i.Any_alcohol i.Insurance_status i.ethnicity_2gp i.education_2gp i.q9)) Any_binge_pregnancy ///
(logit, omit (i.Prepregnancy_alcohol_consumption i.Any_alcohol i.education_2gp)) Any_binge_before ///
= i.Low_birthweight i.q9 i.pregnancy_intention Mothers_age i.q12 i.q1 ///
i.Preterm_birth i.Physical_last_guidelines i.folic_acid_first i.q11 i.q10 i.Physical_before_guidelines i.q32 i.folic_acid_before i.q75 i.ethnicity_2gp i.q43 ///
i.Prepregnancy_alcohol_consumption i.Modeofdelivery i.Any_alcohol i.education_2gp i.depression_postpartum i.Insurance_status i.Low_birthweight, add(5) replace rseed (1234) force

********************************************************************************************************************
midiagplots BMI
**************************

RESULTS OF MIDIAGPLOTS.******************

 midiagplots BMI
(M = 15 imputations)
(imputed: Any_binge_before Any_binge_pregnancy BMI Any_smoking_preg)
_0_Prepregnancy_alcohol_consumption invalid name
r(198);

ERROR***********************************************

r198: [P]     error . . . . . . . . . . . . . . . . . . . . . . . .  Return code 198
        invalid syntax;
        option __________ incorrectly specified;
        option __________ not allowed;
        __________ invalid;
        range invalid;
        __________ invalid obs no;
        invalid filename;
        __________ invalid varname;
        __________ invalid name;
        multiple by's not allowed;
        __________ found where number expected;
        on or off required;
        All items in this list indicate invalid syntax.  These errors
        are often, but not always, due to typographical errors.  Stata
        attempts to provide you with as much information as it can.
        Review the syntax diagram for the designated command.
        In giving the message "invalid syntax", Stata is not helpful.
        Errors in specifying expressions often result in this message.

(end of search)


The results appear to be telling me that Prepregnancy_alcohol consumtion is an invalid name. But this variable is not an imputed variable. It is a regular variable. So I do not understand why it is picking it up in the MIDIAGPLOTS command.

Any help is most greatly appreciated.
Linda

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index