gratia0.11.2 package

Graceful 'ggplot'-Based Graphics and Other Functions for GAMs Fitted Using 'mgcv'

add_confint

Add a confidence interval to an existing object

add_constant

Add a constant to estimated values

add_fitted_samples

Add posterior draws from a model to a data object

add_fitted.gam

Add fitted values from a GAM to a data frame

add_fitted

Add fitted values from a model to a data frame

add_partial_residuals

Add partial residuals

add_residuals.gam

Add residuals from a GAM to a data frame

add_residuals

Add residuals from a model to a data frame

add_sizer

Add indicators of significant change after SiZeR

appraise

Model diagnostic plots

assemble.gam

Plot estimated smooths from a fitted GAM

assemble

Prepare plots via ggplot2 and assembles them as a list

basis_size

Extract basis dimension of a smooth

basis

Basis expansions for smooths

boundary

Extract the boundary of a soap film smooth

check_user_select_smooths

Select smooths based on user's choices

coef.scam

Extract coefficients from a fitted scam model.

compare_smooths

Compare smooths across models

conditional_values

Conditional predictions from a GAM

confint.fderiv

Point-wise and simultaneous confidence intervals for derivatives of sm...

confint.gam

Point-wise and simultaneous confidence intervals for smooths

data_combos

All combinations of factor levels plus typical values of continuous va...

data_sim

Simulate example data for fitting GAMs

data_slice

Prepare a data slice through model covariates

datagen

Generate data over the range of variables used in smooths

derivative_samples

Posterior expectations of derivatives from an estimated model

derivatives

Derivatives of estimated smooths via finite differences

difference_smooths

Differences of factor smooth interactions

dispersion

Dispersion parameter for fitted model

draw_parametric_effect

Internal function to draw an individual parametric effect

draw.basis

Plot basis functions

draw.compare_smooths

Plot comparisons of smooths

draw.conditional_values

Plot conditional predictions

draw.derivatives

Plot derivatives of smooths

draw.difference_smooth

Plot differences of smooths

draw.evaluated_parametric_term

Plot estimated parametric effects

draw.gam

Plot estimated smooths from a fitted GAM

draw.gamlss

Plot smooths of a GAMLSS model estimated by GJRM::gamlss

draw.mgcv_smooth

Plot basis functions

draw.pairwise_concurvity

Plot concurvity measures

draw.parametric_effects

Plot estimated effects for model parametric terms

draw.penalty_df

Display penalty matrices of smooths using ggplot

draw

Generic plotting via ggplot2

draw.rootogram

Draw a rootogram

draw.smooth_estimates

Plot the result of a call to smooth_estimates()

draw.smooth_samples

Plot posterior smooths

edf

Effective degrees of freedom for smooths and GAMs

eval_smooth

S3 methods to evaluate individual smooths

evaluate_parametric_term

Evaluate parametric model terms

evaluate_smooth

Evaluate a smooth

evenly

Create a sequence of evenly-spaced values

factor_combos

All combinations of factor levels

family_name

Name of family used to fit model

family_type

Extracts the type of family in a consistent way

family.gam

Extract family objects from models

fderiv

First derivatives of fitted GAM functions

fitted_samples

Draw fitted values from the posterior distribution

fitted_values

Generate fitted values from a estimated GAM

fix_offset

Fix the names of a data frame containing an offset variable.

fixef.gam

Extract fixed effects estimates from a fitted GAM

fixef

Extract fixed effects estimates

gaussian_draws

Posterior samples using a simple Metropolis Hastings sampler

get_by_smooth

Extract an factor-by smooth by name

get_smooth

Extract an mgcv smooth by name

get_smooths_by_id

Extract an mgcv smooth given its position in the model object

gratia-package

gratia: Graceful 'ggplot'-Based Graphics and Other Functions for GAMs ...

gw_functions

Gu and Wahba test functions

has_theta

Are additional parameters available for a GAM?

is_by_smooth

Tests for by variable smooths

is_factor_term

Is a model term a factor (categorical)?

is_mgcv_family

Is an object one of mgcv's family objects?

is_mgcv_smooth

Check if objects are smooths or are a particular type of smooth

is_multivariate_y

Is a model multivariate?

is_offset

