robin_glm: Covariate adjusted glm model

View source: R/robin_glm.R

robin_glmR Documentation

Covariate adjusted glm model

Description

Covariate adjusted glm model

Usage

robin_glm(
  formula,
  data,
  treatment,
  contrast = "difference",
  contrast_jac = NULL,
  vcov = "vcovG",
  family = gaussian(),
  vcov_args = list(),
  pair,
  ...
)

Arguments

formula

(formula) A formula of analysis.

data

(data.frame) Input data frame.

treatment

(formula or character(1)) A formula of treatment assignment or assignment by stratification, or a string name of treatment assignment.

contrast

(function or character(1)) A function to calculate the treatment effect, or character of "difference", "risk_ratio", "odds_ratio" for default contrasts.

contrast_jac

(function) A function to calculate the Jacobian of the contrast function. Ignored if using default contrasts.

vcov

(function) A function to calculate the variance-covariance matrix of the treatment effect, including vcovHC and vcovG.

family

(family) A family object of the glm model.

vcov_args

(list) Additional arguments passed to vcov.

pair

Pairwise treatment comparison.

...

Additional arguments passed to glm or glm.nb.

Details

If family is MASS::negative.binomial(NA), the function will use MASS::glm.nb instead of glm.

Value

A treatment_effect object.

Examples

robin_glm(
  y ~ treatment * s1,
  data = dummy_data,
  treatment = treatment ~ s1, contrast = "difference"
)

RobinCar2 documentation built on April 3, 2025, 9:34 p.m.