[Paper Review] Model Diagnostics Based on Cumulative Residuals: The R-package gof
This paper introduces the R package gof, which provides objective, simulation-based diagnostics for generalized linear models (GLMs), structural equation models (SEMs), and Cox proportional hazards models using cumulative residuals. By leveraging asymptotic theory and resampling to assess linearity and proportional hazards assumptions, the method offers a statistically rigorous alternative to subjective residual plotting, with demonstrated utility in detecting model misspecification in real datasets.
The generalized linear model is widely used in all areas of applied statistics and while correct asymptotic inference can be achieved under misspecification of the distributional assumptions, a correctly specified mean structure is crucial to obtain interpretable results. Usually the linearity and functional form of predictors are checked by inspecting various scatter plots of the residuals, however, the subjective task of judging these can be challenging. In this paper we present an implementation of model diagnostics for the generalized linear model as well as structural equation models, based on aggregates of the residuals where the asymptotic behavior under the null is imitated by simulations. A procedure for checking the proportional hazard assumption in the Cox regression is also implemented.
Motivation & Objective
- To address the lack of objective, statistical tools for diagnosing model assumptions in widely used regression models like GLMs and SEMs.
- To provide a formal, simulation-based method for testing linearity and functional form assumptions in the mean structure of GLMs.
- To extend cumulative residual methods to structural equation models and Cox regression for assessing proportional hazards assumptions.
- To offer a reproducible, R-based solution for model diagnostics that complements existing subjective residual plotting techniques.
- To improve model validity by enabling researchers to detect and correct misspecifications in predictor functional forms and proportional hazards assumptions.
Proposed method
- The method uses cumulative sums of residuals over covariates or predicted values, defined as $ W_j(x) = n^{-1/2} \sum_{i=1}^n \mathbf{1}_{\{x_{ji} \leq x\}} e_i $, to assess model fit.
- Asymptotic null distributions of these cumulative processes are approximated via simulation, incorporating estimation uncertainty through a Taylor expansion and Fisher information.
- The test statistic is based on the supremum of the absolute cumulative residual process: $ \mathfrak{T}_{\infty}^{(j)} = \sup_x |W_j(x)| $, analogous to a Kolmogorov-Smirnov test.
- For GLMs and SEMs, the method uses the `cumres` function to compute and plot cumulative residuals, with ordering by predicted values or covariates.
- For Cox models, the score process is used as the cumulative residual, with time as the ordering variable, to test proportional hazards.
- The package implements a parametric bootstrap with i.i.d. standard normal variates to simulate the null distribution of the test statistic.
Experimental results
Research questions
- RQ1Can cumulative residuals provide an objective, simulation-based method for detecting misspecification in the functional form of predictors in generalized linear models?
- RQ2How can cumulative residual processes be adapted to assess linearity in structural equation models with latent variables?
- RQ3To what extent can cumulative residuals detect violations of the proportional hazards assumption in Cox regression models?
- RQ4Can the gof package offer a reliable, reproducible alternative to subjective residual plotting in model diagnostics?
- RQ5How do the cumulative residual processes behave under correct model specification, and how do they differ under misspecification?
Key findings
- The gof package successfully detects model misspecification in simulated SEMs, including a quadratic relationship in the measurement model of $ Y_2 $ and a non-linear effect of $ X $ on $ \eta $, which are clearly visible in the cumulative residual plots.
- In the Mayo Clinic PBC dataset, the method identified significant violations of the proportional hazards assumption for the `protime` (blood clotting time) and `edema` variables, indicating time-varying effects.
- The cumulative residual process for `protime` showed a clear trend over time, suggesting non-proportional hazards, which was confirmed by the simulation-based p-value from the gof test.
- The method demonstrated robust performance in detecting non-linearity and incorrect functional forms in both GLMs and SEMs, outperforming visual inspection of raw residuals.
- The simulation-based approach accurately approximates the null distribution of the test statistic, enabling valid inference even when the true parameter values are estimated.
- The package provides a flexible interface allowing users to define custom residuals and ordering variables, enhancing its applicability across diverse modeling contexts.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.