0
$\begingroup$

I have a dataset with around 5000 observations. I have an independent variable 'passed' which is number of tests passed. This variable ranges from 0 to 6, but only has 9 observations in category 6. I'm unsure if I should treat is as a factor or as a numerical variable.

Reasons for continuous:

  • Plotting estimated mean log odds against 'passed' with 95% CIs gives a liner graph, apart from the last point. The last point has a huge CI (estimated by delta method which might not be applicable as only 9 observations) and is a bit higher than expected.
  • If I treat it as continuous, my model ends up having a lower AIC.

Reasons for categorical

  • I can group up the data from 5 and 6 tests passed to get rid of an issue with only 9 samples, so my plot with CIs is much more clean.
  • The data only takes discrete values.

I understand that treating the data as categorical removes ordering, but wouldn't the order be reflected in the coefficients for the categorical variables? Moreover, my main aim is to interpret my model for my dataset, and not to predict for observations that have 'passed' > 6.

$\endgroup$
5
  • $\begingroup$ Welcome to CV. The problem of how to deal with ordinal independent variables isn't specific to logistic regression, so I added the "ordinal data" tag. You can browse those questions and may well find a solution. In particular see stats.stackexchange.com/questions/195246/… $\endgroup$
    – Peter Flom
    Commented Jan 13 at 17:51
  • $\begingroup$ I saw those posts but I couldn't find out whether having a small number observations in certain categories affect my choice on how to treat this independent variable. $\endgroup$
    – minus123
    Commented Jan 13 at 18:04
  • $\begingroup$ OK. Could you edit your question to reflect that? Otherwise, it may get closed as a duplicate. $\endgroup$
    – Peter Flom
    Commented Jan 13 at 18:19
  • $\begingroup$ Related to @PeterFlom's comment: are those consecutive tests, in the sense that someone who passed test 3 must've also passed 1 & 2? In that case you might want to look into multinomial logit models. $\endgroup$
    – Durden
    Commented Jan 13 at 18:33
  • $\begingroup$ @Durden, no these tests are not consecutive. Apologies that wasn't clear $\endgroup$
    – minus123
    Commented Jan 13 at 18:49

0