[R] Error when running Conditional Logit Model

David Winsemius dwinsemius at comcast.net
Sat Dec 5 00:09:36 CET 2009


On Dec 4, 2009, at 5:49 PM, Hien Nguyen wrote:

> Dear Dr. Winsemius,
>
> Thank you very much for your reply.
>
> I have tried many possible combinations (even with the model of only  
> 2 predictors) but it produces the same message. With more than 4000  
> observations, I think 14 predictors might not be too many.

It is what happens in the factor combinations that concern me. I am  
guessing that some of those predictors are factors. You really should  
not ask r-help questions without providing better descriptions of both  
the outcomes and the predictor variables.

>
> Although my dependent variable (Pin) is not discrete  (it ranges  
> from 0 to 1), I do not think it will create problems to the  
> estimation but I'm not sure

I would think it _would_ cause problems. As I understand it,  
conditional methods create contingency tables. Why are you using an  
outcome type that is not consistent with the fundamental regression  
assumptions of the clogit function?

I do not get that particular error when I munge the infert dataset to  
have case be a random uniform value, but I do get an error.
 > infert$case <- runif(nrow(infert))
 > clogit(case~spontaneous+induced+strata(stratum),data=infert)
Error in Surv(rep(1, 248L), case) : Invalid status value

So I certainly would not have proceeded to submit a full analysis to  
clogit if I could not get a test case to run under the situation you  
propose.

-- 
David

>
> I have checked the collinearity among predictors and they are all <  
> 0.5 (which I think is OK). Do you know what else could make this  
> errors?
>
> Thanks a lot
>
> Hien Nguyen
>
> David Winsemius wrote:
>>
>> On Dec 4, 2009, at 9:22 AM, Hien Nguyen wrote:
>>
>>> Dear R-helpers,
>>>
>>> I am very new to R and trying to run the conditional logit model  
>>> using
>>> "clogit " command.
>>> I have more than 4000 observations in my dataset and try to  
>>> predict the
>>> dependent variable from 14 independent variables. My command is as  
>>> follows
>>>
>>> clmtest1 <-
>>> clogit(Pin~Income+Bus+Pop+Urbpro+Health+Student+Grad+NE+NW+NCC+SCC 
>>> +CH+SE+MRD+strata(IDD),data=clmdata)
>>>
>>>
>>> However, it produces the following errors:
>>>
>>> Error in fitter(X, Y, strats, offset, init, control, weights =  
>>> weights,  :
>>> NA/NaN/Inf in foreign function call (arg 6)
>>> In addition: Warning messages:
>>> 1: In Surv(rep(1, 4096L), Pinmig) : Invalid status value,  
>>> converted to NA
>>> 2: In fitter(X, Y, strats, offset, init, control, weights =  
>>> weights,  :
>>> Ran out of iterations and did not converge
>>>
>>> I search the error message from R forums but it does not say  
>>> anything
>>> for Conditional Logit Model.
>>
>> With that many predictors in a small dataset, you may have created  
>> matrix singularities. Perhaps you created a stratum where all of  
>> the subjects experience the event and others where none did so. The  
>> coefficients might be driven to infinities. Try simplifying the  
>> model.
>>
>>
>>>
>>> Please check for me what it says and what should I do to solve it.
>>>

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list