insightsengineering / insightsengineering/crane
Fragile lookup of conf_int_row in `get_cox_pairwise_df()`
Open
- Dominant language
- R
- Stars
- 15
- Forks
- 7
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 5
Description
conf_int_row lookup is fragile
`conf_int_row <- paste0(arm, current_arm)`
This constructs "armB" to index into `coxph_ans$conf.int`. But arm is the column name string (e.g., "arm"), not the variable name in the model. If the user's column is named `"TRT01A"`, the row name would be `"TRT01AXanomeline High Dose"`. This works, but only because coxph names coefficients as . If the formula has covariates (e.g.,` Surv(time, status) ~ arm + age`), the `conf.int` matrix has multiple rows and the indexing still works because it's by row name. This is fine but worth a comment.
Contributor guide
Assessment
This issue has not been assessed yet.