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

Quartiles instead of IQR in summary_factorlist ? #29

Closed
LukaszDerylo opened this issue Oct 23, 2019 · 4 comments
Closed

Quartiles instead of IQR in summary_factorlist ? #29

LukaszDerylo opened this issue Oct 23, 2019 · 4 comments

Comments

@LukaszDerylo
Copy link

Hello,

I think, it would be nice to have option to include quartiles along with median (instead of IQR).

IQR tells little about location of "middle half" of data, whereas quartiles do.

I mean something like Median (Q1-Q3) e.g. 20.7 (14.5-22.5).

What do you think?

Regards, and thanks for great work,
Lukasz

ewenharrison added a commit that referenced this issue Oct 24, 2019
@ewenharrison
Copy link
Owner

Thanks. This is done.

devtools::install_github('ewenharrison/finalfit')
library(finalfit)
explanatory = c("age", "age.factor", "sex.factor", "obstruct.factor")
dependent = "perfor.factor"
colon_s %>%
  summary_factorlist(dependent, explanatory, p=TRUE, 
                     cont = "median", cont_range = TRUE)

        label       levels                  No                 Yes     p
1 Age (years) Median (IQR) 61.0 (53.0 to 69.0) 60.0 (50.0 to 68.0) 0.578
2         Age    <40 years            68 (7.5)             2 (7.4) 1.000
3              40-59 years          334 (37.0)           10 (37.0)      
4                60+ years          500 (55.4)           15 (55.6)      
7         Sex       Female          432 (47.9)           13 (48.1) 0.979
8                     Male          470 (52.1)           14 (51.9)      
5 Obstruction           No          715 (81.2)           17 (63.0) 0.018
6                      Yes          166 (18.8)           10 (37.0)   

@LukaszDerylo
Copy link
Author

Great!

Although, I'd change "Median (IQR)" in levels column to something like "Median (quartiles)".

@ewenharrison
Copy link
Owner

Thanks. Yes please change in your own work, but I'm comfortable with the definition of "range" being the limits as well as the difference.

@LukaszDerylo
Copy link
Author

I agree that "range" can be understood as the limits as well as the difference, but IQR is special case of range that is strictly defined as difference between quartiles. So I think, using the name "IQR" for limits can lead to confusion: person, who sees "IQR" label expects a single value, just like he/she read in his/her textbook.

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

2 participants