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

# Re: st: ICE with Interval Error #459 multiple imputation

 From Nick Cox To statalist@hsphsun2.harvard.edu Subject Re: st: ICE with Interval Error #459 multiple imputation Date Tue, 21 Aug 2012 19:25:29 +0100

```The initial assignments to 999 are puzzling here.

This code can be condensed to

foreach v in sclifeca2 sclifeca3 sclifeca4 {
gen `v'll1 = cond(`v' == ., 1, `v')
gen `v'ul7 = cond(`v' == ., 7, `v')
}

Nick

On Tue, Aug 21, 2012 at 6:56 PM, Laura Kudrna <laura.kudrna@gmail.com> wrote:
> Dear Antonis,
>
> Thank you very much for solving my problem!  Using the ologit prefix
> combined with your example for how to set my upper and lower limits
> solved everything.
>
> For anyone else who struggles, I've included my syntax below for
> defining the upper and lower limits of my variables sclifeca2,
> sclifeca3, and sclifeca4 to 7 and 1, respectively.
>
> Best wishes,
> Laura
>
> gen sclifeca2ll1 = 999
> replace sclifeca2ll1 = sclifeca2 if sclifeca2 !=.
> replace sclifeca2ll1 = 1 if sclifeca2 == .
>
> gen sclifeca2ul7 = 999
> replace sclifeca2ul7 = sclifeca2 if sclifeca2 !=.
> replace sclifeca2ul7 = 7 if sclifeca2 == .
>
> gen sclifeca3ll1 = 999
> replace sclifeca3ll1 = sclifeca3 if sclifeca3 !=.
> replace sclifeca3ll1 = 1 if sclifeca3 == .
>
> gen sclifeca3ul7 = 999
> replace sclifeca3ul7 = sclifeca3 if sclifeca3 !=.
> replace sclifeca3ul7 = 7 if sclifeca3 == .
>
> gen sclifeca4ul7 = 999
> replace sclifeca4ul7 = sclifeca4 if sclifeca4 !=.
> replace sclifeca4ul7 = 7 if sclifeca4 == .
>
> gen sclifeca4ll1 = 999
> replace sclifeca4ll1 = sclifeca4 if sclifeca4 !=.
> replace sclifeca4ll1 = 1 if sclifeca4 == .
>
>
> On Mon, Aug 13, 2012 at 7:49 AM, A Loumiotis
> <antonis.loumiotis@gmail.com> wrote:
>> Perhaps you could also try to use ologit instead of intreg to impute
>> sclifeca2.  Make sure you use the o. prefix, ie,
>> ice o.sclifeca2 ..., saving(imputed_dataset) m(5)
>>
>> On Mon, Aug 13, 2012 at 9:20 AM, A Loumiotis
>> <antonis.loumiotis@gmail.com> wrote:
>>> Hi Laura,
>>>
>>> I'm not sure if you are setting up your lower and upper variables
>>> correctly because you said that when the observation is not missing
>>> both upper and lower bounds take the value of 7.  This is not correct.
>>>  They must be equal to the non-missing value.  Here is an example of
>>> how they should look:
>>>
>>> input sclifeca2 ll1 ul7
>>> 4 4 4
>>> . 1 7
>>> 2.5 2.5 2.5
>>> 3 3 3
>>> . 1 7
>>> end
>>>
>>> Best,
>>> Antonis
>>>
>>>
>>>
>>>
>>> On Fri, Aug 10, 2012 at 9:32 PM, Laura Kudrna <laura.kudrna@gmail.com> wrote:
>>>> Hi,
>>>>
>>>> Thank you for your response.  Apologies about ICE, I'm new to the
>>>> listserve: ICE comes from //www.homepages.ucl.ac.uk/~ucakjpr/stata/
>>>>
>>>> upper limit variable ul7 that has no missing values and I include it
>>>> in the ice code, the upper and lower bounds remain 7.  But for
>>>> example, when I impute my variable sclifeca2  "Life Satisfaction"
>>>> which has a scale of 1 to 7 I get imputed values ranging from -0.5 to
>>>> 9.  I am using multiple imputation to impute all the predictor and
>>>> explanatory variables at once.
>>>>
>>>> I replicated the STATA code precisely from the ICE help for interval.
>>>>
>>>> ICE help for interval states:  ...intlist has the syntax varname:llvar
>>>> ulvar [, varname:llvar ulvar ...], where each varname is an
>>>> interval-censored variable, each llvar contains the lower bound (a)
>>>> for varname and each ulvar contains the upper bound (b)
>>>>
>>>> My syntax is: ice ll1 ul7 sclifeca2 .....(other variables).....,
>>>> saving(imputed_dataset) m(5) interval(sclifeca2:ll1 ul7).
>>>>
>>>> I still can't understand why I am getting the error message and I
>>>> would be most grateful if you have any other suggestions on how to fix
>>>> it.
>>>>
>>>> Best wishes,
>>>> Laura
>>>>
>>>>
>>>> On Fri, Aug 10, 2012 at 7:32 AM, A Loumiotis
>>>> <antonis.loumiotis@gmail.com> wrote:
>>>>> If the variable that you are imputing with interval regression is not
>>>>> missing then the lower and upper bounds should equal that non missing
>>>>> value.  Is this true in your case?  See -help ice- especially the
>>>>> interval option.
>>>>>
>>>>> -ice- is a user written program available from SJ-9-3.  Please state
>>>>> where user written programs come from as explained in Statalist FAQ.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Aug 10, 2012 at 12:29 AM, Laura Kudrna <laura.kudrna@gmail.com> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I am having the same error message / problem as the post below from
>>>>>> the STATA message boards - Error #459.  It occurs when using the
>>>>>> interval option with ICE.
>>>>>>
>>>>>> I generated two variables, ll1 and ul7, containing values of 1 and 7
>>>>>> respectively to set the upper and lower bound for my variable
>>>>>> sclifeca2.
>>>>>>
>>>>>> My STATA code is:
>>>>>>
>>>>>> ice ll1 ul7 sclifeca2 sclifeca3 sclifeca4 sclddr2 sclddr3 sclddr4
>>>>>> iincome2 iincome3 iincome4 education2 occupation2 unemployed2
>>>>>> unemployed3 sex2 age2 age3 age4 partner2 partner3 partner4 vehicles2
>>>>>> vehicles3 vehicles4 holiday2 holiday3 holiday4 secprop2 secprop3
>>>>>> secprop4 weight2 weight3 weight4, saving(imputed_dataset) m(5)
>>>>>> interval(sclifeca2:ll1 ul7)
>>>>>>
>>>>>> My error message is:
>>>>>> Error #459 encountered while running -uvis-
>>>>>> I detected a problem with running uvis with command intreg on response sclifeca2
>>>>>> and covariates sclifeca3 sclifeca4 sclddr2 sclddr3 sclddr4 iincome2
>>>>>> iincome3 iincome4 education2 occupation2 unemployed2 unemployed3 sex2
>>>>>> ag
>>>>>>> e2 age3 age4 partner2 partner3 partner4 vehicles2 vehicles3 vehicles4 holiday2 holiday3 holiday4 secprop2 secprop3 secprop4 weight2 weight
>>>>>>> 3 weight4.
>>>>>>
>>>>>> The offending command resembled:
>>>>>> uvis intreg sclifeca2 sclifeca3 sclifeca4 sclddr2 sclddr3 sclddr4
>>>>>> iincome2 iincome3 iincome4 education2 occupation2 unemployed2
>>>>>> unemployed3
>>>>>>> sex2 age2 age3 age4 partner2 partner3 partner4 vehicles2 vehicles3 vehicles4 holiday2 holiday3 holiday4 secprop2 secprop3 secprop4 weight2
>>>>>>>  weight3 weight4 , gen([imputed])
>>>>>>
>>>>>> you may wish to try the -persist- option to persist beyond this error.
>>>>>> dumping current data to ./_ice_dump.dta
>>>>>> something that should be true of your data is not
>>>>>>
>>>>>> When I use the "persist" option, the data is imputed, but doesn't set
>>>>>> the upper and lower bounds of my variable.
>>>>>>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```