Package: gratia 0.11.2-10

gratia: Graceful 'ggplot'-Based Graphics and Other Functions for GAMs Fitted Using 'mgcv'
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.
Authors:
gratia_0.11.2-10.tar.gz
gratia_0.11.2-10.zip(r-4.7)gratia_0.11.2-10.zip(r-4.6)gratia_0.11.2-10.zip(r-4.5)
gratia_0.11.2-10.tgz(r-4.6-any)gratia_0.11.2-10.tgz(r-4.5-any)
gratia_0.11.2-10.tar.gz(r-4.7-any)gratia_0.11.2-10.tar.gz(r-4.6-any)
gratia_0.11.2-10.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
card.svg |card.png
gratia/json (API)
NEWS
| # Install 'gratia' in R: |
| install.packages('gratia', repos = c('https://gavinsimpson.r-universe.dev', 'https://cloud.r-project.org')) |
Bug tracker:https://github.com/gavinsimpson/gratia/issues
Pkgdown/docs site:https://gavinsimpson.github.io
- bird_move - Simulated bird migration data
- gss_vocab - Data from the General Social Survey (GSS) from the National Opinion Research Center of the University of Chicago
- ref_sims - Reference simulation data
- smallAges - Lead-210 age-depth measurements for Small Water
- zooplankton - Madison lakes zooplankton data
distributional-regressiongamgammgeneralized-additive-mixed-modelsgeneralized-additive-modelsggplot2glmlmmgcvpenalized-splinerandom-effectssmoothingsplines
Last updated from:70fb8013f6. Checks:9 OK. Indexed: yes.
| Target | Result | Time | Files | Syslog |
|---|---|---|---|---|
| linux-devel-x86_64 | OK | 382 | ||
| source / vignettes | OK | 282 | ||
| linux-release-x86_64 | OK | 387 | ||
| macos-release-arm64 | OK | 297 | ||
| macos-oldrel-arm64 | OK | 266 | ||
| windows-devel | OK | 367 | ||
| windows-release | OK | 396 | ||
| windows-oldrel | OK | 342 | ||
| wasm-release | OK | 162 |
Exports:add_confintadd_constantadd_fittedadd_fitted_samplesadd_partial_residualsadd_posterior_samplesadd_predicted_samplesadd_residualsadd_sizeradd_smooth_samplesappraiseassemblebasisbasis_sizeboundaryby_levelby_variablecheck_is_mgcv_smoothcompare_smoothsconcrvityconditional_valuesdata_combosdata_simdata_slicederivative_samplesderivativesdifference_smoothsdispersiondrawedfeval_smoothevaluate_parametric_termevaluate_smoothevenlyextract_linkfactor_combosfamily_namefamily_typefderivfitted_samplesfitted_valuesfix_offsetfixed_effectsgaussian_drawsgenerate_drawsget_by_smoothget_smoothget_smooths_by_idget_vcovgw_f0gw_f1gw_f2gw_f3has_thetainv_linkis_by_smoothis_continuous_by_smoothis_factor_by_smoothis_factor_termis_mgcv_familyis_mgcv_smoothis_mrf_smoothis_multivariate_yis_offsetlevellinkload_mgcvlp_matrixmh_drawsmodel_concurvitymodel_constantmodel_edfmodel_termsmodel_varsn_etan_smoothsnb_thetanull_devianceobserved_fitted_plotoverviewparametric_effectsparametric_termspartial_derivativespartial_residualspenaltypost_drawsposterior_samplespredicted_samplesqq_plotquantile_residualsref_levelresiduals_hist_plotresiduals_linpred_plotresponse_derivativesrootogramrtwscale_fill_partial_effectsmooth_coef_indicessmooth_coefssmooth_datasmooth_dimsmooth_estimatessmooth_labelsmooth_samplessmooth_termssmooth_typesmoothsspline_valuesspline_values2stop_if_not_mgcv_smoothterm_namesterm_variablesthetatidy_basisto_natoo_fartoo_far_to_natransform_funtypical_valuesuser_drawsvariance_compvars_from_labelwhich_smoothsworm_plot
Dependencies:BHclicpp11dplyrfarvergenericsggokabeitoggplot2gluegtableisobandlabelinglatticelifecyclemagrittrMatrixmgcvmvnfastnlmepatchworkpillarpkgconfigpurrrR6RColorBrewerRcppRcppArmadillorlangS7scalesstatmodstringistringrtibbletidyrtidyselecttweedieutf8vctrsviridisLitewithr
Readme and manuals
Help Manual
| Help page | Topics |
|---|---|
| Add a confidence interval to an existing object | add_confint add_confint.default add_confint.parametric_effects add_confint.smooth_estimates |
| Add a constant to estimated values | add_constant add_constant.evaluated_parametric_term add_constant.mgcv_smooth add_constant.parametric_effects add_constant.smooth_estimates add_constant.smooth_samples add_constant.tbl_df |
| Add fitted values from a model to a data frame | add_fitted |
| Add posterior draws from a model to a data object | add_fitted_samples add_posterior_samples add_predicted_samples add_smooth_samples |
| Add fitted values from a GAM to a data frame | add_fitted.gam |
| Add partial residuals | add_partial_residuals add_partial_residuals.gam |
| Add residuals from a model to a data frame | add_residuals |
| Add residuals from a GAM to a data frame | add_residuals.gam |
| Add indicators of significant change after SiZeR | add_sizer add_sizer.derivatives add_sizer.smooth_estimates |
| Model diagnostic plots | appraise appraise.gam appraise.lm |
| Prepare plots via 'ggplot2' and assembles them as a list | assemble |
| Plot estimated smooths from a fitted GAM | assemble.gam |
| Basis expansions for smooths | basis basis.default basis.gam basis.gamm basis.gamm4 basis.scam |
| Extract basis dimension of a smooth | basis_size basis_size.gam basis_size.gamm basis_size.mgcv.smooth |
| Simulated bird migration data | bird_move |
| Extract the boundary of a soap film smooth | boundary boundary.gam boundary.soap.film |
| Select smooths based on user's choices | check_user_select_smooths |
| Extract coefficients from a fitted 'scam' model. | coef.scam |
| Compare smooths across models | compare_smooths |
| Conditional predictions from a GAM | conditional_values conditional_values.gam |
| Point-wise and simultaneous confidence intervals for derivatives of smooths | confint.fderiv |
| Point-wise and simultaneous confidence intervals for smooths | confint.gam confint.gamm confint.list |
| All combinations of factor levels plus typical values of continuous variables | data_combos data_combos.gam |
| Simulate example data for fitting GAMs | data_sim |
| Prepare a data slice through model covariates | data_slice data_slice.data.frame data_slice.default data_slice.gam data_slice.gamm data_slice.list data_slice.scam |
| Posterior expectations of derivatives from an estimated model | derivative_samples derivative_samples.default derivative_samples.gam derivative_samples.gamm derivative_samples.scam |
| Derivatives of estimated smooths via finite differences | derivatives derivatives.default derivatives.gam derivatives.gamm |
| Differences of factor smooth interactions | difference_smooths difference_smooths.gam |
| Dispersion parameter for fitted model | dispersion dispersion.gam dispersion.glm |
| Generic plotting via 'ggplot2' | draw |
| Plot basis functions | draw.basis |
| Plot comparisons of smooths | draw.compare_smooths |
| Plot conditional predictions | draw.conditional_values |
| Plot derivatives of smooths | draw.derivatives draw.partial_derivatives |
| Plot differences of smooths | draw.difference_smooth |
| Plot estimated parametric effects | draw.evaluated_parametric_term |
| Plot estimated smooths from a fitted GAM | draw.gam |
| Plot smooths of a GAMLSS model estimated by 'GJRM::gamlss' | draw.gamlss |
| Plot basis functions | draw.mgcv_smooth |
| Plot concurvity measures | draw.overall_concurvity draw.pairwise_concurvity |
| Plot estimated effects for model parametric terms | draw.parametric_effects |
| Display penalty matrices of smooths using 'ggplot' | draw.penalty_df |
| Draw a rootogram | draw.rootogram |
| Plot the result of a call to 'smooth_estimates()' | draw.smooth_estimates |
| Plot posterior smooths | draw.smooth_samples |
| Effective degrees of freedom for smooths and GAMs | edf edf.gam model_edf |
| S3 methods to evaluate individual smooths | eval_smooth eval_smooth.fs.interaction eval_smooth.mgcv.smooth eval_smooth.mrf.smooth eval_smooth.random.effect eval_smooth.scam_smooth eval_smooth.soap.film eval_smooth.sz.interaction eval_smooth.t2.smooth eval_smooth.tensor.smooth |
| Evaluate parametric model terms | evaluate_parametric_term evaluate_parametric_term.gam |
| Evaluate a smooth | evaluate_smooth |
| Create a sequence of evenly-spaced values | evenly seq_min_max |
| All combinations of factor levels | factor_combos factor_combos.gam |
| Name of family used to fit model | family_name |
| Extracts the type of family in a consistent way | family_type family_type.default family_type.family |
| Extract family objects from models | family.bam family.gam family.gamm family.list |
| Draw fitted values from the posterior distribution | fitted_samples fitted_samples.gam fitted_samples.scam |
| Generate fitted values from a estimated GAM | fitted_values fitted_values.gam fitted_values.gamm fitted_values.scam |
| Fix the names of a data frame containing an offset variable. | fix_offset |
| Extract fixed effects estimates from a fitted model | fixed_effects fixed_effects.default fixed_effects.gam fixed_effects.gamm fixed_effects.gamm4 fixed_effects.glm fixed_effects.lm |
| Posterior samples using a simple Metropolis Hastings sampler | gaussian_draws gaussian_draws.gam gaussian_draws.scam |
| Extract an factor-by smooth by name | get_by_smooth |
| Extract an mgcv smooth by name | get_smooth |
| Extract an mgcv smooth given its position in the model object | get_smooths_by_id get_smooths_by_id.gam get_smooths_by_id.gamm get_smooths_by_id.gamm4 get_smooths_by_id.list get_smooths_by_id.scam |
| Extract the covariance matrix of the model parameters or a subset of these for a particular model term | get_vcov |
| Data from the General Social Survey (GSS) from the National Opinion Research Center of the University of Chicago | gss_vocab |
| Gu and Wahba test functions | gw_f0 gw_f1 gw_f2 gw_f3 gw_functions |
| Are additional parameters available for a GAM? | has_theta |
| Tests for by variable smooths | by_level by_variable is_by_smooth is_continuous_by_smooth is_factor_by_smooth |
| Is a model term a factor (categorical)? | is_factor_term is_factor_term.bam is_factor_term.gam is_factor_term.gamm is_factor_term.list is_factor_term.terms |
| Is an object one of mgcv's family objects? | is_mgcv_family |
| Check if objects are smooths or are a particular type of smooth | check_is_mgcv_smooth is_mgcv_smooth is_mrf_smooth stop_if_not_mgcv_smooth |
| Is a model multivariate? | is_multivariate_y |
| Is a model term an offset? | is_offset |
| Extract link and inverse link functions from models | extract_link extract_link.family extract_link.general.family inv_link inv_link.bam inv_link.family inv_link.gam inv_link.gamm inv_link.glm inv_link.list link link.bam link.family link.gam link.gamm link.glm link.list |
| Load mgcv quietly | load_mgcv |
| Return the linear prediction matrix of a fitted GAM | lp_matrix lp_matrix.gam |
| Posterior samples using a Gaussian approximation to the posterior distribution | mh_draws mh_draws.gam |
| Concurvity of an estimated GAM | concrvity model_concurvity model_concurvity.gam |
| Extract the model constant term | model_constant model_constant.gam model_constant.gamlss model_constant.glm |
| Find the names of model terms | model_terms model_terms.gam model_terms.gamm model_terms.gamm4 model_terms.lm |
| List the variables involved in a model fitted with a formula | model_vars model_vars.bam model_vars.default model_vars.gam model_vars.gamm model_vars.gamm4 model_vars.list |
| The Number of linear predictors in model | n_eta n_eta.gam |
| How many smooths in a fitted model | n_smooths n_smooths.bam n_smooths.default n_smooths.gam n_smooths.gamm |
| Negative binomial parameter theta | nb_theta nb_theta.gam |
| Extract the null deviance of a fitted model | null_deviance null_deviance.default |
| Plot of fitted against observed response values | observed_fitted_plot |
| Provides an overview of a model and the terms in that model | overview overview.gam |
| Estimated values for parametric model terms | parametric_effects parametric_effects.gam |
| Names of any parametric terms in a GAM | parametric_terms parametric_terms.default parametric_terms.gam |
| Partial derivatives of estimated multivariate smooths via finite differences | partial_derivatives partial_derivatives.default partial_derivatives.gam partial_derivatives.gamm |
| Partial residuals | partial_residuals partial_residuals.gam |
| Extract and tidy penalty matrices | penalty penalty.default penalty.gam penalty.mgcv.smooth penalty.re.smooth.spec penalty.t2.smooth penalty.tensor.smooth |
| Low-level Functions to generate draws from the posterior distribution of model coefficients | generate_draws generate_draws.gam post_draws post_draws.default |
| Draw samples from the posterior distribution of an estimated model | posterior_samples posterior_samples.gam posterior_samples.scam |
| Draw new response values from the conditional distribution of the response | predicted_samples predicted_samples.default predicted_samples.gam predicted_samples.scam |
| Quantile-quantile plot of model residuals | qq_plot qq_plot.default qq_plot.gam qq_plot.glm qq_plot.lm |
| Randomised residuals | quantile_residuals quantile_residuals.gam quantile_residuals.glm |
| Return the reference or specific level of a factor | level ref_level |
| Reference simulation data | ref_sims |
| Repeat the first level of a factor n times | rep_first_factor_value |
| Histogram of model residuals | residuals_hist_plot |
| Plot of residuals versus linear predictor values | residuals_linpred_plot |
| Derivatives on the response scale from an estimated GAM | response_derivatives response_derivatives.default response_derivatives.gam response_derivatives.gamm response_derivatives.scam |
| Rootograms to assess goodness of model fit | rootogram rootogram.gam |
| Simulator for tweedie LSS models | rtw |
| Default diverging red-blue colour palette for partial effects | scale_fill_partial_effect |
| Create a sequence of evenly-spaced values adjusted to accommodate a small adjustment | seq_min_max_eps |
| Shift numeric values in a data frame by an amount 'eps' | shift_values |
| Simulate from the posterior distribution of a GAM | simulate.gam simulate.gamm simulate.scam |
| Lead-210 age-depth measurements for Small Water | smallAges |
| Indices of the parametric terms for a particular smooth | smooth_coef_indices |
| Coefficients for a particular smooth | smooth_coefs smooth_coefs.bam smooth_coefs.gam smooth_coefs.gamm smooth_coefs.gamm4 smooth_coefs.list smooth_coefs.mgcv.smooth smooth_coefs.scam |
| Generate regular data over the covariates of a smooth | smooth_data |
| Dimension of a smooth | smooth_dim smooth_dim.gam smooth_dim.gamm smooth_dim.mgcv.smooth |
| Evaluate smooths at covariate values | smooth_estimates smooth_estimates.gam |
| Extract the label for a smooth used by 'mgcv' | smooth_label smooth_label.gam smooth_label.mgcv.smooth |
| Posterior draws for individual smooths | smooth_samples smooth_samples.gam |
| List the variables involved in smooths | smooth_terms |
| Determine the type of smooth and return it n a human readable form | smooth_type smooth_type.Bspline.smooth smooth_type.cpspline.smooth smooth_type.cr.smooth smooth_type.cs.smooth smooth_type.cv.smooth smooth_type.cx.smooth smooth_type.cyclic.smooth smooth_type.default smooth_type.duchon.spline smooth_type.fs.interaction smooth_type.gp.smooth smooth_type.mdcv.smooth smooth_type.mdcx.smooth smooth_type.micv.smooth smooth_type.micx.smooth smooth_type.mifo.smooth smooth_type.miso.smooth smooth_type.mpd.smooth smooth_type.mpi.smooth smooth_type.mrf.smooth smooth_type.pspline.smooth smooth_type.random.effect smooth_type.sf smooth_type.soap.film smooth_type.sos.smooth smooth_type.sw smooth_type.sz.interaction smooth_type.t2.smooth smooth_type.tensor.smooth smooth_type.tprs.smooth smooth_type.ts.smooth |
| Names of smooths in a GAM | smooths smooths.default smooths.gamm smooths.gamm4 |
| Evaluate a spline at provided covariate values | spline_values |
| Extract names of all variables needed to fit a GAM or a smooth | term_names term_names.gam term_names.gamm term_names.mgcv.smooth |
| Names of variables involved in a specified model term | term_variables term_variables.bam term_variables.gam term_variables.terms |
| General extractor for additional parameters in mgcv models | theta theta.family theta.gam |
| A tidy basis representation of a smooth object | tidy_basis |
| Sets the elements of vector to 'NA' | to_na |
| Exclude values that lie too far from the support of data | too_far |
| Set rows of data to 'NA' if the lie too far from a reference set of values | too_far_to_na |
| Transform estimated values and confidence intervals by applying a function | transform_fun transform_fun.evaluated_parametric_term transform_fun.mgcv_smooth transform_fun.parametric_effects transform_fun.smooth_estimates transform_fun.smooth_samples transform_fun.tbl_df |
| Typical values of model covariates | typical_values typical_values.data.frame typical_values.gam |
| Handle user-supplied posterior draws | user_draws user_draws.gam |
| Variance components of smooths from smoothness estimates | variance_comp variance_comp.gam |
| Returns names of variables from a smooth label | vars_from_label |
| Identify a smooth term by its label | which_smooths which_smooths.bam which_smooths.default which_smooths.gam which_smooths.gamm |
| Worm plot of model residuals | worm_plot worm_plot.gam worm_plot.glm worm_plot.lm |
| Madison lakes zooplankton data | zooplankton |
