Learn R Programming

jstable (version 1.3.8)

TableSubgroupCox: TableSubgroupCox: Sub-group analysis table for Cox/svycox model.

Description

Sub-group analysis table for Cox/svycox model.

Usage

TableSubgroupCox(
  formula,
  var_subgroup = NULL,
  var_cov = NULL,
  data,
  time_eventrate = 3 * 365,
  decimal.hr = 2,
  decimal.percent = 1,
  decimal.pvalue = 3,
  cluster = NULL,
  strata = NULL,
  weights = NULL,
  event = FALSE,
  count_by = NULL,
  labeldata = NULL
)

Value

Sub-group analysis table.

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

cluster

Cluster variable for coxph, Default: NULL

strata

Strata variable for coxph, Default: NULL

weights

Weights variable for coxph, Default: NULL

event

Show number and rates of event in survival analysis default:F

count_by

Select variables to count by subgroup, Default: NULL

labeldata

Label info, made by `mk.lev` function, Default: NULL

Details

This result is used to make forestplot.

See Also

Examples

Run this code
library(survival)
library(dplyr)
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)
TableSubgroupCox(Surv(time, status) ~ sex,
  var_subgroup = "kk", data = lung,
  time_eventrate = 100
)

## survey design
library(survey)
data.design <- svydesign(id = ~1, data = lung)
TableSubgroupCox(Surv(time, status) ~ sex, data = data.design, time_eventrate = 100)
TableSubgroupCox(Surv(time, status) ~ sex,
  var_subgroup = "kk", data = data.design,
  time_eventrate = 100
)

Run the code above in your browser using DataLab