Skip to content

Commit 9865a09

Browse files
committed
Fix: TableSubgroupMultiCox p-value extraction for survey Cox models
- Fixed p-value column index issue in forestcox.R - Survey Cox models have 6 columns (including 'robust se'), regular Cox models have 5 - Now using ncol(coef_matrix) to get the last column (always p-value) instead of hardcoded index 5 - Resolves issue where p-values > 1 were returned for survey Cox models with 3+ category variables - Version bump to 1.3.18
1 parent da40e01 commit 9865a09

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
inst/doc
1+
/docs
22
.Rproj.user
33
.Rhistory
44
.RData

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: jstable
22
Title: Create Tables from Different Types of Regression
3-
Version: 1.3.17
4-
Date: 2025-08-29
3+
Version: 1.3.18
4+
Date: 2025-09-07
55
Authors@R: c(person("Jinseob", "Kim", email = "jinseob2kim@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9403-605X")),
66
person("Zarathu", role = c("cph", "fnd")),
77
person("Yoonkyoung","Jeon", role = c("aut")),

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# jstable 1.3.18
2+
* Fix: `TableSubgroupMultiCox` now correctly extracts p-values from survey Cox models (svycoxph) by using the last column index instead of hardcoded column 5
3+
14
# jstable 1.3.17
25
* Fix: `cox2.display` now properly handles variables with no variation in complete cases during univariate analysis
36
* Fix: `cox2.display` correctly filters out NA p-values when using `pcut.univariate` option

R/forestcox.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,9 @@ TableSubgroupCox <- function(formula, var_subgroup = NULL, var_cov = NULL, data,
490490
lapply(function(x) {
491491
tryCatch(
492492
{
493-
round(summary(x)$coefficients[1:ncoef, 5], decimal.pvalue)
493+
# P-value is always in the last column
494+
coef_matrix <- summary(x)$coefficients
495+
round(coef_matrix[1:ncoef, ncol(coef_matrix)], decimal.pvalue)
494496
},
495497
error = function(e) {
496498
return(rep(NA, length(xlev[[1]]) - 1))

0 commit comments

Comments
 (0)