[R] error: in catg (xi, name=nam, label=lab): "LO2" has <2 category levels

Frank Harrell f.harrell at vanderbilt.edu
Fri Sep 7 15:23:38 CEST 2012


You appeaer to be using the rms package.  Please follow the posting guide.

The error message looks to be self-explanatory (empty cell); you just have
to find which predictor it applies to.
As an aside, rms does not like you to use factor() in a model, and there's
probably a more concise way to deal with all the L variables.
Frank

Tvandenberg wrote
> 
> Dear R-users,
> 
> During a fit procedure in a  Logistic prediction model I encounter the
> following problem:
> 
> error: in catg (xi, name=nam, label=lab: X has <2 category levels
> 
> The following code is used:
> 
> fit <-lrm(MRI_Diag_RC ~ factor(O4_1r) + N6_1r + leeftijd + LO1 + LO2 +
> LO3+ LO4+ LO5+ LO6+ LO7+ LO8+ LO9+ LO10+ LO11+ LO12+ LO13 + LO14+ LO15+
> LO16+ LO17+ LO18+ LO19+ LO20+ LO21+ LO22+ LO23+ LO24 + LO26+ LO27 + LO29,
> model=T, x=T, y=T, data=dat)
> 
> Most predictors are (dichotomous) nominal variables as is the problematic
> "LO2". Does anyone know what the problem is and how I can correct it?
> 
> Kind regards,
> 
> Tobias
> 




-----
Frank Harrell
Department of Biostatistics, Vanderbilt University
--
View this message in context: http://r.789695.n4.nabble.com/error-in-catg-xi-name-nam-label-lab-LO2-has-2-category-levels-tp4642495p4642501.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list