The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Type: Package
Title: Model-Robust Standardization for Longitudinal Cluster-Randomized Trials
Version: 0.1.0
Description: Provides estimation and leave-one-cluster-out jackknife standard errors for four longitudinal cluster-randomized trial estimands: horizontal individual average treatment effect (h-iATE), horizontal cluster average treatment effect (h-cATE), vertical individual average treatment effect (v-iATE), and vertical cluster-period average treatment effect (v-cATE), using unadjusted and augmented (model-robust standardization) estimators. The working model may be fit using linear mixed models for continuous outcomes or generalized estimating equations and generalized linear mixed models for binary outcomes. Period inclusion for aggregation is determined automatically: only periods with both treated and control clusters are included in the construction of the marginal means and treatment effect contrasts. See Fang et al. (2025) <doi:10.48550/arXiv.2507.17190>.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Depends: R (≥ 4.1.0)
Imports: reformulas, dplyr (≥ 1.1.0), tidyr (≥ 1.3.0), rlang (≥ 1.1.0), tidyselect, gee, lme4 (≥ 1.1-30), ggplot2 (≥ 3.4.0), stats, utils
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
RoxygenNote: 7.3.3
NeedsCompilation: no
Packaged: 2026-01-10 14:19:07 UTC; fancy
Author: Xi Fang [aut, cre], Fan Li [aut]
Maintainer: Xi Fang <x.fang@yale.edu>
Repository: CRAN
Date/Publication: 2026-01-15 17:50:06 UTC

Fit model-robust standardization for longitudinal CRTs

Description

Fit model-robust standardization for longitudinal CRTs

Usage

mrstdlcrt_fit(
  data,
  formula,
  cluster_id = "cluster",
  period = "period",
  trt = "trt",
  method = c("gee", "lmer", "glmer"),
  family = c("gaussian", "binomial"),
  corstr = "independence",
  scale = c("RD", "RR", "OR")
)

Arguments

data

data.frame with outcome, treatment, period, cluster, covariates.

formula

model formula; may include interactions and random effects.

cluster_id

cluster id column name.

period

period column name.

trt

treatment column name (0/1).

method

"gee","lmer","glmer".

family

"gaussian","binomial".

corstr

gee correlation.

scale

For binomial: "RD","RR","OR" (RR/OR are on log scale).

Value

Object of class "mrs".


Plot method for mrs objects

Description

Plot method for mrs objects

Usage

## S3 method for class 'mrs'
plot(x, level = 0.95, estimand = NULL, point_size = 2.8, ...)

Arguments

x

An object of class "mrs".

level

Confidence level.

estimand

Subset of estimands to plot.

point_size

Point size.

...

Unused.

Value

ggplot object invisibly.


Print method for mrs objects

Description

Print method for mrs objects

Usage

## S3 method for class 'mrs'
print(x, ...)

Arguments

x

An object of class "mrs".

...

Unused.

Value

x invisibly.


Summarize an mrs fit

Description

Summarize an mrs fit

Usage

## S3 method for class 'mrs'
summary(
  object,
  level = 0.95,
  estimand = NULL,
  digits = 6,
  show_counts = TRUE,
  ...
)

Arguments

object

An object of class "mrs".

level

Confidence level.

estimand

Optional subset of estimands.

digits

Digits to print.

show_counts

Print counts tables.

...

Unused.

Value

Invisibly returns a list of printed tables and metadata.


Example stepped wedge CRT dataset with binary outcome

Description

A toy dataset with cluster, period, and individual records for illustrating estimands in stepped wedge CRT with a binary outcome.

Usage

data(sw_b)

Format

A data frame with columns:

cluster

Cluster identifier (integer).

period

Period index (integer).

id

Individual identifier within cluster-period (integer).

trt

Treatment indicator (0/1).

x1

Auxiliary covariate (0/1).

x2

Auxiliary covariate (numeric).

y

Outcome (0/1, binary).

Examples

data(sw_b)
head(sw_b)

Example of stepped wedge CRT dataset for continuous outcome

Description

A toy dataset with cluster, period, and individual records for illustrating estimands in stepped wedge CRT with a continuous outcome.

Usage

data(sw_c)

Format

A data frame with columns:

cluster

Cluster identifier (integer).

period

Period index (integer).

id

Individual identifier within cluster-period (integer).

trt

Treatment indicator (0/1).

x1

Auxiliary covariate (0/1).

x2

Auxiliary covariate (numeric).

y

Outcome (numeric, continuous).

Examples

data(sw_c)
head(sw_c)

Example crossover cluster-randomized trial dataset with binary outcome

Description

A small simulated 2×2 crossover trial dataset with a binary outcome.

Usage

xo_b

Format

A tibble/data.frame with one row per subject and the following columns:

h

Integer cluster ID (hospital)

p

Integer period (1 or 2)

k

Integer subject index within cluster-period

trt

Treatment indicator (0 = control, 1 = treatment)

x_c01, x_c02

Continuous covariates

x_b01

Binary covariate (0/1)

x_cat1_2, x_cat1_3

Dummy variables for a 3-level categorical covariate (level 1 is reference)

y_bin

Observed binary outcome (0/1)

Examples

data(xo_b)
str(xo_b)
head(xo_b)

Example crossover cluster-randomized trial dataset with continuous outcome

Description

A small simulated 2×2 crossover trial dataset with a continuous outcome.

Usage

xo_c

Format

A tibble/data.frame with one row per subject and the following columns:

h

Integer cluster ID (hospital)

p

Integer period (1 or 2)

k

Integer subject index within cluster-period

trt

Treatment indicator (0 = control, 1 = treatment)

x_c01, x_c02

Continuous covariates

x_b01

Binary covariate (0/1)

x_cat1_2, x_cat1_3

Dummy variables for a 3-level categorical covariate (level 1 is reference)

y_cont

Observed continuous outcome

Examples

data(xo_c)
str(xo_c)
head(xo_c)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.