https://github.com/insightsengineering/tern.gee
Create TLGs using Generalized Estimating Equations (GEE)
https://github.com/insightsengineering/tern.gee
Last synced: 3 months ago
JSON representation
Create TLGs using Generalized Estimating Equations (GEE)
- Host: GitHub
- URL: https://github.com/insightsengineering/tern.gee
- Owner: insightsengineering
- Created: 2022-08-17T14:32:31.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-12-29T07:05:51.000Z (5 months ago)
- Last Synced: 2026-01-01T03:28:10.837Z (5 months ago)
- Language: R
- Homepage: https://insightsengineering.github.io/tern.gee/
- Size: 10.2 MB
- Stars: 8
- Watchers: 8
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- Contributing: .github/CONTRIBUTING.md
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# tern.gee
[](https://insightsengineering.github.io/tern.gee/main/unit-test-report/)
[](https://insightsengineering.github.io/tern.gee/)
[](https://github.com/insightsengineering/tern.gee/releases)
[](https://insightsengineering.github.io/tern.gee/main/coverage-report/)








[](https://www.repostatus.org/#active)
[](https://github.com/insightsengineering/tern.gee/tree/main)
[](https://github.com/insightsengineering/tern.gee/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)
## Overview
`tern.gee` provides an interface for generalized estimating equations (GEE) within the [`tern`](https://insightsengineering.github.io/tern/) framework to produce commonly used tables (using [`rtables`](https://insightsengineering.github.io/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`](https://insightsengineering.github.io/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:
``` r
install.packages("tern.gee")
```
or you can install the latest development version directly from GitHub by running the following:
``` r
# install.packages("pak")
pak::pak("insightsengineering/tern.gee")
```
## Getting started
You can get started by trying out the example:
```r
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](https://insightsengineering.github.io/tern.gee/main/articles/tern-gee.html).
## Stargazers
### Current
[](https://github.com/insightsengineering/tern.gee/stargazers)
[](https://github.com/insightsengineering/tern.gee/network/members)
### Over time
[](https://starchart.cc/insightsengineering/tern.gee)