The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Competing risk analysis

Jinseob Kim

2025-03-05

Display results of comepting risk analysis using jstable(Fine-Gray Method)

TableSubgroupMultiCox

When using the TableSubgroupMultiCox function, preprocessing the data with the finegray function from the survival package is required. The finegray function generates a new dataset containing fgstart, fgstop, fgstatus, and fgwt. The TableSubgroupMultiCox function then displays results based on the corresponding formula and weights.

data <- mgus2
data$etime <- with(data, ifelse(pstat == 0, futime, ptime))
data$event <- with(data, ifelse(pstat == 0, 2 * death, 1))
data$event <- factor(data$event, 0:2, labels = c("censor", "pcm", "death"))
data$age65 <- with(data, ifelse(age > 65, 1, 0))
data$age65 <- factor(data$age65)
pdata <- survival::finegray(survival::Surv(etime, event) ~ ., data = data)
TableSubgroupMultiCox(formula = Surv(fgstart, fgstop, fgstatus) ~ sex, data = pdata, var_cov = "age", weights = "fgwt", var_subgroups = c("age65"))
#>     Variable Count Percent Point Estimate Lower Upper sex=F sex=M P value
#> sex  Overall 41775     100           0.77  0.54   1.1  10.4   8.1   0.153
#> 1      age65  <NA>    <NA>           <NA>  <NA>  <NA>  <NA>  <NA>    <NA>
#> 2          0  7572    18.1           0.71   0.4  1.27  17.2  10.5   0.252
#> 3          1 34203    81.9            0.8  0.51  1.25   8.7   7.3    0.33
#>     P for interaction
#> sex              <NA>
#> 1               0.673
#> 2                <NA>
#> 3                <NA>

cox2.display

As written above, preprocessing the data with finegray function is also required. By using corresponding formula and weights, cox2.display function will display table results.

fgfit <- coxph(Surv(fgstart, fgstop, fgstatus) ~ age + sex,
  weight = fgwt, data = pdata, model = T
)
cox2.display(fgfit)
#> $table
#>             crude HR(95%CI)    crude P value adj. HR(95%CI)     adj. P value
#> age         "0.98 (0.97,0.99)" "0.003"       "0.98 (0.97,0.99)" "0.002"     
#> sex: M vs F "0.8 (0.56,1.13)"  "0.207"       "0.77 (0.54,1.1)"  "0.153"     
#> 
#> $metric
#>                     [,1]               [,2] [,3] [,4]
#> <NA>                NA                 NA   NA   NA  
#> No. of observations "41775"            NA   NA   NA  
#> No. of events       "115"              NA   NA   NA  
#> AIC                 "1583.87165275874" NA   NA   NA  
#> C-Index             "0.548(0.026)"     NA   NA   NA  
#> 
#> $caption
#> [1] "Cox model on time ('fgstart, fgstop') to event ('fgstatus')"

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.