Sub-group analysis table for Cox/svycox model.

TableSubgroupCox(
  formula,
  var_subgroup = NULL,
  var_cov = NULL,
  data,
  time_eventrate = 3 * 365,
  decimal.hr = 2,
  decimal.percent = 1,
  decimal.pvalue = 3
)

Arguments

formula

formula with survival analysis.

var_subgroup

1 sub-group variable for analysis, Default: NULL

var_cov

Variables for additional adjust, Default: NULL

data

Data or svydesign in survey package.

time_eventrate

Time for kaplan-meier based event rate calculation, Default = 365 * 3

decimal.hr

Decimal for hazard ratio, Default: 2

decimal.percent

Decimal for percent, Default: 1

decimal.pvalue

Decimal for pvalue, Default: 3

Value

Sub-group analysis table.

Details

This result is used to make forestplot.

See also

Examples

library(survival) library(dplyr)
#> #> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’: #> #> filter, lag
#> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union
lung %>% mutate( status = as.integer(status == 1), sex = factor(sex), kk = factor(as.integer(pat.karno >= 70)) ) -> lung TableSubgroupCox(Surv(time, status) ~ sex, data = lung, time_eventrate = 100)
#> Variable Count Percent Point Estimate Lower Upper sex=1 sex=2 P value #> sex2 Overall 228 100 1.91 1.14 3.2 0 1.2 0.014 #> P for interaction #> sex2 NA
TableSubgroupCox(Surv(time, status) ~ sex, var_subgroup = "kk", data = lung, time_eventrate = 100 )
#> Variable Count Percent Point Estimate Lower Upper sex=1 sex=2 P value #> 1 kk <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> #> 2 0 38 16.9 2.88 0.31 26.49 0 0 0.35 #> 3 1 187 83.1 1.84 1.08 3.14 0 1.5 0.026 #> P for interaction #> 1 0.525 #> 2 <NA> #> 3 <NA>
## survey design library(survey)
#> Loading required package: grid
#> Loading required package: Matrix
#> #> Attaching package: ‘survey’
#> The following object is masked from ‘package:graphics’: #> #> dotchart
data.design <- svydesign(id = ~1, data = lung)
#> Warning: No weights or probabilities supplied, assuming equal probability
TableSubgroupCox(Surv(time, status) ~ sex, data = data.design, time_eventrate = 100)
#> Independent Sampling design (with replacement) #> svydesign(id = ~1, data = lung)
#> Variable Count Percent Point Estimate Lower Upper sex=1 sex=2 P value #> sex2 Overall 228 100 1.91 1.14 3.19 0 1.2 0.013 #> P for interaction #> sex2 NA
TableSubgroupCox(Surv(time, status) ~ sex, var_subgroup = "kk", data = data.design, time_eventrate = 100 )
#> Independent Sampling design (with replacement) #> svydesign(id = ~1, data = lung)
#> New names:
#> Independent Sampling design (with replacement) #> subset(data, get(var_subgroup) == .) #> Independent Sampling design (with replacement) #> subset(data, get(var_subgroup) == .)
#> Variable Count Percent Point Estimate Lower Upper sex=1 sex=2 P value #> 1 kk <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> #> 2 0 38 16.9 2.88 0.31 27.1 0 0 0.355 #> 3 1 187 83.1 1.84 1.08 3.11 0 2.9 0.024 #> P for interaction #> 1 0.523 #> 2 <NA> #> 3 <NA>