Dear Stata List
I have a good sized data set ( >6000 records) of health data. In this data set I am interested in hospital stay (LOS), of which there was missing values for. Like with all larger data sets of this type there was missing data, which I used a MICE with PMM for, code for this:
mi set mlong
mi register imputed LOS TBRange Depth RA SES Cause
mi impute chained (pmm, knn(5)) LOS TBRange Depth RA SES Cause = Gender AgeRange, add(10)
mi xeq 0 1 10: summarize LOS
mi xeq 0 1 10: summarize TBRange
mi xeq 0 1 10: summarize Depth
mi xeq 0 1 10: summarize RA
mi xeq 0 1 10: summarize SES
mi xeq 0 1 10: summarize Cause
This has run beautifully, and filled in the missing data within the required ranges. Now what I would like to do is look at factors which may be associated with a longer hospital stay (LOS). For this I was going to undertake a stepped cox regression. In this model LOS is my time and there is no fail as everyone fails as they are discharged from hospital. The code I have used for this is:
mi stset LOS
This gives me the following error: variable LOSm registered as imputed Imputed and passive variables may not be used as the basis for mi stset. r(459);
If I extract one of the imputed sets i.e mi extract 10. I can stset the LOS for this data set and run my survival model. I have had it suggested that there may be another variable interfering, so I have been through my data set and culled anything not used in the survival model, but this has not resolved this error either. So my questions:
Is Stata unable to use imputed variables for stset?
Is there a straight forward way around this?
My next option is to write a do file to loop through and extract, stset and do the cox regression for each imputation, but I don’t like the thought of having to bring it all back together in a coherent fashion after the many imputations. While I have only run the MICE over 10, I do have the intention of running this 40 times. I would values and thoughts or feedback on options.
Kind regards
Courtney
I have a good sized data set ( >6000 records) of health data. In this data set I am interested in hospital stay (LOS), of which there was missing values for. Like with all larger data sets of this type there was missing data, which I used a MICE with PMM for, code for this:
mi set mlong
mi register imputed LOS TBRange Depth RA SES Cause
mi impute chained (pmm, knn(5)) LOS TBRange Depth RA SES Cause = Gender AgeRange, add(10)
mi xeq 0 1 10: summarize LOS
mi xeq 0 1 10: summarize TBRange
mi xeq 0 1 10: summarize Depth
mi xeq 0 1 10: summarize RA
mi xeq 0 1 10: summarize SES
mi xeq 0 1 10: summarize Cause
This has run beautifully, and filled in the missing data within the required ranges. Now what I would like to do is look at factors which may be associated with a longer hospital stay (LOS). For this I was going to undertake a stepped cox regression. In this model LOS is my time and there is no fail as everyone fails as they are discharged from hospital. The code I have used for this is:
mi stset LOS
This gives me the following error: variable LOSm registered as imputed Imputed and passive variables may not be used as the basis for mi stset. r(459);
If I extract one of the imputed sets i.e mi extract 10. I can stset the LOS for this data set and run my survival model. I have had it suggested that there may be another variable interfering, so I have been through my data set and culled anything not used in the survival model, but this has not resolved this error either. So my questions:
Is Stata unable to use imputed variables for stset?
Is there a straight forward way around this?
My next option is to write a do file to loop through and extract, stset and do the cox regression for each imputation, but I don’t like the thought of having to bring it all back together in a coherent fashion after the many imputations. While I have only run the MICE over 10, I do have the intention of running this 40 times. I would values and thoughts or feedback on options.
Kind regards
Courtney
Comment