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: trouble with mi impute chained lower upper limits truncreg


From   Leah Schinasi <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: trouble with mi impute chained lower upper limits truncreg
Date   Tue, 11 Mar 2014 15:20:58 +0000

We are writing to request assistance with a problem we are having using mi impute chained (truncreg). We are using stata version 12.

More specifically, we are having trouble specifying lower and upper limits on start-and end-year variables that must be logically sequenced. 
In a large cohort study, participants reported (retrospectively) if they ever in their lifetime conducted a task (pesticide use). If they ever conducted the task, they were asked to report the start year and the end year that they conducted the task (each as its own distinct variable). If they were still engaged in the activity at the time of enollment in the study then their end date was the year of enrollment in the study.Some participants are missing start year, some missing end year, and others are missing both.

We are working with the following three variables:

1) TASK-Whether participants conducted the task, such that the task is coded (.=missing, 0=no, 1=yes),
2) START_YEAR: The start year for the task, where start year is coded either missing, or a year between 1927 and 2005. If people did not conduct the task (task=0) then we assigned a value of 1977 to the start year. If people were missing information on TASK, then the START_YEAR is coded as missing. 
3) END_YEAR: If participants conducted the task, the end year for the task, where the end year is coded either missing, or a year between 1944 and 2007. If people did not conduct the task (task=0) then we assigned a value of 2000 to the end year. If people were missing information on TASK, then the START_YEAR is coded as missing.

The start year is restricted so that it must be between the participant’s birth year + 10 years (YEAR_TEN). We have made this resriction because we do not expect that the person would have started the tast until at least the age of ten. The start year must also be less than or equal to the END_YEAR. The END_YEAR must be greater than or equal to the START_YEAR and less than or equal to the year of enrollment in the study (ENROLLMENT_YEAR). 

We are having trouble with our imputation of missing data for the start and end year variables. We want to make sure that we can impute start and end years logically so that for each person who performed the task, START_YEAR<=END_YEAR. 

Below is the code that we have been using:

*create a variable to define the birth year plus ten years, since this is the lower limit for *the start year. 

gen year_ten=BIRTH_YEAR+10

*generate a variable to define the upper limit for the *START_YEAR We define the upper limit for the start *year as *the enrollment year if they conducted the task but were *missing the end year variable. We define *the upper limit for the start year as the end year if they conducted the *task but had data on the end year. *Anyone who was missing data on the task (task=.) in the original data set has *their upper limit for the start *date set to enrollment year. 

generate UPPER_LIMIT_START=ENROLLMENT_YEAR
replace UPPER_LIMIT_START=ENROLLMENT_YEAR if TASK==1 & END_YEAR==.
replace UPPER_LIMIT_START=END_YEAR if TASK==1 & END_YEAR !=.

*generate a variable to define the lower limit for the end_year. We define the lower limit for the end year as *the birth year plus ten (year_ten) if they conducted the task (task=1) but were missing the start_year variable *(start_year==.) We define the lower limit for *the end year as the start year if they conducted the task 
*(task==1) and the variable for *start year was not equal to missing. Anyone who was missing data on the *task (task=.) has their lower limit for the END_YEAR set to be the year of birth + ten (year_ten).

generate LOWER_LIMIT_END=YEAR_TEN
replace LOWER_LIMIT_END=YEAR_TEN if TASK==1 & START_YEAR==. 
replace LOWER_LIMIT_END=END_YEAR if TASK==1 & END_YEAR!=.

set more off
mi set mlong
mi register imputed TASK START_YEAR END_YEAR 
mi register regular CANCER_EVENT FOLLOW_UP_YEARS age YEAR_TEN ENROLLMENT_YEAR
mi impute chained (logit) TASK (truncreg, cond (if TASK==1) ll (YEAR_TEN) ul(UPPER_LIMIT_START)) START_YEAR (truncreg, cond (if TASK==1) ll (LOWER_LIMIT_END) ul(ENROLLMENT_YEAR)) END_YEAR =CANCER_EVENT FOLLOW_UP_YEARS age, add(1) rseed(2332) force noisily

We receive the following error message: 
no observations
error occurred during imputation of START_YEAR END_YEAR on m = 1

We have also tried using the following code:

mi impute chained (truncreg, ll (YEAR_TEN) ul(END_YEAR)) START_YEAR (truncreg, ll (START_YEAR) ul(ENROLLMENT_YEAR)) END_YEAR =CANCER_EVENT FOLLOW_UP_YEARS age, add(1) rseed(2332) force noisily

but we receive this message: 
initial values not feasible
error occurred during imputation of START_YEAR END_YEAR on m = 1

I will appreciate any ideas you have for ways to solve this problem.


Thank you in advance!
Leah-----------------------------------------------------------------------
This message and its attachments are strictly confidential. If you are
not the intended recipient of this message, please immediately notify 
the sender and delete it. Since its integrity cannot be guaranteed, 
its content cannot involve the sender's responsibility. Any misuse, 
any disclosure or publication of its content, either whole or partial, 
is prohibited, exception made of formally approved use
-----------------------------------------------------------------------

*
*   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