NEWS.md

gratia (development version)

Bug fixes

gratia 0.9.0

Breaking changes

The axes on plots created with coord_map() never really worked correctly and changing the angle of the tick labels never worked. As coord_map() is superseded, it didn't receive the updates to the guides system and a side effect of these changes, the code that plotted SOS smooths was producing a warning with the release of ggplot2 version 3.5.0.

The projection settings used to draw SOS smooths was previously controlled via arguments projection and orientation. These arguments do not affect ggplot2::coord_sf(), Instead the projection used is controlled through new argument crs, which takes a PROJ string detailing the projection to use or an integer that refers to a known coordinate reference system (CRS). The default projection used is +proj=ortho +lat_0=20 +lon_0=XX where XX is the mean of the longitude coordinates of the data points.

Defunct and deprecated functions and arguments

Defunct

Deprecated functions

The following functions were deprecated in version 0.9.0 of gratia. They will eventually be removed from the package as part of a clean up ahead of an eventual 1.0.0 release. These functions will become defunct by version 0.11.0 or 1.0.0, whichever is released soonest.

Deprecated arguments

To make functions in the package more consistent, the arguments select, term, and smooth are all used for the same thing and hence the latter two have been deprecated in favour of select. If a deprecated argument is used, a warning will be issued but the value assigned to the argument will be assigned to select and the function will continue.

User visible changes

Note, however, that using per-smooth RNG calls with method = "mh" will be very inefficient as, with that method, posterior draws for all coefficients in the model are sampled at once. So, only use rng_per_smooth = TRUE with method = "gaussian".

This also affects draw.gam().

New features

draw.smooth_estimates() can now also group factor by smooths for a given factor into a single panel.

For example, in te(z, x, y, bs = c(cr, ds), d = c(1, 2)), the second marginal smooth is a 2D Duchon spline of covariates x and y. Previously, smooth_estimates() would have generated n values each for z and x and n_3d values for y, and then evaluated the tensor product at all combinations of those generated values. This would ignore the structure implicit in the tensor product, where we are likely to want to know how the surface estimated by the Duchon spline of x and y smoothly varies with z. Previously smooth_estimates() would generate surfaces of z and x, varying by y. Now, smooth_estimates() correctly identifies that one of the marginal smooths of the tensor product is a 2D surface and will focus on that surface varying with the other terms in the tensor product.

This improved behaviour is needed because in some bam() models it is not always possible to do the obvious thing and reorder the smooths when defining the tensor product to be te(x, y, z, bs = c(ds, cr), d = c(2, 1)). When discrete = TRUE is used with bam() the terms in the tensor product may get rearranged during model setup for maximum efficiency (See Details in ?mgcv::bam).

Additionally, draw.gam() now also works the same way.

Bug fixes

link() and inv_link() now work correctly for the betar() family in a fitted GAM.

gratia 0.8.2

gratia 0.8.1

User visible changes

New features

Bug fixes

gratia 0.8.0

User visible changes

Note that due to the way ... is handled in R, if your R script uses the data argument, and is run with versions of gratia prior to 8.0 (when released; 0.7.3.8 if using the development version) the user-supplied data will be silently ignored. As such, scripts using data should check that the installed version of gratia is >= 0.8 and package developers should update to depend on versions >= 0.8 by using gratia (>= 0.8) in DESCRIPTION.

New features

This implements the main wish of #108 (@dinga92) and #143 (@mbolyanatz) despite my protestations that this was complicated in some cases (it isn't; the complexity just cancels out.)

Data slices are now produced by passing name = value pairs for the variables and their values that you want to appear in the slice. For example

m <- gam(y ~ s(x1) + x2 + fac) data_slice(model, x1 = evenly(x1, n = 100), x2 = mean(x2))

The value in the pair can be an expression that will be looked up (evaluated) in the data argument or the model frame of the fitted model (the default). In the above example, the resulting slice will be a data frame of 100 observations, comprising x1, which is a vector of 100 values spread evenly over the range of x1, a constant value of the mean of x2 for the x2 variable, and a constant factor level, the model class of fac, for the fac variable of the model.

