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

## Documentation for package ‘gratia’ version 0.9.2

- DESCRIPTION file.
- User guides, package vignettes and other documentation.
- Package NEWS.

## Help Pages

A B C D E F G H I L M N O P Q R S T U V W Z

## -- A --

add_confint | Add a confidence interval to an existing object
add_confint.default | Add a confidence interval to an existing object
add_confint.parametric_effects | Add a confidence interval to an existing object
add_confint.smooth_estimates | Add a confidence interval to an existing object
add_constant | Add a constant to estimated values
add_constant.evaluated_parametric_term | Add a constant to estimated values
add_constant.mgcv_smooth | Add a constant to estimated values
add_constant.parametric_effects | Add a constant to estimated values
add_constant.smooth_estimates | Add a constant to estimated values
add_constant.smooth_samples | Add a constant to estimated values
add_constant.tbl_df | Add a constant to estimated values
add_fitted | Add fitted values from a model to a data frame
add_fitted.gam | Add fitted values from a GAM to a data frame
add_fitted_samples | Add posterior draws from a model to a data object
add_partial_residuals | Add partial residuals
add_partial_residuals.gam | Add partial residuals
add_posterior_samples | Add posterior draws from a model to a data object
add_predicted_samples | Add posterior draws from a model to a data object
add_residuals | Add residuals from a model to a data frame
add_residuals.gam | Add residuals from a GAM to a data frame
add_sizer | Add indicators of significant change after SiZeR
add_sizer.derivatives | Add indicators of significant change after SiZeR
add_sizer.smooth_estimates | Add indicators of significant change after SiZeR
add_smooth_samples | Add posterior draws from a model to a data object
appraise | Model diagnostic plots
appraise.gam | Model diagnostic plots
appraise.lm | Model diagnostic plots

## -- B --

basis | Basis expansions for smooths
basis.default | Basis expansions for smooths
basis.gam | Basis expansions for smooths
basis.gamm | Basis expansions for smooths
basis.list | Basis expansions for smooths
basis.scam | Basis expansions for smooths
basis_size | Extract basis dimension of a smooth
basis_size.gam | Extract basis dimension of a smooth
basis_size.gamm | Extract basis dimension of a smooth
basis_size.mgcv.smooth | Extract basis dimension of a smooth
bird_move | Simulated bird migration data
boundary | Extract the boundary of a soap film smooth
boundary.gam | Extract the boundary of a soap film smooth
boundary.soap.film | Extract the boundary of a soap film smooth
by_level | Tests for by variable smooths
by_variable | Tests for by variable smooths

## -- C --

check_is_mgcv_smooth | Check if objects are smooths or are a particular type of 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
concrvity | Concurvity of an estimated GAM
confint.fderiv | Point-wise and simultaneous confidence intervals for derivatives of smooths
confint.gam | Point-wise and simultaneous confidence intervals for smooths
confint.gamm | Point-wise and simultaneous confidence intervals for smooths
confint.list | Point-wise and simultaneous confidence intervals for smooths

## -- D --

data_combos | All combinations of factor levels plus typical values of continuous variables
data_combos.gam | All combinations of factor levels plus typical values of continuous variables
data_sim | Simulate example data for fitting GAMs
data_slice | Prepare a data slice through model covariates
data_slice.data.frame | Prepare a data slice through model covariates
data_slice.default | Prepare a data slice through model covariates
data_slice.gam | Prepare a data slice through model covariates
data_slice.gamm | Prepare a data slice through model covariates
data_slice.list | Prepare a data slice through model covariates
data_slice.scam | Prepare a data slice through model covariates
derivatives | Derivatives of estimated smooths via finite differences
derivatives.default | Derivatives of estimated smooths via finite differences
derivatives.gam | Derivatives of estimated smooths via finite differences
derivatives.gamm | Derivatives of estimated smooths via finite differences
derivative_samples | Posterior expectations of derivatives from an estimated model
derivative_samples.default | Posterior expectations of derivatives from an estimated model
derivative_samples.gam | Posterior expectations of derivatives from an estimated model
derivative_samples.gamm | Posterior expectations of derivatives from an estimated model
difference_smooths | Differences of factor smooth interactions
difference_smooths.gam | Differences of factor smooth interactions
draw | Generic plotting via 'ggplot2'
draw.basis | Plot basis functions
draw.compare_smooths | Plot comparisons of smooths
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.overall_concurvity | Plot concurvity measures
draw.pairwise_concurvity | Plot concurvity measures
draw.parametric_effects | Plot estimated effects for model parametric terms
draw.partial_derivatives | Plot derivatives of smooths
draw.penalty_df | Display penalty matrices of smooths using 'ggplot'
draw.rootogram | Draw a rootogram
draw.smooth_estimates | Plot the result of a call to 'smooth_estimates()'
draw.smooth_samples | Plot posterior smooths

