Skip to content

insightsengineering/tern.gee

Repository files navigation

tern.gee

Check 🛠 Docs 📚 Release 🎈 Code Coverage 📔

GitHub forks GitHub Repo stars

GitHub commit activity GitHub contributors GitHub last commit GitHub pull requests GitHub repo size GitHub language count Project Status: Active – The project has reached a stable, usable state and is being actively developed. Current Version Open Issues

Overview

tern.gee provides an interface for generalized estimating equations (GEE) within the tern framework to produce commonly used tables (using rtables and graphs. It builds on the R-package geepack for the actual GEE calculations.

When to use this package

If you would like to use the tern framework for tabulation and graphs, then this package is ideal for your GEE fits. However if you use another reporting framework then it will be better to directly use geepack and perform the tabulation and plots differently.

Main Features

  • Fitting of GEE models to continuous longitudinal data collected over several time points (called visits) and optionally treatment arms.
  • Tabulation of least square means per visit and treatment arm.
  • Tabulation of the covariance matrix estimate.

Installation

tern.gee is available on CRAN and you can install the latest released version with:

install.packages("tern.gee")

or you can install the latest development version directly from GitHub by running the following:

# install.packages("pak")
pak::pak("insightsengineering/tern.gee")

Getting started

You can get started by trying out the example:

library(tern.gee)

fev_data$FEV1_BINARY <- as.integer(fev_data$FEV1 > 30)
fev_counts <- fev_data %>%
  dplyr::select(USUBJID, ARMCD) %>%
  unique()

gee_fit <- fit_gee(
  vars = list(
    response = "FEV1_BINARY",
    covariates = c("RACE", "SEX"),
    arm = "ARMCD",
    id = "USUBJID",
    visit = "AVISIT"
  ),
  data = fev_data
)

lsmeans_df <- lsmeans(gee_fit, data = fev_data)

basic_table(show_colcounts = TRUE) %>%
  split_cols_by("ARMCD", ref_group = "PBO") %>%
  summarize_gee_logistic() %>%
  build_table(lsmeans_df, alt_counts_df = fev_counts)

This specifies a GEE with the FEV1_BINARY outcome and the RACE and SEX covariates for subjects identified by USUBJID and treatment arm ARMCD observed over time points identified by AVISIT in the fev_data data set. By default, logistic regression is used and an unstructured covariance matrix is assumed. The least square means assume equal weights for factor combinations.

For more information on how GEE models and their rtables tables are created see the introduction vignette.

Stargazers

Current

Stargazers repo roster for @insightsengineering/tern.gee Forkers repo roster for @insightsengineering/tern.gee

Over time

Stargazers over time