Learn R Programming

mgcv (version 1.9-5)

Mixed GAM Computation Vehicle with Automatic Smoothness Estimation

Description

Generalized additive (mixed) models, some of their extensions and other generalized ridge regression with multiple smoothing parameter estimation by (Restricted) Marginal Likelihood, Cross Validation and similar, or using iterated nested Laplace approximation for fully Bayesian inference. See Wood (2025) for an overview. Includes a gam() function, a wide variety of smoothers, 'JAGS' support and distributions beyond the exponential family.

Copy Link

Version

Install

install.packages('mgcv')

Monthly Downloads

79,893

Version

1.9-5

License

GPL (>= 2)

Maintainer

Simon Wood

Last Published

November 2nd, 2026

Functions in mgcv (1.9-5)

bcg

Censored Box-Cox Gaussian family
bug.reports.mgcv

Reporting mgcv bugs.
cSplineDes

Evaluate cyclic B spline basis
XWXd

Internal functions for discretized model matrix handling
bam.update

Update a strictly additive bam model for new data.
Tweedie

GAM Tweedie families
bam

Generalized additive models for very large datasets
blas.thread.test

BLAS thread safety
bandchol

Cholesky decomposition of a band diagonal matrix
anova.gam

Approximate hypothesis tests related to GAM fits
cox.pht

Additive Cox proportional hazard models with time varying covariates
columb

Reduced version of Columbus OH crime data
concurvity

GAM concurvity measures
dDeta

Obtaining derivative w.r.t. linear predictor
choose.k

Basis dimension choice for smooths
cox.ph

Additive Cox Proportional Hazard Model
cpois

GAM censored Poisson family
choldrop

Deletion and rank one Cholesky factor update
cnorm

GAM censored normal family for log-normal AFT and Tobit models
clog

GAM censored logistic distribution family for log-logistic AFT models
factor.smooth

Factor smooth interactions in GAMs
family.mgcv

Distribution families in mgcv
fixDependence

Detect linear dependencies of one matrix on another
dppois

Stable evaluation of difference between Poisson c.d.f.s
formXtViX

Form component of GAMM covariance matrix
dpnorm

Stable evaluation of difference between normal c.d.f.s
fix.family.link

Modify families for use in GAM fitting and checking
extract.lme.cov

Extract the data covariance matrix from an lme object
formula.gam

GAM formula
exclude.too.far

Exclude prediction grid points too far from data
gam.check

Some diagnostics for a fitted gam model
gam.fit5.post.proc

Post-processing output of gam.fit5
gam.models

Specifying generalized additive models
gam.convergence

GAM convergence and performance issues
gam

Generalized additive models with integrated smoothness estimation
gam.fit3

P-IRLS GAM estimation with GCV, UBRE/AIC or RE/ML derivative calculation
fs.test

FELSPLINE test function
gam.control

Setting GAM fitting defaults
gam.fit

GAM P-IRLS estimation with GCV/UBRE smoothness estimation (deprecated)
gam.mh

Simple posterior simulation with gam fits
gam.outer