## -- E --

edf | Effective degrees of freedom for smooths and GAMs
edf.gam | Effective degrees of freedom for smooths and GAMs
evaluate_parametric_term | Evaluate parametric model terms
evaluate_parametric_term.gam | Evaluate parametric model terms
evaluate_smooth | Evaluate a smooth
eval_smooth | S3 methods to evaluate individual smooths
eval_smooth.fs.interaction | S3 methods to evaluate individual smooths
eval_smooth.mgcv.smooth | S3 methods to evaluate individual smooths
eval_smooth.mrf.smooth | S3 methods to evaluate individual smooths
eval_smooth.random.effect | S3 methods to evaluate individual smooths
eval_smooth.scam_smooth | S3 methods to evaluate individual smooths
eval_smooth.soap.film | S3 methods to evaluate individual smooths
eval_smooth.sz.interaction | S3 methods to evaluate individual smooths
eval_smooth.t2.smooth | S3 methods to evaluate individual smooths
eval_smooth.tensor.smooth | S3 methods to evaluate individual smooths
evenly | Create a sequence of evenly-spaced values
extract_link | Extract link and inverse link functions from models
extract_link.family | Extract link and inverse link functions from models
extract_link.general.family | Extract link and inverse link functions from models

## -- F --

factor_combos | All combinations of factor levels
factor_combos.gam | All combinations of factor levels
family.bam | Extract family objects from models
family.gam | Extract family objects from models
family.gamm | Extract family objects from models
family.list | Extract family objects from models
family_name | Name of family used to fit model
family_type | Extracts the type of family in a consistent way
family_type.default | Extracts the type of family in a consistent way
family_type.family | Extracts the type of family in a consistent way
fitted_samples | Draw fitted values from the posterior distribution
fitted_samples.gam | Draw fitted values from the posterior distribution
fitted_values | Generate fitted values from a estimated GAM
fitted_values.gam | Generate fitted values from a estimated GAM
fitted_values.gamm | Generate fitted values from a estimated GAM
fitted_values.scam | Generate fitted values from a estimated GAM
fixed_effects | Extract fixed effects estimates from a fitted GAM
fixed_effects.default | Extract fixed effects estimates from a fitted GAM
fixef | Extract fixed effects estimates
fixef.gam | Extract fixed effects estimates from a fitted GAM
fixef.gamm | Extract fixed effects estimates from a fitted GAM
fixef.glm | Extract fixed effects estimates from a fitted GAM
fixef.lm | Extract fixed effects estimates from a fitted GAM
fix_offset | Fix the names of a data frame containing an offset variable.

## -- G --

