Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it a bug? When adding variable "extent" from colon_s into finalfit() model, the odds ratio cannot be displayed correctly. #78

Closed
zhaohongxin0 opened this issue Sep 5, 2022 · 3 comments

Comments

@zhaohongxin0
Copy link

explanatory = c("age.factor","extent" , "sex.factor", "obstruct.factor", "perfor.factor")
dependent = "mort_5yr"

t<-colon_s %>%
  finalfit(dependent, explanatory)

t

The results are:

<style> </style>
Dependent: Mortality 5 year   Alive Died OR (univariable) OR (multivariable)
Age <40 years 31 (46.3) 36 (53.7) - -
  40-59 years 208 (61.4) 131 (38.6) 0.54 (0.32-0.92, p=0.023) 0.54 (0.31-0.93, p=0.027)
  60+ years 272 (53.4) 237 (46.6) 0.75 (0.45-1.25, p=0.270) 0.77 (0.45-1.31, p=0.340)
extent 1 16 (80.0) 4 (20.0) - -
  2 78 (75.7) 25 (24.3) - -
  3 401 (53.5) 349 (46.5) - -
  4 16 (38.1) 26 (61.9) - -
Sex Female 243 (55.6) 194 (44.4) - -
  Male 268 (56.1) 210 (43.9) 0.98 (0.76-1.27, p=0.889) 0.97 (0.74-1.28, p=0.852)
Obstruction No 408 (56.7) 312 (43.3) - -
  Yes 89 (51.1) 85 (48.9) 1.25 (0.90-1.74, p=0.189) 1.20 (0.86-1.69, p=0.284)
Perforation No 497 (56.0) 391 (44.0) - -
  Yes 14 (51.9) 13 (48.1) 1.18 (0.54-2.55, p=0.672) 0.98 (0.45-2.16, p=0.970)
NA NA NA NA 2.22 (1.64-3.07, p<0.001) 2.25 (1.64-3.14, p<0.001)

it seems that the last row is the OR for "extent" as a continuous variable, but in the table, extent is considered as a factor but the OR is not displayed.
If I changed “extent” to a factor, it can be corrected. But how can I do when I want to do it as a continuous variable? cont_cut seems not work in finalfit().

@ewenharrison
Copy link
Owner

ewenharrison commented Dec 16, 2022

Many thanks for this. Apologies I didn't get a notification when this was posted.

It's kind of a bug, yes, in that a continuous variable with very few distinct values is being passed to a regression model. This would often be treated as a factor (see extent.factor).

A fix for this has been pushed with version 1.0.55.

Many thanks again,

@HoangAVu
Copy link

Hi! Can this be extended to or_plot() as well (adding a cont_cut arg)? My finalfit and or_plot are showing incohesive results, most likely because of this reason which causes one of my cont variables to be treated as factor.

@zhaohongxin0
Copy link
Author

I also want to know the updates.
cont_cut now is available in finalfit(), but it doesn't work in glmuni() or glmmulti(). That means we cannot get right results from a poisson model

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants