rqlm: Modified Poisson and Least-Squares Regression Analyses for...

View source: R/rqlm.r

rqlmR Documentation

Modified Poisson and Least-Squares Regression Analyses for Binary Outcomes

Description

Performs modified Poisson or modified least-squares regression for a binary outcome. The function is used in a manner similar to lm or glm. The regression family determines the fitted mean model, and setting eform = TRUE exponentiates the coefficient estimates and confidence limits. The Morel–Bokossa–Neerchal-type small-sample corrected estimator is used by default.

Usage

rqlm(formula, data, family = poisson, eform = FALSE, cl = 0.95,
     digits = 4, var.method = "MBN")

Arguments

formula

An object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted.

data

A data frame, list, or environment (or an object coercible by as.data.frame) containing the variables in the model.

family

A description of the error distribution and link function to be used in the model. Specify gaussian for modified least-squares regression or poisson for modified Poisson regression.

eform

A logical value indicating whether the coefficient estimates and confidence limits should be exponentiated (default: FALSE).

cl

Confidence level used to calculate confidence intervals (default: 0.95).

digits

Number of decimal places displayed in the printed output (default: 4).

var.method

Method used to estimate the covariance matrix and standard errors. Available options are:

  • "standard": the standard heteroskedasticity-robust sandwich covariance estimator;

  • "MBN": the Morel–Bokossa–Neerchal-type corrected estimator;

  • "GST": the Gosho–Sato–Takeuchi-type corrected estimator;

  • "WL": the Wang–Long-type corrected estimator;

  • "HAD": the Hadamard finite-sample unbiased covariance estimator;

  • "HAD0": the Hadamard estimator with negative observation-level variance estimates truncated at zero;

  • "HAD025": the Hadamard estimator with observation-level variance estimates truncated to the interval [0, 1/4].

The "HAD", "HAD0", and "HAD025" options are available only with a Gaussian family and identity link. The default is "MBN".

Details

The Hadamard methods are implemented for modified least-squares regression fitted using a Gaussian family with an identity link.

Let X denote the model matrix, H = X(X^\top X)^{-1}X^\top the hat matrix, and M = I - H the residual-maker matrix. If r is the vector of least-squares residuals, the "HAD" option estimates the observation-specific error variances by

\widehat{\boldsymbol{\sigma}}^2 = (M \mathbin{\circ} M)^{-1}(r \mathbin{\circ} r),

where \mathbin{\circ} denotes the elementwise Hadamard product. The covariance matrix is then estimated as

(X^\top X)^{-1} X^\top \mathrm{diag}(\widehat{\boldsymbol{\sigma}}^2)X (X^\top X)^{-1}.

Under independent observations, a correctly specified linear conditional-mean model, and invertibility of M \mathbin{\circ} M, this covariance estimator is conditionally finite-sample unbiased.

Unbiased observation-level variance estimates can be negative in a particular sample. The "HAD0" option replaces negative values by zero. For a Bernoulli outcome, whose conditional variance cannot exceed 1/4, "HAD025" truncates the estimates to [0, 1/4]. These truncations can improve numerical stability but do not preserve exact finite-sample unbiasedness.

The matrix M \mathbin{\circ} M is an n \times n matrix. Consequently, the Hadamard methods can require substantial memory and computation for large datasets. An error is returned if this matrix is singular or numerically non-invertible, and a warning is returned when it is severely ill-conditioned.

Value

An object of class "rqlm", containing the following components:

call

The matched function call.

formula

The model formula.

coefficients

Coefficient estimates on the model scale.

se

Estimated robust standard errors.

cl

Lower confidence limits on the model scale.

cu

Upper confidence limits on the model scale.

z

Wald z statistics.

p

Two-sided Wald P-values.

eform

The value supplied to eform.

cl.level

The confidence level.

digits

The number of displayed decimal places.

var.method

The selected covariance estimator.

vcov

The estimated covariance matrix.

model

The fitted glm object.

n

The number of observations in the analysis sample after missing-value handling.

vhat.had

For a Hadamard method, the observation-level variance estimates after any requested truncation; otherwise NULL.

vhat.had.raw

For a Hadamard method, the untruncated observation-level variance estimates; otherwise NULL.

kappa.had

For a Hadamard method, the estimated condition number of the Hadamard-squared residual-maker matrix; otherwise NULL.

n.neg.had

For a Hadamard method, the number of negative untruncated observation-level variance estimates.

n.above025.had

For a Hadamard method, the number of untruncated observation-level variance estimates exceeding 1/4.

min.vhat.had, max.vhat.had

The minimum and maximum of the untruncated observation-level variance estimates.

References

Cheung, Y. B. (2007). A modified least-squares regression approach to the estimation of risk difference. American Journal of Epidemiology 166, 1337–1344.

Gosho, M., Ishii, R., Noma, H., and Maruo, K. (2023). A comparison of bias-adjusted generalized estimating equations for sparse binary data in small-sample longitudinal studies. Statistics in Medicine 42, 2711–2727.

Gosho, M., Sato, Y., and Takeuchi, H. (2014). Robust covariance estimator for small-sample adjustment in the generalized estimating equations: a simulation study. Science Journal of Applied Mathematics and Statistics 2, 20–25.

Morel, J. G., Bokossa, M., and Neerchal, N. (2003). Small sample correction for the variance of GEE estimators. Biometrical Journal 45, 395–409.

Noma, H. and Gosho, M. (2025). Finite-sample improved confidence intervals based on the estimating equation theory for the modified Poisson and least-squares regressions. Epidemiologic Methods 14, 20240030.

Noma, H. and Kitano, T. (2026). Finite-sample unbiased covariance estimation for modified least-squares regression with binary outcomes. In Preparation.

Noma, H., Sunada, H., and Gosho, M. (2025). Quasi-likelihood ratio tests and the Bartlett-type correction for improved inferences of the modified Poisson and least-squares regressions for binary outcomes. Statistica Neerlandica 79, e70012.

Wang, M. and Long, Q. (2011). Modified robust variance estimator for generalized estimating equations with improved small-sample performance. Statistics in Medicine 30, 1278–1291.

White, H. (1982). Maximum likelihood estimation of misspecified models. Econometrica 50, 1–25.

Zou, G. (2004). A modified Poisson regression approach to prospective studies with binary data. American Journal of Epidemiology 159, 702–706.

Examples

data(exdata02)

rqlm(
  y ~ x1 + x2 + x3 + x4,
  data = exdata02,
  family = poisson,
  eform = TRUE
)
# Modified Poisson regression analysis.
# Coefficients and confidence limits are displayed as risk ratios.
# The MBN robust covariance estimator is used by default.

rqlm(
  y ~ x1 + x2 + x3 + x4,
  data = exdata02,
  family = gaussian
)
# Modified least-squares regression analysis.
# Coefficients are risk differences.

rqlm(
  y ~ x1 + x2 + x3 + x4,
  data = exdata02,
  family = gaussian,
  var.method = "HAD"
)
# Modified least-squares regression with the finite-sample unbiased
# Hadamard covariance estimator.

rqlm(
  y ~ x1 + x2 + x3 + x4,
  data = exdata02,
  family = gaussian,
  var.method = "HAD0"
)
# Negative observation-level variance estimates are truncated at zero.

rqlm(
  y ~ x1 + x2 + x3 + x4,
  data = exdata02,
  family = gaussian,
  var.method = "HAD025"
)
# Observation-level variance estimates are truncated to [0, 1/4].

rqlm(
  y ~ x1 + x2 + x3 + x4,
  data = exdata02,
  family = poisson,
  eform = TRUE,
  var.method = "GST"
)

rqlm(
  y ~ x1 + x2 + x3 + x4,
  data = exdata02,
  family = poisson,
  eform = TRUE,
  var.method = "WL"
)

rqlm documentation built on July 13, 2026, 9:07 a.m.