gaussian_draws | Posterior samples using a simple Metropolis Hastings sampler
gaussian_draws.gam | Posterior samples using a simple Metropolis Hastings sampler
gaussian_draws.scam | Posterior samples using a simple Metropolis Hastings sampler
generate_draws | Low-level Functions to generate draws from the posterior distribution of model coefficients
generate_draws.gam | Low-level Functions to generate draws from the posterior distribution of model coefficients
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
get_smooths_by_id.gam | Extract an mgcv smooth given its position in the model object
get_smooths_by_id.gamm | Extract an mgcv smooth given its position in the model object
get_smooths_by_id.gamm4 | Extract an mgcv smooth given its position in the model object
get_smooths_by_id.list | Extract an mgcv smooth given its position in the model object
get_smooths_by_id.scam | Extract an mgcv smooth given its position in the model object
gss_vocab | Data from the General Social Survey (GSS) from the National Opinion Research Center of the University of Chicago
gw_f0 | Gu and Wabha test functions
gw_f1 | Gu and Wabha test functions
gw_f2 | Gu and Wabha test functions
gw_f3 | Gu and Wabha test functions
gw_functions | Gu and Wabha test functions

## -- H --

has_theta | Are additional parameters available for a GAM?

## -- I --

inv_link | Extract link and inverse link functions from models
inv_link.bam | Extract link and inverse link functions from models
inv_link.family | Extract link and inverse link functions from models
inv_link.gam | Extract link and inverse link functions from models
inv_link.gamm | Extract link and inverse link functions from models
inv_link.glm | Extract link and inverse link functions from models
inv_link.list | Extract link and inverse link functions from models
is_by_smooth | Tests for by variable smooths
is_continuous_by_smooth | Tests for by variable smooths
is_factor_by_smooth | Tests for by variable smooths
is_factor_term | Is a model term a factor (categorical)?
is_factor_term.bam | Is a model term a factor (categorical)?
is_factor_term.gam | Is a model term a factor (categorical)?
is_factor_term.gamm | Is a model term a factor (categorical)?
is_factor_term.list | Is a model term a factor (categorical)?
is_factor_term.terms | Is a model term a factor (categorical)?
is_mgcv_smooth | Check if objects are smooths or are a particular type of smooth
is_mrf_smooth | Check if objects are smooths or are a particular type of smooth
is_offset | Is a model term an offset?

## -- L --

level | Return the reference or specific level of a factor
link | Extract link and inverse link functions from models
link.bam | Extract link and inverse link functions from models
link.family | Extract link and inverse link functions from models
link.gam | Extract link and inverse link functions from models
link.gamm | Extract link and inverse link functions from models
link.glm | Extract link and inverse link functions from models
link.list | Extract link and inverse link functions from models
load_mgcv | Load mgcv quietly
lp_matrix | Return the linear prediction matrix of a fitted GAM
lp_matrix.gam | Return the linear prediction matrix of a fitted GAM

## -- M --

mh_draws | Posterior samples using a Gaussian approximation to the posterior distribution
mh_draws.gam | Posterior samples using a Gaussian approximation to the posterior distribution
model_concurvity | Concurvity of an estimated GAM
model_concurvity.gam | Concurvity of an estimated GAM
model_constant | Extract the model constant term
model_edf | Effective degrees of freedom for smooths and GAMs
model_vars | List the variables involved in a model fitted with a formula
model_vars.bam | List the variables involved in a model fitted with a formula
model_vars.default | List the variables involved in a model fitted with a formula
model_vars.gam | List the variables involved in a model fitted with a formula
model_vars.gamm | List the variables involved in a model fitted with a formula
model_vars.gamm4 | List the variables involved in a model fitted with a formula
model_vars.list | List the variables involved in a model fitted with a formula

## -- N --

nb_theta | Negative binomial parameter theta
nb_theta.gam | Negative binomial parameter theta
null_deviance | Extract the null deviance of a fitted model
null_deviance.default | Extract the null deviance of a fitted model
n_smooths | How many smooths in a fitted model
n_smooths.bam | How many smooths in a fitted model
n_smooths.default | How many smooths in a fitted model
n_smooths.gam | How many smooths in a fitted model
n_smooths.gamm | How many smooths in a fitted model

## -- O --

observed_fitted_plot | Plot of fitted against observed response values
overview | Provides an overview of a model and the terms in that model
overview.gam | Provides an overview of a model and the terms in that model

