Skip to content

gratia version 0.7.0 now on CRAN

Compare
Choose a tag to compare
@gavinsimpson gavinsimpson released this 07 Feb 17:30

gratia version 0.7.0 released

I am pleased to announce the release of version 0.7.0 of the gratia package. gratia is intended to make working with generalized additive models (GAMs) easier and to facilitate the production of high quality visualizations of estimated smooths and entire models using the ggplot2 package.

Version 0.7.0 of the package represents a significant milestone: the main user-facing and internal functions for evaluating estimated smooths at covariate values have been entirely replaced by new functions written from the ground up to be easier to extend and maintain than the original functions. These new functions are smooth_estimates() and parametric_effects(). Consequently, functions evaluate_smooth() and evaluate_parametric_term() are now soft-deprecated; a warning will be issued upon their first usage to encourage the use of the new functions.

smooth_estimates() and parametric_effects() are more capable and easier to extend than their deprecated forebears. They can return results for multiple smooth or parametric terms in a single call, while the internals allow for new smooth types that require specialist handling to be added without rewriting the main code base or extensive redesigns.

The main user-facing plotting function draw() for fitted GAMs and related models has been rewritten to use smooth_estimates() and parametric_effects(). Some small differences in behaviour may be encountered, but it is expected that previous code using gratia is backward compatible.

In addition to the major changes described above, version 0.7.0 also introduces a ranges of new functions to make the GAM-related aspects of your life a little bit easier.

  • fitted_values() produces fitted or estimated values from the model. These can be on the scale of the link function or the response and a credible interval is provided for the requested coverage on the chosen scale.
  • rootogram() provides rootogram diagnostics, mainly for count-based models (fitted with families poisson(), negbin(), nb(), and gaussian()), but other families may be supported in the future. The draw() method can plot various kinds of rootogram from the results of rootogram().
  • New helper functions typical_values(), factor_combos() and data_combos() for quickly creating data sets for producing predictions from
    fitted models where some of the covariates are fixed at come typical or representative values.
  • edf() extracts the effective degrees of freedom (EDF) of a fitted model or a specific smooth in the model. Various forms for the EDF can be extracted.
  • model_edf() returns the EDF of the overall model. If supplied with multiple models, the EDFs of each model are returned for comparison.

Additional new features and information of bugs fixed can be found in the news.

The package has a new pkgdown website, with search facility: https://gavinsimpson.github.io/gratia/

Finally, I know the documentation available for the package and individual functions isn't anywhere near as good as it could be. I have tried to provide examples for the user-facing functions in the package. In addition, this version of gratia comes with a Getting Started vignette, which shows some of the main functions for working with GAMs with gratia. Development on the package towards version 0.8.0 will have a focus on providing better documentation and additional vignettes to illustrate the range of functionality in the package.