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

PIKAL Petr petr.pikal at precheza.cz
Fri Sep 7 15:01:46 CEST 2012


Hi

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Tvandenberg
> Sent: Friday, September 07, 2012 1:05 PM
> To: r-help at r-project.org
> Subject: [R] error: in catg (xi, name=nam, label=lab): "LO2" has <2
> category levels
> 
> 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

I do not know lrm but the error seems to be explaining itself, some variable has only one level and shall have 2

sapply(sapply(dat, unique), length)

shall give you for used variables value 2 or more.

Regards
Petr


> 
> 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,
> LO17+ LO18+ LO19+ LO20+ LO21+ LO22+ LO23+ 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
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/error-in-
> catg-xi-name-nam-label-lab-LO2-has-2-category-levels-tp4642495.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list