-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feature Request: More customization with ard_hierarchical() #375
Comments
Hi @daniel-woodie ! Thanks for the post! Instead of only showing the structure of the output you're after, could you also provide a description of the summary you are trying to calculate? Also, you can use the prepared ADaM data sets in the pharmaverseadam R package to create examples (https://pharmaverse.github.io/pharmaverseadam/). My suspicion is that you may want to use |
I was actually able to create the output by breaking down the dataset into smaller chunks and using a combination of ard_dichotomous and ard_categorical_ci. I'm not sure how useful it is but here's a variation on what I did using some dummy CDISC data (adapted from an example in the TLG gallery).
Hoping it's not too confusing because it's a variation on working with real data but with a toy example + reduced to be concise. However kludgy it looks, it did the trick haha. From here it was largely an exercise in formatting. Few questions I came across when working on this exercise.
Anyway, thanks for making such an awesome package and for being responsive in the issues! |
I think of
We are working on putting together more documentation and examples. We'll get there!
Sure we can add that! |
Gotcha. Thanks! Yes and happy to contribute back if it's helpful and doesn't get in the way. Regarding the set of functions I ultimately landed on, here's a few reasons why:
|
Regarding the big Ns: ARDs are meant to be results only and are divorced from how the results are displayed downstream. While you can rename the columns, the ARD that results from We've considered adding |
Thanks about adding
It's not a big deal to rename the columns. My first thought, however, was that I should be able to specify the |
While you are playing around with the functions, I would recommend trying first to use the results as they come. That is, when you need the Ns for the treatment groups, tabulate the TRT01P and use the result as it is. I think that will serve you better in the long run. Also this structure is great for QC across many tables and figures: no matter how the TRT01P counts are reported in the table (e.g. across the header, longwise in the body of a table) the ARD that has TRT01P always looks exactly the same, which makes it easy to check for consistency in the counts across all tables/figures in a CSR. I can see what you're saying about the names after you stack the ARDs. Also consider that ARDs don't need to be stacked. In some cases, that makes perfect sense. And perhaps in your case, there is no need to stack the TRT01P counts with the other stratified statistics, if it's easier to digest the results when not stacked. |
If stacking my ARDs makes me wrong then I don't think I want to be right. Joking. Thanks for all the help! Loving all the progress with {cards}/{cardx}. I'll keep playing around with it. |
Ha! I love stacking too! But there are situations (particularly in cardx) where stacking probably won't be a good option for us. More to come on that point in the future! |
ard_hierarchical custom numerators + additional statistics
I'm trying to replicate a scenario with ard_hierarchical and am struggling. I have a suspicion it's possible but it's hard gaining intuition about how this function works and how to customize the statistics being calculated.
For example, I'd like my output ards to be something like:
| group1_level | group2_level | group3_level | stat_name | stat |
| TRTA | Subgroup A | Visit 1 | n | 3 |
| TRTA | Subgroup A | Visit 1 | N | 10 |
| TRTA | Subgroup A | Visit 1 | p | .3 |
| TRTA | Subgroup A | Visit 2 | n | 6 |
| TRTA | Subgroup A | Visit 2 | N | 11 |
| TRTA | Subgroup A | Visit 2 | p | .545 |
In theory, I'd like something like:
`
ard_hierarchical(
data = my_adam,
by = trt,
variables = c(subgroup, visit, some_binary_outcome),
denominator = my_adam |> group_by(trt, subgroup, visit) |> summarise(some_binary_outcome = n())
`
Sorry it's not minimally reproducible but hopefully that makes sense. Any thoughts appreciated. Additionally, if you have any other guidance on how to use the statistic parameter to calculate custom statistics, that'd be awesome. I checked out the tidyselect stuff in the documentation but didn't get a whole lot from that.
The text was updated successfully, but these errors were encountered: