R4EPI / epitabulate

Tables for epidemiological analysis
https://R4EPI.github.io/epitabulate
GNU General Public License v3.0
8 stars 0 forks source link

Adding `tbl_cmh()` function #18

Closed ddsjoberg closed 3 years ago

ddsjoberg commented 3 years ago

To do list for @aspina7

FYI, this code depends on the current dev version of gtsummary. After the next release, you can delete the Remotes: field for gtsummary in the DESCRIPTION file, and set the minimum version number required to 1.4.0. (Same for broom.helpers)

gtsummary::trial %>%
    tbl_cmh(case = death, exposure = trt, strata = c(stage, grade))

image

aspina7 commented 3 years ago

Thanks @ddsjoberg - will try find some time to sink my teeth in to this!

ddsjoberg commented 3 years ago

How is this coming along @aspina7 ?

aspina7 commented 3 years ago

Sorry exam season at the moment so haven't got round to it yet. Planning to sit down with it over next few weeks as have a break. Thx!

On Mon, 8 Mar 2021, 02:16 Daniel Sjoberg, notifications@github.com wrote:

How is this coming along @aspina7 https://github.com/aspina7 ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/R4EPI/epibuffet/pull/18#issuecomment-792413543, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEL7IJY6Y3XDI5NNJUQF5ELTCQXQTANCNFSM4XSG64PQ .

aspina7 commented 3 years ago

only just sat down with this sorry, been through it now and the setup wrong making all the calculations wrong, will need to pull it apart and then put back together so will take me a little while longer- thanks!

ddsjoberg commented 3 years ago

@aspina7 there is no need to pull it apart and put it back together. The OR calculations are relegated to .calculate_unstrat_or() and .calculate_cmh_or(). You just need to update these small helper functions to return the correct OR.

aspina7 commented 3 years ago

yep seen those thanks - but the issue starts higher up as there should only be one stratifying variable and multiple exposure variables (not the other way round as currently setup). So need to fix the initial tbl_crosstabs and then get my head around how to re-arrange the layout so that can display crude, stratified and mh ratios appropriately (and calculate using the right bits). see this page for the math

ddsjoberg commented 3 years ago

yep seen those thanks - but the issue starts higher up as there should only be one stratifying variable and multiple exposure variables (not the other way round as currently setup). So need to fix the initial tbl_crosstabs and then get my head around how to re-arrange the layout so that can display crude, stratified and mh ratios appropriately (and calculate using the right bits). see this page for the math

OK, I don't unserstand what you're going for. To me, this table looks exactly like the example you posted https://github.com/ddsjoberg/gtsummary/issues/679#issuecomment-748103953 (except one column of p-values is omitted). I hope you can get what you want.

ddsjoberg commented 3 years ago

hey hey @aspina7

this pull request has been open for quite some time now, and it appears on my GitHub list of things to do in that time. Feel free to re-purpose the code and merge if you'd like, but I am going to close the PR for now so it will no longer appear in my list.

aspina7 commented 3 years ago

hey @ddsjoberg - sorry yes fair please do. Just constantly treading water at the moment, hoping to sit down with this over summer, will prod you when got something if thats ok please? Thanks!

ddsjoberg commented 3 years ago

hey @ddsjoberg - sorry yes fair please do. Just constantly treading water at the moment, hoping to sit down with this over summer, will prod you when got something if thats ok please? Thanks!

of course, reach out when you're ready