Learn R Programming

mfp2 (version 1.1.1)

gee_family: GEE Family Specification

Description

Use gee_family() with mfp2() to model outcomes measured more than once within independent groups, such as repeated measurements from the same person. Supply the group identifier through mfp2()'s id argument. If measurement order matters, supply waves.

Usage

gee_family(
  family = stats::gaussian(),
  corstr = c("exchangeable", "independence", "ar1"),
  std.err = c("san.se", "jack", "j1s", "fij"),
  reference_dispersion = NULL,
  qbic_penalty = c("clusters", "observations")
)

Value

A family specification to supply as the family argument of mfp2().

Arguments

family

Response family: a family object, function, or name for gaussian, binomial, poisson, or Gamma, with any link the family supports, for example binomial(link = "probit"). The default is stats::gaussian().

corstr

Assumed pattern of association between measurements in the same group: "exchangeable" (default), "independence", or "ar1".

std.err

Method for calculating standard errors: "san.se" (the default), "jack", "j1s", or "fij". "san.se" gives robust sandwich standard errors with the finite-cluster correction \(K/(K-1)\), where \(K\) is the number of clusters, as in Stata's xtgee; they are therefore slightly larger than those reported by geepack::geeglm(). The jackknife estimators are used unchanged.

reference_dispersion

Optional positive value that scales the quasi-likelihood part of GEE AIC and BIC scores. The score divides that part by this value; the penalty for model complexity is not divided by it. If NULL (the default), mfp2() estimates the value. It does not set the scale used for the final model's standard errors. It cannot be supplied with p-value selection.

qbic_penalty

For BIC selection, whether the complexity penalty uses the number of independent "clusters" (default) or the number of "observations". This setting does not affect AIC or p-value selection.

Details

All three selection criteria in mfp2() are available for GEE models. The default is criterion = "aic", which uses QICu. BIC selection uses a BIC-like score based on quasi-likelihood, and p-value selection uses approximate tests for GEE. Under AIC or BIC selection, select = 1 does not force a predictor into the model; use the keep argument of mfp2() instead.

References

Pan, W. (2001). Akaike's information criterion in generalized estimating equations. Biometrics, 57, 120--125.
Halekoh, U., Højsgaard, S. and Yan, J. (2006). The R package geepack for generalized estimating equations. Journal of Statistical Software, 15(2), 1--11.

See Also

mfp2(), geepack::geeglm()

Examples

Run this code
set.seed(1)
d <- data.frame(id = rep(1:40, each = 3), x = runif(120, 1, 5))
d$y <- log(d$x) + rnorm(40, sd = 0.5)[d$id] + rnorm(120, sd = 0.3)

# GEE models require geepack.
if (requireNamespace("geepack", quietly = TRUE)) {
  fit_gee <- mfp2(
    y ~ fp(x, df = 2),
    data = d,
    family = gee_family(gaussian(), corstr = "exchangeable"),
    id = d$id,
    verbose = FALSE
  )
  coef(fit_gee)
}

Run the code above in your browser using DataLab