[R] Error message using mi() in mi package
Andrew Miles
rstuff.miles at gmail.com
Tue Jul 6 20:13:16 CEST 2010
On Jul 6, 2010, at 1:30 PM, Peter Ehlers wrote:
> On 2010-07-06 10:37, Andrew Miles wrote:
>> Hello!
>>
>> I get the following message when I run the mi() function from the mi
>> package.
>>
>> Error while imputing variable: c3 , model: mi.polr
>> Error in eval(expr, envir, enclos) : could not find function
>> "c14ordered"
>>
>> Here's the situation:
>>
>> I am running R v. 2.9.2 on Mac OSX v. 10.5.8. I am trying to impute
>> missing data in a data set that I've trimmed down to 302 variables.
>> I've
>> created an mi.info() object on the data, and I've updated the
>> "type" of
>> variable where necessary so that the mi() imputing function uses the
>> most appropriate type of models to estimate imputed values. The data
>> have no collinearlity. I then run the mi function like this:
>>
>> imp = mi(imp.data, info=info2, n.iter=10)
>>
>> where imp.data is my data set of 302 variables and info2 is my
>> modified
>> mi.info object. I get the message as posted above. The message only
>> occurs when working on a variable I have labeled as
>> "ordered-categorical." But the mi() function processes most variables
>> labeled as "ordered-categorical" just fine. In fact, if shrink my
>> data
>> set (say, to just 5 variables) I can get mi() to process a
>> problematic
>> variable just fine as well.
>>
>> I'm not sure what the function "c14ordered" is that the error message
>> refers to. My first thought is maybe it is referring to one of my
>> variables in my data? Variables names in my data follow a basic
>> letter-number pattern (i.e. a1, a2, etc.), but there is no c14,
>> rather
>> c14a1, c14a2, etc. So I'm not sure if the variable has anything to do
>> with the problem, but I thought I'd mention it just in case someone
>> wiser in this matter than I can see something I cannot.
>>
>> I cannot post code that reproduces the problem due to the nature of
>> the
>> code and data involved.
>>
>> Any help would be appreciated, as I am not sure what is happening,
>> and
>> can't see why I can sometimes impute a variable labeled as
>> "ordered-categorical" and sometimes cannot.
>>
>> Thanks!
>>
>> Andrew Miles
>>
>
> This looks suspiciously like a syntax problem.
> I would get my text editor to search for 'c14ordered'
> in the code. You might have missed some punctuation.
>
> -Peter Ehlers
A good thought. I checked my own code (the stuff coding the data and
using the mi package) and, for good measure, the code of the mi.polr
function in the mi package, but the string "c14ordered" never appears.
More information about the R-help
mailing list