Gavin Simpson's Avatar

Gavin Simpson

@gsimpson.bsky.social

(Palaeo)[ecologist | limnologist] & #fakeStatistican, #rstats user, wielder of #GAMs. He/him/his. Opinions mine…

2,552 Followers  |  682 Following  |  98 Posts  |  Joined: 26.08.2023  |  1.9752

Latest posts by gsimpson.bsky.social on Bluesky

I have very fond memories of feeding the giraffe there; have fun enjoying Nairobi (taking breakfast at the national park at dawn, in one of the picnic / viewpoints on the high ground overlooking the rest of the park was a real treat, as was the elephant orphanage)

06.10.2025 17:39 — 👍 1    🔁 0    💬 0    📌 0
Preview
GitHub - gavinsimpson/physalia-gam-course: Generalized Additive Models; a data-driven approach to estimating regression models Generalized Additive Models; a data-driven approach to estimating regression models - gavinsimpson/physalia-gam-course

If you want to check out the examples from the Physalia course, the materials from the last running are available on GitHub

github.com/gavinsimpson...

29.09.2025 08:26 — 👍 1    🔁 0    💬 1    📌 0

I’d be happy to add/use a psych example or two if you have suggestions for papers or analyses where the data are open?

29.09.2025 08:23 — 👍 2    🔁 0    💬 1    📌 0

As I’m a geographer by PhD working in ecology, environmental science, and now animal science, the examples tend towards the natural and life sciences, but they are quite varied so attendees from a wide array of backgrounds usually find them relatable.

29.09.2025 08:23 — 👍 3    🔁 0    💬 1    📌 0

I’ll be running a 3-day one at AU Viborg (about an hour from Aarhus, Denmark) June 9th through 11th that is in person. Dates are TBC but registration should be open in the next couple of weeks

I’m also running an online one with @physaliacourses.bsky.social in December this year.

27.09.2025 08:01 — 👍 3    🔁 1    💬 1    📌 0

The Pink Book of #MarginalEffects (aka Model to Meaning) ships next week and I've got a backlog of Zoolander memes.

Hope you're hungry for some spam in your timeline.

#RStats #PyData

22.09.2025 16:52 — 👍 90    🔁 18    💬 1    📌 3
37  Performance – Model to Meaning

The new {marginaleffects} release for #RStats (0.30.0) comes with two new vignettes:

1. Speed up computation with automatic differentiation (often 10x gains) marginaleffects.com/bonus/perfor...

2. Power analyses with {marginaleffects} and {DeclareDesign}. marginaleffects.com/bonus/power....

13.09.2025 18:37 — 👍 145    🔁 34    💬 3    📌 3

We're glad to finally bring you this update!

11.09.2025 12:02 — 👍 28    🔁 3    💬 1    📌 0

Congratulations Thomas; I know this release hasn’t been an easy one

11.09.2025 14:36 — 👍 5    🔁 0    💬 0    📌 0
Preview
ggplot2 4.0.0 A new major version of ggplot2 has been released on CRAN. Find out what is new here.

I am beyond excited to announce that ggplot2 4.0.0 has just landed on CRAN.

It's not every day we have a new major #ggplot2 release but it is a fitting 18 year birthday present for the package.

Get an overview of the release in this blog post and be on the lookout for more in-depth posts #rstats

11.09.2025 11:20 — 👍 847    🔁 282    💬 9    📌 51

😱

10.09.2025 18:17 — 👍 1    🔁 0    💬 0    📌 0

It is also usually an example inappropriate calculation-first-estimation-second when we should be doing things the other way round; estimate model then calculate differences/ratios from the model, not the data

06.09.2025 17:14 — 👍 1    🔁 0    💬 0    📌 0

If you’d like to go beyond updates and truly master GAMs in R, join our online course with @gsimpson.bsky.social, 8–11 Dec.

📊 Learn how to fit, interpret, visualise, and communicate GAMs in practice, guided by one of the leading experts in the field.
www.physalia-courses.org/courses-work...

02.09.2025 13:42 — 👍 2    🔁 1    💬 0    📌 0
Preview
Changelog

🐛 A couple of bugs squashed along the way.

📄 Full changelog: gavinsimpson.github.io/gratia/news/...

25.08.2025 12:25 — 👍 2    🔁 0    💬 0    📌 0

🛠️ partial_derivatives() improvements:

• handles multiple smooths better
• ignores random effect & univariate smooths
• clearer error messages

25.08.2025 12:25 — 👍 2    🔁 0    💬 1    📌 0

📈 quantile_residuals() supports more mgcv 📦 families:

• scat()
• nb()
• betar()
• tw()

25.08.2025 12:25 — 👍 1    🔁 0    💬 1    📌 0

✨ Plots: residuals_hist_plot() (and appraise()) now align histogram bins more sensibly, centering at 0.

25.08.2025 12:25 — 👍 1    🔁 0    💬 1    📌 0

🚀 gratia 0.11.1 is out!
Compatibility with ggplot2 4.0.0 + usability improvements + bug fixes.

#Rstats #mgcv #gam #statistics

25.08.2025 12:25 — 👍 28    🔁 3    💬 1    📌 1