Minimize GCV or UBRE score of a GAM using `outer' iteration
gam.reparam

Finding stable orthogonal re-parameterization of the square root penalty.
gamlss.etamu

Transform derivatives wrt mu to derivatives wrt linear predictor
gam.side

Identifiability side conditions for a GAM
gam.selection

Generalized Additive Model Selection
gam.vcomp

Report gam smoothness estimates as variance components
gam2objective

Objective functions for GAM smoothing parameter estimation
gam.scale

Scale parameter estimation in GAMs
gamObject

Fitted gam object
gamSim

Simulate example data for GAMs
gevlss

Generalized Extreme Value location-scale model family
identifiability

Identifiability constraints
gfam

Grouped families
gamlss.gH

Calculating derivatives of log-likelihood wrt regression coefficients
ginla

GAM Integrated Nested Laplace Approximation Newton Enhanced
get.var

Get named variable or evaluate expression from list or data.frame
gaulss

Gaussian location-scale model family
ldetS

Getting log generalized determinant of penalty matrices
gammals

Gamma location-scale model family
gumbls

Gumbel location-scale model family
ldTweedie

Log Tweedie density evaluation
influence.gam

Extract the diagonal of the influence/hat matrix for a GAM
gamm

Generalized Additive Mixed Models
jagam

Just Another Gibbs Additive Modeller: JAGS support for mgcv.
initial.sp

Starting values for multiple smoothing parameter estimation
in.out

Which of a set of points lie within a polygon defined region
inSide

Are points inside boundary?
k.check

Checking smooth basis dimension
linear.functional.terms

Linear functionals of a smooth in GAMs
interpret.gam

Interpret a GAM formula
ls.size

Size of list elements
mini.roots

Obtain square roots of penalty matrices
mchol

Sparse chol function
magic.post.proc

Auxilliary information from magic fit
mgcv.parallel

Parallel computation in mgcv.
logLik.gam

AIC and Log likelihood for a fitted GAM
magic

Stable Multiple Smoothing Parameter Estimation by GCV or UBRE
lp

Basic linear programming
missing.data

Missing data in GAMs
new.name

Obtain a name for a new variable that is not already in use
mvn

Multivariate normal additive models
mgcv.FAQ

Frequently Asked Questions for package mgcv
notExp2

Alternative to log parameterization for variance components
mono.con

Monotonicity constraints for a cubic regression spline
mgcv.package

Mixed GAM Computation Vehicle with GCV/AIC/REML/NCV smoothness estimation and GAMMs by REML/PQL
mroot

Smallest square root of matrix
model.matrix.gam

Extract model matrix from GAM fit
notExp

Functions for better-than-log positive parameterization
multinom

GAM multinomial logistic regression
negbin

GAM negative binomial families
ocat

GAM ordered categorical family
pdIdnot

Overflow proof pdMat class for multiples of the identity matrix
plot.gam

Default GAM plotting
options.mgcv

Options in mgcv
place.knots

Automatically place a set of knots evenly through covariate values
null.space.dimension

The basis of the space of un-penalized functions for a TPRS
one.se.rule

The one standard error rule for smoother models
pen.edf

Extract the effective degrees of freedom associated with each penalty in a gam fit
pdTens

Functions implementing a pdMat class for tensor product smooths
pcls

Penalized Constrained Least Squares Fitting
rTweedie

Generate Tweedie random deviates
polys.plot

Plot geographic regions defined as polygons
residuals.gam

Generalized Additive Model residuals
rig

Generate inverse Gaussian random deviates
random.effects

Random effects in GAMs
print.gam

Print a Generalized Additive Model object.
predict.gam

Prediction from fitted GAM model
psum.chisq

Evaluate the c.d.f. of a weighted sum of chi-squared deviates
qq.gam

QQ plots for gam model residuals
predict.bam

Prediction from fitted Big Additive Model model
shash

Sinh-arcsinh location scale and shape model family
scasm

Shape constrained additive smooth models
sdiag

Extract or modify diagonals of a matrix
rmvn

Generate from or evaluate multivariate normal or t densities.
set.mgcv.options

Set mgcv options
s

Defining smooths in GAM formulae
slanczos

Compute truncated eigen decomposition of a symmetric matrix
single.index

Single index models with mgcv
smooth.construct

Constructor functions for smooth terms in a GAM
scat

GAM scaled t family for heavy tailed data
smooth.construct.mrf.smooth.spec

Markov Random Field Smooths
smooth.construct.gp.smooth.spec

Low rank Gaussian process smooths
smooth.construct.ps.smooth.spec

P-splines in GAMs
smooth.construct.fs.smooth.spec

Factor smooth interactions in GAMs
smooth.construct.bt.smooth.spec

B-spline tensor product smooths with general penalties
smooth.construct.bs.smooth.spec

Penalized B-splines in GAMs
smooth.construct.cr.smooth.spec

Penalized Cubic regression splines in GAMs
smooth.construct.re.smooth.spec

Simple random effects in GAMs
smooth.construct.ds.smooth.spec

Low rank Duchon 1977 splines
smooth.construct.ad.smooth.spec

Adaptive smooths in GAMs
smooth.info

Generic function to provide extra information about smooth specification
smooth.construct.sos.smooth.spec

Splines on the sphere
smooth.construct.t2.smooth.spec

Tensor product smoothing constructor
smooth.terms

Smooth terms in GAM
smooth.construct.tensor.smooth.spec

Tensor product smoothing constructor
smooth.construct.so.smooth.spec

Soap film smoother constructer
smooth.construct.sz.smooth.spec

Constrained factor smooth interactions in GAMs
smoothCon

Prediction/Construction wrapper functions for GAM smooth terms
smooth2random

Convert a smooth to a form suitable for estimating as random effect
smooth.construct.tp.smooth.spec

Penalized thin plate regression splines in GAMs
sp.vcov

Extract smoothing parameter estimator covariance matrix from (RE)ML GAM fit
trind.generator

Generates index arrays for upper triangular storage
totalPenaltySpace

Obtaining (orthogonal) basis for null space and range of the penalty matrix
step.gam

Alternatives to step.gam
spasm.construct

Experimental sparse smoothers
trichol

Choleski decomposition of a tri-diagonal matrix
tensor.prod.model.matrix

Row Kronecker product/ tensor product smooth construction
summary.gam

Summary for a GAM fit
t2

Define alternative tensor product smooths in GAM formulae
te

Define tensor product smooths or tensor product interactions in GAM formulae
vis.gam

Visualization of GAM objects
uniquecombs

find the unique rows in a matrix
ziplss

Zero inflated (hurdle) Poisson location-scale model family
ziP

GAM zero-inflated (hurdle) Poisson regression family
twlss

Tweedie location scale family
vcov.gam

Extract parameter (estimator) covariance matrix from GAM fit
Sl.repara

Applying re-parameterization from log-determinant of penalty matrix to model matrix.
Predict.matrix.cr.smooth

Predict matrix method functions
Sl.inirep

Re-parametrizing model matrix X
Sl.setup

Setting up a list representing a block diagonal penalty matrix
NCV

Neighbourhood Cross Validation
Rrank

Find rank of upper triangular matrix
FFdes

Level 5 fractional factorial designs
Predict.matrix.soap.film

Prediction matrix for soap film smooth
Predict.matrix

Prediction methods for smooth terms in a GAM
betar

GAM beta regression family