
Generalized estimating equations with a robust covariance
Source:R/gee_regression.R
morie_gee_regression.RdLiang & Zeger (1986): solve sum_i D_i' V_i^-1 (y_i - mu_i) = 0 with V_i = phi A_i^1/2 R_i(alpha) A_i^1/2, alternating a Fisher-scoring step in beta with moment estimates from the Pearson residuals e: phi = sum e^2 / N; for "exchangeable" alpha = sum_i sum_(j<k) e_ij e_ik / (phi sum_i n_i (n_i - 1) / 2); for "ar1" the least-squares fit of e_ij e_ik / phi on alpha^|j - k| over all within-cluster pairs (Prentice 1988), as geepack's geeglm computes them. Rows within a cluster are taken in input order. The covariance is the sandwich B^-1 M B^-1. The fit starts from the independence GLM.
Usage
morie_gee_regression(
y,
X,
clusters,
family = "gaussian",
corr_structure = "exchangeable",
add_intercept = TRUE,
max_iter = 50L,
tol = 1e-06
)Arguments
- y
Response vector.
- X
Covariate matrix (or vector).
- clusters
Cluster identifier of each row.
- family
"gaussian", "binomial" (logit) or "poisson" (log).
- corr_structure
"independence", "exchangeable" or "ar1".
- add_intercept
Prepend an intercept column.
- max_iter
Maximum scoring iterations.
- tol
Convergence tolerance on the scoring step.
Value
Named list: coefficients, se, p_values, alpha, scale, n_clusters, iterations, fitted, residuals.