fastFGEE

fastFGEE fits fast one-step functional generalized estimating equations (fGEE) for longitudinal functional outcomes. The package uses a refund::pffr() initial fit and then updates the coefficient estimate with a working correlation structure in the longitudinal and/or functional direction. See the vignette for examples.

Main features

Installation

From r-universe (recommended -- no compiler needed)

install.packages("fastFGEE", repos = c(
  gloewing = "https://gloewing.r-universe.dev",
  CRAN     = "https://cloud.r-project.org"
))

This installs a prebuilt binary on Windows and macOS, so no development tools are required.

CRAN version

install.packages("fastFGEE")

Development version from source

fastFGEE contains compiled C++ code, so installing from source requires a toolchain: Rtools on Windows, Xcode Command Line Tools on macOS (xcode-select --install), or build-essential on Linux.

remotes::install_github("gloewing/fastFGEE")

Example

library(fastFGEE)
data("DTI", package = "refund")

set.seed(1)
ids <- sample(unique(DTI$ID), 10)
DTI_use <- subset(DTI, ID %in% ids)
DTI_use <- data.frame(
  cca = I(DTI_use$cca),
  case = DTI_use$case,
  visit = as.numeric(DTI_use$visit),
  sex = DTI_use$sex,
  ID = DTI_use$ID
)

fit <- fgee(
  formula = cca ~ case + visit,
  data = DTI_use,
  cluster = "ID",
  family = gaussian(),
  corr_fn = "independent",
  corr_long = "exchangeable"
)

fgee.plot(fit)

Development note

Portions of the package were developed with assistance from large language models. All code was reviewed and validated by the package author.