There is also a new draw.basis() method for plotting the results of a call to basis(). This method can now also handle bivariate bases.

tidy_basis() is a lower level function that does the heavy lifting in basis(), and is now exported. tidy_basis() returns a tidy representation of a basis supplied as an object inheriting from class "mgcv.smooth". These objects are returned in the $smooth component of a fitted GAM(M) model.

Bug fixes

gratia 0.7.3

User visible changes

New features

Bug fixes

gratia 0.7.2

New features

Bug fixes

gratia 0.7.1

Due to an issue with the size of the package source tarball, which wasn't discovered until after submission to CRAN, 0.7.1 was never released.

New features

This only affects plotting; smooth_estimates() has been able to handle smooths of any number of covariates for a while.

When handling higher-dimensional smooths, actually drawing the plots on the default device can be slow, especially with the default value of n = 100 (which for 3D or 4D smooths would result in 160,000 data points being plotted). As such it is recommended that you reduce n to a smaller value: n = 50 is a reasonable compromise of resolution and speed.

Bug fixes

gratia 0.7.0

Major changes

Similarly, evaluate_parametric_terms() is now deprecated in favour of parametric_effects(), which is also used internally by draw.gam() if parametric terms are present in the model (and parametric = TRUE).

While a lot of code has been reused so differences between plots as a result of this change should be minimal, some corner cases may have been missed. File an Issue if you notice something that has changed that you think shouldn't.

Deprecated functions

From version 0.7.0, the following functions are considered deprecated and their use is discouraged:

The first call to one of these functions will generate a warning, pointing to the newer, alternative, function. It is safe to ignore these warnings, but these deprecated functions will no longer receive updates and are thus at risk of being removed from the package at some future date. The newer alternatives can handle more types of models and smooths, especially so in the case of smooth_estimates().

New features

Note that this function returns expected values of the response. Hence, "fitted values" is used instead of "predictions" in the case of new covariate values to differentiate these values from the case of generating new response values from a fitted model.

In addition, the rugs on plots of factor by smooths now show the locations of covariate values for the specific level of the factor and not over all levels. This better reflects what data were used to estimate the smooth, even though the basis for each smooth was set up using all of the covariate locations.

Bug fixes

gratia 0.6.0

Major changes

Typically, you can simply delete the align or axis arguments and {patchwork} will just work and align plots nicely. Any arguments passed via ... to cowplot::plot_grid() will just be ignored by patchwork::wrap_plots() unless those passed arguments match any of the arguments of patchwork::wrap_plots().

New features

worm_plot() methods are available for models of classes "gam", "glm", and "lm". (#62)

This feature is a bit experimental; the returned object uses nested lists and may change in the future if users find this confusing.

User visible changes

Bug fixes

gratia 0.5.1

New features

A draw() method is provided, which represents the penalty matrix as a heatmap.

User visible changes

gratia 0.5.0

New features

Wish of #76 (@noamross)

Also, new function add_partial_residuals() can be used to add the partial residuals to data frames.

The user can pass scales via arguments discrete_colour and continuous_fill.

Wish of #74 (@hgoldspiel)

Part of wish of Wish of #79.

User visible changes

The default behaviour remains unchanged however; if parm is NULL then all smooths are evaluated and returned with confidence intervals.

Bug Fixes

This also fixes #80 (@butellyn) which was a related issue with selecting a specific smooth.

gratia 0.4.1

User visible changes

Reported by @StefanoMezzini #73

Bug fixes

Reported by @StefanoMezzini #73

gratia 0.4.0

New features

This change 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.

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.

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

User visible changes

Bug fixes

gratia 0.3.1

New features

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

Bug fixes

gratia 0.3.0

New features

Bug fixes



gavinsimpson/gratia documentation built on April 13, 2024, 10:56 p.m.