ORs for multiple categories in logistic regression

,

I have a visualisation problem when running the following code for univariate regression, of multinomial covariates with 3+ categories/strata.

bddf %>%

  • select(vachpv, age_HPV, lieu_nais_agr, lang_mat_agr) %>%*
  • gtsummary::tbl_uvregression(*
  • method = glm, y = vachpv, method.args = list(family = binomial(link = “logit”)),*
  • exponentiate = TRUE)*

Only 1 single Odds Ratio (OR) is displayed as the result, instead of an OR for each category/strata within the covariate :

                          |N|   OR|        95% CI|         p-value|

|Classe d’âge |406| 0,94| 0,59 – 1,51| 0,8|
|Lieu de naissance|404| 0,35| 0,18 – 0,63| <0,001|
|Langue maternelle|406| 0,68| 0,52 – 0,85| 0,002|

The covariates were recoded and converted to factors:

bdd$classe_age ← factor(bdd$classe_age)
bdd$lieu_nais_agr ← factor(bdd$lieu_nais_agr)
bdd$lang_mat_agr ← factor(bdd$lang_mat_agr)

*bdd ← bdd %>% *

  • mutate(*
  • lieu_nais_agr = case_when(*
  •  (lieu_nais == A) ~ 1,*
    
  •  (lieu_nais == B) ~ 2,*
    
  •  (lieu_nais == C) ~ 3*
    
  • )*
  • )*

Is there a modification in the R code which will produce and output ORs for each strata/category?

Welcome @kellyd18 !

It is easiest to help you if you format a small piece of your data and the code as a reproducible example “reprex” - can you try that? Video and instructions here.

Is it possible that your classe_age, lieu_nais_agr, and lang_mat_agr columns are not factors? Can you check with class() before sending them into the tabling command? The behavior seen is consistent as if they are still being treated as numeric.

Is it also possible that you are saving them as factors in the dataframe bdd, but not in bddf which is being piped to the tbl_uvregression() command?

Another tip is that you can post all your code here in the forum in one chunk using three backticks above and below, like this (but a full reprex is better):

```
bddf %>%
 select(vachpv, age_HPV, lieu_nais_agr, lang_mat_agr) %>%
 gtsummary::tbl_uvregression(
 method = glm, y = vachpv, method.args = list(family = binomial(link = “logit”)),
 exponentiate = TRUE)
```