gratia version 0.7.2 is released and on CRAN #157
gavinsimpson
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
gratia 0.7.2 is available and on CRAN
Following the release of version 0.7.0, a couple of annoying bugs were identified which necessitated a patch release. I had implemented methods to plot partial effects for 3d and 4d smooths so decided to include these early enhancements in the patch release to try to shake out any bugs or problems with the implementation prior to a more substantial point (0.8.0) release later in the year (planned for September 2022 at the latest as gratia is needed for a GAM course). Similarly, the problem that delayed 0.7.1 (below) meant that a new plotting method to handle splines on the sphere snuck in to the release, for the same reasons as handling >2d smooths.
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.
While binaries for Windows and MacOS X systems are being built, you can install version 0.7.2 from R Universe: https://gavinsimpson.r-universe.dev/ui#builds
New features
draw.gam()
anddraw.smooth_estimates()
can now handle splines on the sphere (s(lat, long, bs = "sos")
) with special plotting methods usingggplot2::coord_map()
to handle the projection to spherical coordinates. An orthographic projection is used by default, with an essentially arbitrary (and northern hemisphere-centric) default for the orientation of the view.draw.gam()
anddraw.smooth_estimates()
: {gratia} can now handle smooths of 3 or 4 covariates when plotting. As an example of what is possible, the figure below shows the estimated smooths fromy ~ s(x,z) + s(year, bs = "cr") + ti(x,z, year, d = c(2,1), bs = c("tp", "cr"))
for a space-time GAM modelling shrimp abundance. The layout has been tweaked a little (via thedesign
argument topatchwork::plot_layout()
) from the default you get withdraw.gam()
but otherwise it is unchanged.For smooths of 3 covariates, the third covariate is handled with
ggplot2::facet_wrap()
and a set (defaultn
= 16) of small multiples is drawn, each a 2d surface evaluated at the specified value of the third covariate. For smooths of 4 covariates,ggplot2::facet_grid()
is used to draw the small multiples, with the default producing 4 rows by 4 columns of plots at the specific values of the third and fourth covariates. The number of small multiples produced is controlled by new argumentsn_3d
(default =n_3d = 16
) andn_4d
(defaultn_4d = 4
, yieldingn_4d * n_4d
= 16 facets) respectively.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 reducen
to a smaller value:n = 50
is a reasonable compromise of resolution and speed.model_concurvity()
returns concurvity measures frommgcv::concurvity()
for estimated GAMs in a tidy format. The synonymconcrvity()
[sic] is also provided. Adraw()
method is provided which produces a bar plot or a heatmap of the concurvity values depending on whether the overall concurvity of each smooth or the pairwise concurvity of each smooth in the model is requested.fitted_values()
insures thatdata
(and hence the returned object) is a tibble rather than a common or garden data frame.draw.gam()
gains argumentresid_col = "steelblue3"
that allows the colour of the partial residuals (if plotted) to be changed.Bug fixes
draw.posterior_smooths()
was redundantly plotting duplicate data in the rug plot. Now only the unique set of covariate values are used for drawing the rug.data_sim()
was not passing thescale
argument in the bivariate example setting ("eg2"
).draw()
methods forgamm()
andgamm4::gamm4()
fits were not passing arguments on todraw.gam()
.draw.smooth_estimates()
would produce a subtitle with data for a continuous by smooth as if it were a factor by smooth. Now the subtitle only contains the name of the continuous by variable.model_edf()
was not using thetype
argument. As a result it only ever returned the default EDF type.add_constant()
methods weren't applying the constant to all the required variables.draw.gam()
,draw.parametric_effects()
now actually work for a model with only parametric effects.draw
fails for models with no smoothing #142 Reported by @Nelson-Gonparametric_effects()
would fail for a model with only parametric terms becausepredict.gam()
returns empty arrays when passedexclude = character(0)
.This discussion was created from the release gratia version 0.7.2 is released and on CRAN.
Beta Was this translation helpful? Give feedback.
All reactions