You could try the gamlss2 package next time; it’s a lot quicker than gamlss (it’s a redevelopment of the original by same authors plus others). Only on GitHub at the moment

19.08.2025 15:44 — 👍 1    🔁 1    💬 1    📌 0

X_s being the model matrix for the specific smooth (i.e., the basis functions evaluated at the covariate values) and b_s being the estimates of the basis coefficients for that smooth

19.08.2025 10:29 — 👍 0    🔁 0    💬 0    📌 0

No that I'm aware; adding families to mgcv is tricky if you want all the standard automatic smoothness selection methods as those require many fourth-order derivatives. I think you could get close by adding observation-level random effects with `s(id, bs="re")` with standard binomial()

19.08.2025 07:25 — 👍 0    🔁 0    💬 1    📌 0

Thanks VIncent

19.08.2025 07:22 — 👍 0    🔁 0    💬 0    📌 0

On the latter point, I was re-reading Hastie & Tibshirani's GAM book recently where they restrict plotting the surface to the convex hull of the data, which I could implement as an alternative.

19.08.2025 07:22 — 👍 0    🔁 0    💬 0    📌 0

I evaluate (X_s %*% t(b_s)) the smooth at a grid of points evenly spaced in each marginal covariate, then set to NA any coordinate that lies further than `dist` from a data point when everything is mapped to a unit square to avoid extrapolation too far beyond support of data, like mgcv::plot.gam().

19.08.2025 07:20 — 👍 1    🔁 0    💬 2    📌 0

I also added code to generate probability integral transform (PIT) & quantile residuals for GAMs. Right now I only handle binomial(), poisson(), gaussian(), & Gamma(), but other families can be added simply by writing a function for the CDF (& possible translating from mgcv's parameterisation)

18.08.2025 18:42 — 👍 3    🔁 0    💬 1    📌 0

Many of the changes aren't massive, but have lain the groundwork for things I've been wanting to do for a while but had been putting off. I've completed random number generators for most of the families in *mgcv*; only the Cox PH ones and cnorm, clog, & cpois are left to do - until Simon adds more

18.08.2025 18:42 — 👍 1    🔁 0    💬 1    📌 0
Preview
An R package for working with generalized additive models Graceful 'ggplot'-based graphics and utility functions for working with generalized additive models (GAMs) fitted using the 'mgcv' package.

🚀 gratia 0.11.0 is out!

Now has a paper in JOSS — please cite 📄 doi.org/10.21105/jos...

Experimental parallel processing ⚡

New assemble() for building plots 🎨

Better support for complex families + new diagnostics 🧪

Lots of bug fixes + polish ✨

👉 gavinsimpson.github.io/gratia/

#Rstats

18.08.2025 18:32 — 👍 187    🔁 64    💬 3    📌 1
A spider, hanging from top to bottom of the image. The abdomen is is patterned with a mix of browns, from cream, through tan, to dark brown

A spider, hanging from top to bottom of the image. The abdomen is is patterned with a mix of browns, from cream, through tan, to dark brown

A spider, hanging from top to bottom of the image. The abdomen is is patterned with a mix of browns, from cream, through tan, to dark brown

A spider, hanging from top to bottom of the image. The abdomen is is patterned with a mix of browns, from cream, through tan, to dark brown

A new visitor 🕷️ to our back yard garden 🪴 Not sure what it is yet, but for scale the abdomen is about as large as the end of a human male’s little finger

18.08.2025 17:57 — 👍 5    🔁 0    💬 1    📌 0
4-panel comic. (1) [Person 1 with ponytail flanked by person with short hair and another person speaking into microphone at podium] PERSON 1: In the early 2010s, researchers found that many major scientific results couldn’t be reproduced. (2) PERSON 1: Over a decade into the replication crisis, we wanted to see if today’s studies have become more robust. (3) PERSON 1: Unfortunately, our replication analysis has found exactly the same problems that those 2010s researchers did. (4) [newspaper with image of speakers from previous panels] Headline: Replication Crisis Solved

4-panel comic. (1) [Person 1 with ponytail flanked by person with short hair and another person speaking into microphone at podium] PERSON 1: In the early 2010s, researchers found that many major scientific results couldn’t be reproduced. (2) PERSON 1: Over a decade into the replication crisis, we wanted to see if today’s studies have become more robust. (3) PERSON 1: Unfortunately, our replication analysis has found exactly the same problems that those 2010s researchers did. (4) [newspaper with image of speakers from previous panels] Headline: Replication Crisis Solved

Replication Crisis

xkcd.com/3117/

21.07.2025 23:54 — 👍 4885    🔁 657    💬 28    📌 30
r/AskNYC
u/UmweltUndefined • 3h
Is there anywhere that delivers that will give a discount rate on 65 gallons of milk?

r/AskNYC u/UmweltUndefined • 3h Is there anywhere that delivers that will give a discount rate on 65 gallons of milk?

You WILLL NOT guess what this is about. But I encourage you to try before clicking through for the answer. www.reddit.com/r/AskNYC/s/X...

21.07.2025 21:12 — 👍 1955    🔁 441    💬 195    📌 198

@gsimpson is following 19 prominent accounts