Skip to content
Prev 305121 / 398506 Next

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

Dear all,

As David mentioned, I used his R-code to try to see the dimension behind the 'LO2'  variable. These are the results:
[[1]]
   nee geen atrofie ja atrofie aanweizg 
                173                   0 
[[2]]
   nee geen atrofie ja atrofie aanweizg 
                169                   3 
[[3]]
   nee geen atrofie ja atrofie aanweizg 
                174                   0 
[[4]]
   nee geen atrofie ja atrofie aanweizg 
                172                   2 
[[5]]
   nee geen atrofie ja atrofie aanweizg 
                173                   2 
[[6]]
   nee geen atrofie ja atrofie aanweizg 
                171                   3 
[[7]]
   nee geen atrofie ja atrofie aanweizg 
                167                   5 
[[8]]
   nee geen atrofie ja atrofie aanweizg 
                174                   1 
[[9]]
   nee geen atrofie ja atrofie aanweizg 
                173                   1 
[[10]]
   nee geen atrofie ja atrofie aanweizg 
                175                   0 

I guess that the lrm model doesn't work - as I tried to model each subset separately, and it didn't work in subsets 1, 3 and 10 - because there are no persons in one of the two categories. Therefore this LO2 variable seems unable to be a predictor - let alone a strong predictor. Regardless of this, it seems strange that with a lot of simulations in which there is always a change that a specific variable by chance alone will consist of objects with only one category gives problems with estimating the prediction models. Does anyone have a suggestion how to deal with that?

Kind regards and thanks for all the help so far, 
Tobias


________________________________________
Van: David Winsemius [dwinsemius at comcast.net]
Verzonden: vrijdag 7 september 2012 18:17
Aan: Berg, Tobias van den
CC: PIKAL Petr; r-help
Onderwerp: Re: [R] error: in catg (xi, name=nam, label=lab): "LO2" has <2 category levels
On Sep 7, 2012, at 8:03 AM, Berg, Tobias van den wrote:

            
Instead do :

apply (subsets, function (x) {table(x$LO2)})

You cannot tell what distribution of values you are getting with str(). Just because a factor has 2 levels does NOT mean it has two unique values populating those levels.

--
David.
David Winsemius, MD
Alameda, CA, USA