insightsengineering / insightsengineering/tern.mmrm
Add Option/Function for Relative Change Calculation
- Dominant language
- R
- Stars
- 7
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Original issue (https://github.com/openpharma/mmrm/issues/187) from @changjosh92:
Hi openpharma team,
Thanks so much for your work to optimize statistical summary generation!
My request is to consider adding a relative change (increase/decrease) option to the package somehow.
Often times in clinical trials the question of how much better/worse did the intervention group perform relative to the control group can come up and it would be great to have this calculation operationalized in the package.
The difficulty in this calculation comes down to what defines better group performance for a given endpoint (e.g. higher magnitude is better/lower magnitude is better) and if the control group's model estimate demonstrated an increase or decrease in performance.
Below is a summary of prior work on how to best define and calculate the relative change between treatment groups (only 2 shown here):

Right now the calculation would be done in R, but by pulling out each of the model estimates in a simple if-then condition.
Ultimately, this is a nice-to-have, but I think optimizing it for the package could drive adoption of the package much faster. I'm happy to be a resource with some prior code I've developed for TEAL apps based on `nlme` model outputs. Thanks!
Contributor guide
Research direction
Start by reviewing the package's existing statistical summary generation and model-estimate entry points, then compare them with the prior TEAL and nlme-based code mentioned in the issue. Define the supported relative-change cases and how users would select them; done requires an agreed API and calculations covering the stated treatment and control scenarios.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- analytics, data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100