Skip to content

Releases: gavinsimpson/gratia

Version 0.4.1 released to CRAN

29 May 19:20

Choose a tag to compare

Version 0.4.1 of gratia has been released to CRAN. Version 0.4.0 existed for a short while but the release to CRAN was pulled because of a last minute change needed to accommodate v 1.0.0 of dplyr that had gone overlooked in the testing for 0.4.0.

This gave me an opportunity to fix an additional bug (#73) as well.

The full list of changes is reproduced below for version 0.4.1 and 0.4.0.

gratia 0.4.1

User visible changes

  • draw.gam() with scales = "fixed" now applies to all terms that can be
    plotted, including 2d smooths.

    Reported by @StefanoMezzini #73

Bug fixes

  • dplyr::combine() was deprecated. Switch to vctrs::vec_c().

  • draw.gam() with scales = "fixed" wasn't using fixed scales where 2d smooths
    were in the model.

    Reported by @StefanoMezzini #73

gratia 0.4.0

New features

  • draw.gam() can now include partial residuals when drawing univariate smooths.
    Use residuals = TRUE to add partial residuals to each univariate smooth that
    is drawn. This feature is not available for smooths of more than one variable,
    by smooths, or factor-smooth interactions (bs = "fs").

  • The coverage of credible and ocnfidence intervals drawn by draw.gam() can be
    specified via argument ci_level. The default is arbitrarily 0.95 for no
    other reason than (rough) compatibility with plot.gam().

    This chance has had the effect of making the intervals slightly narrower than
    in previous versions of gratia; intervals were drawn at ± 2 ×
    the standard error. The default intervals are now drawn at ± ~1.96
    × the standard error.

  • New function difference_smooth() for computing differences between factor
    smooth interactions. Methods available for gam(), bam(), gamm() and
    gamm4::gamm4(). Also has a draw() method, which can handle differences of
    1D and 2D smooths currently (handling 3D and 4D smooths is planned).

  • New functions add_fitted() and add_residuals() to add fitted values
    (expectations) and model residuals to an existing data frame. Currently methods
    available for objects fitted by gam() and bam().

  • data_sim() is a tidy reimplementation of mgcv::gamSim() with the added
    ability to use sampling distributions other than the Gaussian for all models
    implemented. Currently Gaussian, Poisson, and Bernoulli sampling distributions
    are available.

  • smooth_samples() can handle continuous by variable smooths such as in
    varying coefficient models.

  • link() and inv_link() now work for all families available in mgcv,
    including the location, scale, shape families, and the more specialised
    families described in ?mgcv::family.mgcv.

  • evaluate_smooth(), data_slice(), family(), link(), inv_link() methods
    for models fitted using gamm4() from the gamm4 package.

  • data_slice() can generate data for a 1-d slice (a single variable varying).

  • The colour of the points, reference lines, and simulation band in appraise()
    can now be specified via arguments

    • point_col,
    • point_alpha,
    • ci_col
    • ci_alpha
    • line_col

    These are passed on to qq_plot(), observed_fitted_plot(),
    residuals_linpred_plot(), and residuals_hist_plot(), which also now take
    the new arguments were applicable.

  • Added utility functions is_factor_term() and term_variables() for working
    with models. is_factor_term() identifies is the named term is a factor using
    information from the terms() object of the fitted model. term_variables()
    returns a character vector of variable names that are involved in a model
    term. These are strictly for working with parametric terms in models.

  • appraise() now works for models fitted by glm() and lm(), as do the
    underlying functions it calls, especially qq_plot.

    appraise() also works for models fitted with family gaulss(). Further
    locational scale models and models fitted with extended family functions will
    be supported in upcoming releases.

User visible changes

  • datagen() is now an internal function and is no longer exported. Use
    data_slice() instead.

  • evaluate_parametric_terms() is now much stricter and can only evaluate main
    effect terms, i.e. those whose order, as stored in the terms object of the
    model is 1.

Bug fixes

  • The draw() method for derivatives() was not getting the x-axis label for
    factor by smooths correctly, and instead was using NA for the second and
    subsequent levels of the factor.

  • The datagen() method for class "gam" couldn't possibly have worked for
    anything but the simplest models and would fail even with simple factor by
    smooths. These issues have been fixed, but the behaviour of datagen() has
    changed, and the function is now not intended for use by users.

  • Fixed an issue where in models terms of the form factor1:factor2 were
    incorrectly identified as being numeric parametric terms.
    #68

gratia version 0.3.1

29 Mar 18:32

Choose a tag to compare

This version of gratia was prompted by changes in the upcoming 4.0.0 release of R, which makes changes to the stringsAsFactors default to be FALSE. A number of tests relied inadvertently on the implicit coercion of character vectors to factors and the derivative code made some assumptions about data only contains numeric of factor variables.

New features

In addition, this version of gratia includes new functions for extracting the link functions from models, and has been updated to work with the forthcoming release of the tibble package.

  • New functions link() and inv_link() to access the link function and its
    inverse from fitted models and family functions.

    Methods for classes: "glm", "gam", "bam", "gamm" currently. #58

  • Adds explicit family() methods for objects of classes "gam", "bam", and
    "gamm".

  • derivatives() now handles non-numeric when creating shifted data for finite
    differences. Fixes a problem with stringsAsFactors = FALSE default in R-devel.
    #64

Bug fixes

  • Updated gratia to work with tibble versions >= 3.0

Bug fix release

12 Feb 20:04

Choose a tag to compare

This release fixes a bug in the use of the select argument to draw.gam(), which was resulting in the wrong smooths being plotted.

First CRAN submission of gratia

17 Jan 17:17

Choose a tag to compare

gratia recently reached version 0.2-0 and after some last-minute teething issues related to a new release of the tibble package, gratia was submitted to CRAN.

The package is ready for public release and has been widely tested against a range of estimated models. In particular, the package is now used to support a paper that I've been involved with writing on hierarchical GAMs.