How cran/mgcv works
mgcv is an R package for generalized additive models: users specify model formulas and data, fit penalized smooth models, then predict, inspect, and visualize results. Its documented capabilities also include large-data fitting, mixed-model and multi-linear-predictor models, specialized families, and optional INLA/JAGS workflows. The README is empty and the supplied source excerpts are partial, so subsystem paths and broad capabilities are grounded in the tree and manual-page names; uncertain internal call links are omitted.
Main entry points: mgcv.r GAM interface · gam.fit3.r GAM fitting · bam.r Large-data fitting · smooth.r Smooth bases
Components 25
Model specification
- GAM interface
R/mgcv.r - Smooth bases
R/smooth.r - Model families
R/misc.r
Model fitting
- GAM fitting
R/gam.fit3.r - Alternate fitting
R/gam.fit4.r - Smoothing selection
R/fast-REML.r
Model extensions
- Large-data fitting
R/bam.r - Mixed GAMs
R/gamm.r - Multi-predictor GAMs
R/gfam.r - GAMLSS models
R/gamlss.r - JAGS interface
R/jagam.r - INLA interface
R/inla.r
Results and diagnostics
- Prediction
R/mgcv.r - Model diagnostics
R/mgcv.r - Plots and summaries
R/plots.r
Numerical engine
- Penalty optimization
src/magic.c - Model derivatives
src/gdi.c - Matrix operations
src/mat.c - Sparse computations
src/sparse.c - Discrete computations
src/discrete.c - Constrained least squares
src/qp.c - Thin-plate splines
src/tprs.c
Other components
- R analyst
- JAGS
- INLA
Connections 24
- R analyst → GAM interface: specifies and fits
- GAM interface → Smooth bases: constructs bases
- GAM interface → Model families: uses family
- GAM interface → GAM fitting: fits model
- GAM fitting → Smoothing selection: selects penalties
- Smoothing selection → Penalty optimization: optimizes penalties
- GAM fitting → Model derivatives: computes derivatives
- GAM fitting → Matrix operations: uses matrix routines
- GAM fitting → Constrained least squares: solves constraints
- Smooth bases → Thin-plate splines: constructs spline basis
- Alternate fitting → Penalty optimization: optimizes penalties
- Large-data fitting → Discrete computations: uses discrete methods
- Large-data fitting → Sparse computations: uses sparse methods
- Mixed GAMs → GAM interface: builds GAM components
- Multi-predictor GAMs → GAM fitting: fits predictors
- GAMLSS models → GAM fitting: fits distributional models
- JAGS interface → JAGS: generates JAGS model
- INLA interface → INLA: interfaces with INLA
- R analyst → Prediction: requests predictions
- R analyst → Model diagnostics: checks fit
- R analyst → Plots and summaries: summarizes and plots
- Prediction → GAM interface: uses fitted model
- Model diagnostics → GAM interface: inspects fitted model
- Plots and summaries → GAM interface: uses fitted model