Skip to main content
QUICK REVIEW

[Paper Review] cgam: An R Package for the Constrained Generalized Additive Model

Xiyue Liao, Mary C. Meyer|arXiv (Cornell University)|Dec 18, 2018
Advanced Statistical Methods and ModelsMathematics7 references9 citations
TL;DR

This paper introduces the R package cgam, which fits constrained generalized additive models using cone projections to enforce shape constraints such as monotonicity, convexity, and orderings on smooth components. It efficiently estimates models via iteratively re-weighted cone projections, offering faster computation than competing methods like scam, with demonstrated speed advantages and accurate fitting of complex shape-constrained surfaces without additivity assumptions.

ABSTRACT

The cgam package contains routines to fit the generalized additive model where the components may be modeled with shape and smoothness assumptions. The main routine is cgam and nineteen symbolic routines are provided to indicate the relationship between the response and each predictor, which satisfies constraints such as monotonicity, convexity, their combinations, tree, and umbrella orderings. The user may specify constrained splines to fit the components for continuous predictors, and various types of orderings for the ordinal predictors. In addition, the user may specify parametrically modeled covariates. The set over which the likelihood is maximized is a polyhedral convex cone, and a least-squares solution is obtained by projecting the data vector onto the cone. For generalized models, the fit is obtained through iteratively re-weighted cone projections. The cone information criterion is provided and may be used to compare fits for combinations of variables and shapes. In addition, the routine wps implements monotone regression in two dimensions using warped-plane splines, without an additivity assumption. The graphical routine plotpersp will plot an estimated mean surface for a selected pair of predictors, given an object of either cgam or wps. This package is now available from the Comprehensive R Archive Network at http://CRAN.R-project.org/package=cgam.

Motivation & Objective

  • To develop a computationally efficient R package for fitting generalized additive models with shape constraints such as monotonicity, convexity, and orderings.
  • To address limitations in existing packages like scam and mgcv by enabling fast, constrained smoothing without relying on penalized splines or back-fitting.
  • To provide a unified interface modeled after mgcv's gam function, allowing users to specify shape-constrained smooths using intuitive syntax like s.incr(x).
  • To support both continuous and ordinal predictors with various constraint types, including tree and umbrella orderings.
  • To offer tools for model comparison using the cone information criterion and visualization of bivariate effects via warped-plane splines (wps).

Proposed method

  • The package uses constrained splines—quadratic I-splines for monotonicity and cubic C-splines for convexity—where shape constraints are enforced by restricting coefficients to non-negative values.
  • The main fitting routine, cgam, projects the response vector onto a polyhedral convex cone defined by the shape constraints, solving a least-squares problem via active-set algorithms.
  • For generalized linear models, iteratively re-weighted cone projections are used to maximize the likelihood under the same constraints.
  • The wps function fits bivariate monotone surfaces using warped-plane splines without assuming additivity, enabling non-additive shape-constrained regression.
  • The cone information criterion (CIC) is used to compare models with different combinations of variables and shape constraints.
  • Graphical functions like plotpersp visualize estimated mean surfaces for selected predictor pairs, aiding model interpretation.

Experimental results

Research questions

  • RQ1How can shape-constrained additive models be efficiently estimated in R while maintaining computational speed and statistical accuracy?
  • RQ2Can cone projection methods outperform back-fitting or penalized spline approaches in fitting monotonic or convex smooth components?
  • RQ3How well do the constrained models fit real-world data when compared to unconstrained alternatives, especially in non-additive settings?
  • RQ4To what extent do the shape constraints improve model fit and interpretability in the presence of complex predictor-response relationships?
  • RQ5Can the package handle both continuous and ordinal predictors with diverse order constraints such as tree and umbrella orderings?

Key findings

  • The cgam package achieves significantly faster computation than the scam package: 17 seconds vs. 611 seconds for n=100 and 58 seconds vs. 842 seconds for n=500 in a simulation study.
  • The cone information criterion (CIC) effectively compares models with different shape constraints and variable combinations, supporting model selection.
  • The wps function successfully fits doubly-decreasing surfaces in two dimensions without assuming additivity, as demonstrated on the plasma dataset with a CIC of 5.02.
  • The package correctly identifies that the additive model is adequate, as its CIC (4.97) is comparable to the non-additive model (5.02), supporting model simplicity.
  • The cgam package outperforms scam in fitting surfaces that are doubly monotone but not uniformly increasing, as scam’s constraints are overly restrictive and fail to capture rate-of-increase variations.
  • The package supports a wide range of shape constraints—including combinations of monotonicity and convexity—via basis function constraints, enabling flexible, interpretable modeling.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.