## -- P --

parametric_effects | Estimated values for parametric model terms
parametric_effects.gam | Estimated values for parametric model terms
parametric_terms | Names of any parametric terms in a GAM
parametric_terms.default | Names of any parametric terms in a GAM
parametric_terms.gam | Names of any parametric terms in a GAM
partial_derivatives | Partial derivatives of estimated multivariate smooths via finite differences
partial_derivatives.default | Partial derivatives of estimated multivariate smooths via finite differences
partial_derivatives.gam | Partial derivatives of estimated multivariate smooths via finite differences
partial_derivatives.gamm | Partial derivatives of estimated multivariate smooths via finite differences
partial_residuals | Partial residuals
partial_residuals.gam | Partial residuals
penalty | Extract and tidy penalty matrices
penalty.default | Extract and tidy penalty matrices
penalty.gam | Extract and tidy penalty matrices
penalty.mgcv.smooth | Extract and tidy penalty matrices
penalty.re.smooth.spec | Extract and tidy penalty matrices
penalty.t2.smooth | Extract and tidy penalty matrices
penalty.tensor.smooth | Extract and tidy penalty matrices
posterior_samples | Draw samples from the posterior distribution of an estimated model
posterior_samples.gam | Draw samples from the posterior distribution of an estimated model
post_draws | Low-level Functions to generate draws from the posterior distribution of model coefficients
post_draws.default | Low-level Functions to generate draws from the posterior distribution of model coefficients
predicted_samples | Draw new response values from the conditional distribution of the response
predicted_samples.gam | Draw new response values from the conditional distribution of the response

## -- Q --

qq_plot | Quantile-quantile plot of model residuals
qq_plot.default | Quantile-quantile plot of model residuals
qq_plot.gam | Quantile-quantile plot of model residuals
qq_plot.glm | Quantile-quantile plot of model residuals
qq_plot.lm | Quantile-quantile plot of model residuals

## -- R --

ref_level | Return the reference or specific level of a factor
ref_sims | Reference simulation data
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
response_derivatives.default | Derivatives on the response scale from an estimated GAM
response_derivatives.gam | Derivatives on the response scale from an estimated GAM
response_derivatives.gamm | Derivatives on the response scale from an estimated GAM
rootogram | Rootograms to assess goodness of model fit
rootogram.gam | Rootograms to assess goodness of model fit

## -- S --