Is a model term an offset?

link

Extract link and inverse link functions from models

load_mgcv

Load mgcv quietly

lp_matrix

Return the linear prediction matrix of a fitted GAM

lss_parameters

General names of LSS parameters for each GAM family

mh_draws

Posterior samples using a Gaussian approximation to the posterior dist...

model_concurvity

Concurvity of an estimated GAM

model_constant

Extract the model constant term

model_terms

Find the names of model terms

model_vars

List the variables involved in a model fitted with a formula

n_eta

The Number of linear predictors in model

n_smooths

How many smooths in a fitted model

nb_theta

Negative binomial parameter theta

nested_partial_residuals

Partial residuals in nested form

nested_rug_values

Values for rug plot in nested form

null_deviance

Extract the null deviance of a fitted model

observed_fitted_plot

Plot of fitted against observed response values

overview

Provides an overview of a model and the terms in that model

parametric_effects

Estimated values for parametric model terms

parametric_terms

Names of any parametric terms in a GAM

partial_derivatives

Partial derivatives of estimated multivariate smooths via finite diffe...

partial_residuals

Partial residuals

penalty

Extract and tidy penalty matrices

post_draws

Low-level Functions to generate draws from the posterior distribution ...

post_link_funs

A list of transformation functions named for LSS parameters in a GAMLS...

posterior_samples

Draw samples from the posterior distribution of an estimated model

predicted_samples

Draw new response values from the conditional distribution of the resp...

qq_plot

Quantile-quantile plot of model residuals

quantile_residuals

Randomised residuals

ref_level

Return the reference or specific level of a factor

reorder_fs_smooth_terms

Reorder random factor smooth terms to place factor last

reorder_tensor_smooth_terms

Reorder tensor product terms for nicer plotting

rep_first_factor_value

Repeat the first level of a factor n times

residuals_hist_plot

Histogram of model residuals

residuals_linpred_plot

Plot of residuals versus linear predictor values

response_derivatives

Derivatives on the response scale from an estimated GAM

rootogram

Rootograms to assess goodness of model fit

rtw

Simulator for tweedie LSS models

scale_fill_partial_effect

Default diverging red-blue colour palette for partial effects

seq_min_max_eps

Create a sequence of evenly-spaced values adjusted to accommodate a sm...

shift_values

Shift numeric values in a data frame by an amount eps

simulate

Simulate from the posterior distribution of a GAM

smooth_coef_indices

Indices of the parametric terms for a particular smooth

smooth_coefs

Coefficients for a particular smooth

smooth_data

Generate regular data over the covariates of a smooth

smooth_dim

Dimension of a smooth

smooth_estimates

Evaluate smooths at covariate values

smooth_label

Extract the label for a smooth used by 'mgcv'

smooth_samples

Posterior draws for individual smooths

smooth_terms

List the variables involved in smooths

smooth_type

Determine the type of smooth and return it n a human readable form

smooths

Names of smooths in a GAM

spline_values

Evaluate a spline at provided covariate values

spline_values2

Evaluate a spline at provided covariate values

term_names

Extract names of all variables needed to fit a GAM or a smooth

term_variables

Names of variables involved in a specified model term

theta

General extractor for additional parameters in mgcv models

tidy_basis

A tidy basis representation of a smooth object

to_na

Sets the elements of vector to NA

too_far_to_na

Set rows of data to NA if the lie too far from a reference set of va...

too_far

Exclude values that lie too far from the support of data

transform_fun

Transform estimated values and confidence intervals by applying a func...

typical_values

Typical values of model covariates

user_draws

Handle user-supplied posterior draws

variance_comp

Variance components of smooths from smoothness estimates

vars_from_label

Returns names of variables from a smooth label

which_smooths

Identify a smooth term by its label

worm_plot

Worm plot of model residuals

Graceful 'ggplot'-based graphics and utility functions for working with generalized additive models (GAMs) fitted using the 'mgcv' package. Provides a reimplementation of the plot() method for GAMs that 'mgcv' provides, as well as 'tidyverse' compatible representations of estimated smooths.

  • Maintainer: Gavin L. Simpson
  • License: MIT + file LICENSE
  • Last published: 2026-02-07 06:10:36 UTC