insightsengineering / insightsengineering/tern.mmrm
[Feature Request]: `h_mmrm_fixed()` to include 95% CI by default
- Dominant language
- R
- Stars
- 7
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
### Feature description
Wondering why the confidence intervals for the coefficients are not considered in the implementation of `as.rtable(type = "fixed")`?
```R
library(tern.mmrm)
# Test model
mmrm_results <- fit_mmrm(
vars = list(
response = "FEV1",
covariates = c("RACE", "SEX"),
id = "USUBJID",
arm = "ARMCD",
visit = "AVISIT"
),
data = mmrm_test_data,
cor_struct = "unstructured",
weights_emmeans = "equal"
)
# 95% CI is not here :(
tbl_fixed <- mmrm_results %>%
as.rtable(type = "fixed", format = "xx.xxxx")
# Obtain confidence intervals manually
tbl_ci <- mmrm_results$fit %>%
stats::confint(level = 0.95) %>%
as.data.frame() %>%
as.rtable(format = "xx.xxxx")
# Bind tables together
cbind_rtables(tbl_fixed, tbl_ci)
```
```
Estimate Std. Error t value df Pr(>|t|) 2.5 % 97.5 %
————————————————————————————————————————————————————————————————————————————————————————————————————
(Intercept) 30.7775 0.8866 34.7154 219 <0.0001 29.0302 32.5248
RACEBlack or African American 1.5305 0.6245 2.4509 169 0.0153 0.2977 2.7633
RACEWhite 5.6436 0.6656 8.4788 157 <0.0001 4.3289 6.9583
SEXFemale 0.3261 0.5320 0.6130 166 0.5407 -0.7242 1.3763
ARMCDTRT 3.7742 1.0741 3.5137 146 0.0006 1.6513 5.8972
AVISITVIS2 4.8396 0.8017 6.0365 144 <0.0001 3.2549 6.4243
AVISITVIS3 10.3421 0.8227 12.5710 156 <0.0001 8.7170 11.9672
AVISITVIS4 15.0539 1.3128 11.4669 138 <0.0001 12.4581 17.6497
ARMCDTRT:AVISITVIS2 -0.0419 1.1293 -0.0371 139 0.9704 -2.2749 2.1910
ARMCDTRT:AVISITVIS3 -0.6937 1.1876 -0.5841 158 0.5600 -3.0394 1.6520
ARMCDTRT:AVISITVIS4 0.6242 1.8509 0.3373 130 0.7365 -3.0375 4.2860
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct.
### Contribution Guidelines
- [x] I agree to follow this project's Contribution Guidelines.
### Security Policy
- [x] I agree to follow this project's Security Policy.
Contributor guide
Assessment
This issue has not been assessed yet.