tabgee {tab}R Documentation

Create Summary Table for Fitted Generalized Estimating Equation Model

Description

Creates a table summarizing a GEE fit using the gee function.

Usage

tabgee(
  fit,
  data = NULL,
  columns = NULL,
  robust = TRUE,
  var.labels = NULL,
  factor.compression = 1,
  sep.char = ", ",
  decimals = 2,
  formatp.list = NULL
)

Arguments

fit

Fitted gee object.

data

Data frame that served as 'data' in function call to gee. Only needs to be specified if one or more of the predictors is a factor and factor.compression is 1, 2, 3, or 4.

columns

Character vector specifying what columns to include. Choices for each element are "beta", "se", "betaci" for 95% CI for Beta, "beta.se" for Beta (SE), "beta.ci" for Beta (95% CI), "or", "orci" for 95% CI for OR, "or.ci" for OR (95% CI), "hr", "hrci" for 95% CI for HR, "hr.ci" for HR (95% CI), "z" for z statistic, and "p". If OR's or HR's are requested, the function will trust that exponentiated betas correspond to these quantities.

robust

Logical value for whether to use robust standard errors.

var.labels

Named list specifying labels to use for certain predictors. For example, if fit includes a predictor named "race" that you want to label "Race/ethnicity" and a predictor named "age_yrs" that you want to label "Age (years)", use var.labels = list(race = "Race/ethnicity", age_yrs = "Age (years)".

factor.compression

Integer value from 1 to 5 controlling how much compression is applied to factor predictors (higher value = more compression). If 1, rows are Variable, Level 1 (ref), Level 2, ...; if 2, rows are Variable (ref = Level 1), Level 2, ...; if 3, rows are Level 1 (ref), Level 2, ...; if 4, rows are Level 2 (ref = Level 1), ...; if 5, rows are Level 2, ...

sep.char

Character string with separator to place between lower and upper bound of confidence intervals. Typically "-" or ", ".

decimals

Numeric value specifying number of decimal places for numbers other than p-values.

formatp.list

List of arguments to pass to formatp.

Value

kable.

Examples

# Load in sample dataset and convert to long format
tabdata2 <- reshape(data = tabdata,
                    varying = c("bp.1", "bp.2", "bp.3", "highbp.1",
                                "highbp.2", "highbp.3"),
                    timevar = "bp.visit", direction = "long")
tabdata2 <- tabdata2[order(tabdata2$id), ]

# Blood pressure at 1, 2, and 3 months vs. age, sex, race, and treatment
library("gee")
fit <- gee(bp ~ Age + Sex + Race + Group, id = id, data = tabdata2,
           corstr = "unstructured")
tabgee(fit)

# Can also use piping
fit %>% tabgee(data = tabdata2)

# Same as previous, but with custom labels for Age and Race and factors
# displayed in slightly more compressed format
fit %>%
  tabgee(
    data = tabdata2,
    var.labels = list(Age = "Age (years)", Race = "Race/ethnicity"),
    factor.compression = 2
  )

# GEE with some higher-order terms
# higher-order terms
fit <- gee(
  highbp ~ poly(Age, 2, raw = TRUE) + Sex + Race + Group + Race*Group,
  id = id,
  data = tabdata2,
  family = "binomial",
  corstr = "unstructured"
)
fit %>% tabgee(data = tabdata2)



[Package tab version 5.1.1 Index]