Sub-group analysis table for GLM.

TableSubgroupGLM(
  formula,
  var_subgroup = NULL,
  var_cov = NULL,
  data,
  family = "binomial",
  decimal.estimate = 2,
  decimal.percent = 1,
  decimal.pvalue = 3,
  labeldata = NULL
)

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.

family

family, "gaussian" or "binomial" or 'poisson' or 'quasipoisson'

decimal.estimate

Decimal for estimate, Default: 2

decimal.percent

Decimal for percent, Default: 1

decimal.pvalue

Decimal for pvalue, Default: 3

labeldata

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

Value

Sub-group analysis table.

Details

This result is used to make forestplot.

See also

Examples

library(survival) library(dplyr) lung %>% mutate( status = as.integer(status == 1), sex = factor(sex), kk = factor(as.integer(pat.karno >= 70)) ) -> lung TableSubgroupGLM(status ~ sex, data = lung, family = "binomial")
#> Variable Count Percent OR Lower Upper P value P for interaction #> sex2 Overall 228 100 3.01 1.65 5.47 <0.001 NA
TableSubgroupGLM(status ~ sex, var_subgroup = "kk", data = lung, family = "binomial")
#> Variable Count Percent OR Lower Upper P value P for interaction #> 1 kk <NA> <NA> <NA> <NA> <NA> NA 0.476 #> 2 0 38 16.9 7 0.7 70.03 0.098 <NA> #> 3 1 187 83.1 2.94 1.55 5.57 0.001 <NA>
## survey design library(survey) data.design <- svydesign(id = ~1, data = lung)
#> Warning: No weights or probabilities supplied, assuming equal probability
TableSubgroupGLM(status ~ sex, data = data.design, family = "binomial")
#> Variable Count Percent OR Lower Upper P value P for interaction #> sex2 Overall 228 100 3.01 1.65 5.48 <0.001 NA
TableSubgroupGLM(status ~ sex, var_subgroup = "kk", data = data.design, family = "binomial")
#> Variable Count Percent OR Lower Upper P value P for interaction #> 1 kk <NA> <NA> <NA> <NA> <NA> NA 0.478 #> 2 0 38 16.9 7 0.7 70.4 0.107 <NA> #> 3 1 187 83.1 2.94 1.55 5.58 0.001 <NA>