seq_min_max | Create a sequence of evenly-spaced values
seq_min_max_eps | Create a sequence of evenly-spaced values adjusted to accommodate a small adjustment
shift_values | Shift numeric values in a data frame by an amount 'eps'
simulate.gam | Simulate from the posterior distribution of a GAM
simulate.gamm | Simulate from the posterior distribution of a GAM
simulate.scam | Simulate from the posterior distribution of a GAM
smallAges | Lead-210 age-depth measurements for Small Water
smooths | Names of smooths in a GAM
smooths.default | Names of smooths in a GAM
smooths.gamm | Names of smooths in a GAM
smooth_coefs | Coefficients for a particular smooth
smooth_coefs.bam | Coefficients for a particular smooth
smooth_coefs.gam | Coefficients for a particular smooth
smooth_coefs.gamm | Coefficients for a particular smooth
smooth_coefs.gamm4 | Coefficients for a particular smooth
smooth_coefs.list | Coefficients for a particular smooth
smooth_coefs.mgcv.smooth | Coefficients for a particular smooth
smooth_coefs.scam | Coefficients for a particular smooth
smooth_coef_indices | Indices of the parametric terms for a particular smooth
smooth_data | Generate regular data over the covariates of a smooth
smooth_dim | Dimension of a smooth
smooth_dim.gam | Dimension of a smooth
smooth_dim.gamm | Dimension of a smooth
smooth_dim.mgcv.smooth | Dimension of a smooth
smooth_estimates | Evaluate smooths at covariate values
smooth_estimates.gam | Evaluate smooths at covariate values
smooth_label | Extract the label for a smooth used by 'mgcv'
smooth_label.gam | Extract the label for a smooth used by 'mgcv'
smooth_label.mgcv.smooth | Extract the label for a smooth used by 'mgcv'
smooth_samples | Posterior draws for individual smooths
smooth_samples.gam | 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
smooth_type.Bspline.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.cp.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.cr.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.cs.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.cv.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.cx.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.cyclic.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.default | Determine the type of smooth and return it n a human readable form
smooth_type.duchon.spline | Determine the type of smooth and return it n a human readable form
smooth_type.fs.interaction | Determine the type of smooth and return it n a human readable form
smooth_type.gp.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.mdcv.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.mdcx.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.micv.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.micx.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.mifo.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.miso.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.mpd.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.mpi.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.mrf.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.pspline.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.random.effect | Determine the type of smooth and return it n a human readable form
smooth_type.sf | Determine the type of smooth and return it n a human readable form
smooth_type.soap.film | Determine the type of smooth and return it n a human readable form
smooth_type.sos.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.sw | Determine the type of smooth and return it n a human readable form
smooth_type.sz.interaction | Determine the type of smooth and return it n a human readable form
smooth_type.t2.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.tensor.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.tprs.smooth | Determine the type of smooth and return it n a human readable form
smooth_type.ts.smooth | Determine the type of smooth and return it n a human readable form
spline_values | Evaluate a spline at provided covariate values
stop_if_not_mgcv_smooth | Check if objects are smooths or are a particular type of smooth

## -- T --

term_names | Extract names of all variables needed to fit a GAM or a smooth
term_names.gam | Extract names of all variables needed to fit a GAM or a smooth
term_names.gamm | Extract names of all variables needed to fit a GAM or a smooth
term_names.mgcv.smooth | Extract names of all variables needed to fit a GAM or a smooth
term_variables | Names of variables involved in a specified model term
term_variables.bam | Names of variables involved in a specified model term
term_variables.gam | Names of variables involved in a specified model term
term_variables.terms | Names of variables involved in a specified model term
theta | General extractor for additional parameters in mgcv models
theta.gam | General extractor for additional parameters in mgcv models
tidy_basis | A tidy basis representation of a smooth object
too_far | Exclude values that lie too far from the support of data
too_far_to_na | Set rows of data to 'NA' if the lie too far from a reference set of values
to_na | Sets the elements of vector to 'NA'
transform_fun | Transform estimated values and confidence intervals by applying a function
transform_fun.evaluated_parametric_term | Transform estimated values and confidence intervals by applying a function
transform_fun.mgcv_smooth | Transform estimated values and confidence intervals by applying a function
transform_fun.parametric_effects | Transform estimated values and confidence intervals by applying a function
transform_fun.smooth_estimates | Transform estimated values and confidence intervals by applying a function
transform_fun.smooth_samples | Transform estimated values and confidence intervals by applying a function
transform_fun.tbl_df | Transform estimated values and confidence intervals by applying a function
typical_values | Typical values of model covariates
typical_values.data.frame | Typical values of model covariates
typical_values.gam | Typical values of model covariates

## -- U --

user_draws | Handle user-supplied posterior draws

## -- V --

variance_comp | Variance components of smooths from smoothness estimates
variance_comp.gam | Variance components of smooths from smoothness estimates
vars_from_label | Returns names of variables from a smooth label

## -- W --

which_smooths | Identify a smooth term by its label
which_smooths.bam | Identify a smooth term by its label
which_smooths.default | Identify a smooth term by its label
which_smooths.gam | Identify a smooth term by its label
which_smooths.gamm | Identify a smooth term by its label
worm_plot | Worm plot of model residuals
worm_plot.gam | Worm plot of model residuals
worm_plot.glm | Worm plot of model residuals
worm_plot.lm | Worm plot of model residuals

## -- Z --

zooplankton | Madison lakes zooplankton data