RSSAmplifier

Blog

GAMbler

Recent content on GAMbler

ecogambler.netlify.appRSS feed ↗39 posts

Latest posts

Compositional modeling of plant communities with Dirichlet regression

Compositional data, where observations represent proportions that sum to a constant, are ubiquitous in ecology, yet many analysts fall back on problematic approaches like separate binomial models, beta regression on ratios, or worse, standard linear regression on raw proportions. These methods ignore the fundamental constraint that proportions must sum to unity and fail to model the inherent…

Blogroll





 r-bloggers
 
 
 
 R-Bloggers.com is a blog aggregator of content contributed by bloggers who write about R (in English). The site helps R bloggers and users to connect and follow the “R blogosphere” 




 R weekly
 
 
 
 rweekly.org collates useful information from blogs, tutorials and other formats of resources to help the R…

GAMs for Customer Lifetime Value (CLV) prediction

I typically work in quantitative ecology and molecular epidemiology, where we use statistical models to predict species distributions or disease transmission patterns. Recently though, I had an interesting conversation with a data science PhD student who mentioned they were applying GAMs to predict Customer Lifetime Value at a SaaS startup. This caught my attention because CLV prediction, as it…

Why you should embrace ecological forecasting

Automatic forecasting for non-Gaussian time series

Ecological forecasting with R 📦's {mvgam} and {brms}

2025 R Workshops @ UQ

Forecasting species' responses to change

Harnessing the power of ecological forecasting

State-Space Vector Autoregressions in mvgam


 Vector Autoregressions (VAR models) , also known in the ecological literature as 
 Multivariate Autoregressions (MAR models) , are a class of Dynamic Linear Models that offer a principled way to model both delayed and contemporaneous interactions among sets of multiple time series. These models are widely used in econometrics and psychology, among other fields, where they can be analyzed…

Incorporating time-varying seasonality in forecast models

Seasonality is very common in real-world time series. Many series vary in periodic, regular ways. For example, ice cream sales tend to be higher in warmer holiday months, while counts of migratory birds fluctuate strongly around the annual migration cycle. Because of how pervasive seasonality is, many time series and forecasting methods have been developed specifically to deal with this feature.…

Ecological forecasting with R 📦's {mvgam} and {brms}

First release of mvgam(v1.1.0) to CRAN





 Welcoming mvgam to the Comprehensive R Archive Network (CRAN)
 
 
 
 
 
 The goal of mvgam is to use a Bayesian framework to estimate parameters of Dynamic Generalized Additive Models (DGAMs) for time series with dynamic trend components. The package provides an interface to fit Bayesian DGAMs using 
 Stan as the backend, and is particularly suited…

How to interpret and report nonlinear effects from Generalized Additive Models





 What are Generalized Additive Models (GAMs)?
 
 
 
 
 
 Generalized Additive Models (GAMs) are flexible tools that replace one or more predictors in a Generalized Linear Model (GLM) with smooth functions of predictors. These are helpful for learning arbitrarily complex, nonlinear relationships between predictors and conditional responses without needing…

Blog and talk archives

mvgam

The goal of mvgam is to use a Bayesian framework to estimate parameters of Dynamic Generalized Additive Models (DGAMs) for time series with dynamic trend components. The package provides an interface to fit Bayesian DGAMs using either 
 JAGS or 
 Stan as the backend, but note that users are strongly encouraged to opt for Stan over JAGS. The formula syntax is based on that of the package…

Simulating data for model exploration in R





 Purpose
 
 
 
 
 
 The following passage is quoted directly from Regression and other stories (Gelman, Hill and Vehtari 2022). “Simulation of random variables is important in applied statistics for several reasons. First, we use probability models to mimic variation in the world, and the tools of simulation can help us better understand how this…

Using Stan for logistic regressions with detection error





 Required libraries
 
 
 
 
 
 cmdstanr 




 Purpose and model introduction
 
 
 
 
 
 This script simulates binary observations of an imperfectly observed data generating process (i.e. our measurements are made with error). It also provides Stan code for estimating parameters of the model in a Bayesian…

Phylogenetic smoothing using mgcv

I have been highly interested in multivariate time series modeling for the last few years and have spent a lot of time working out how to use hierarchical GAMs to tackle many of the questions I’m interested in. As you may already know, GAMs afford us a huge amount of flexibility to address nonlinear associations in ecological models (
 see this paper by Pedersen et al for some more…

Time series modeling with Bayesian Dynamic Generalized Additive Models

Using Stan to model geostatistical count data with distance matrices





 Required libraries
 
 
 
 
 
 cmdstanr 
 MASS 
 raster 
 ggplot2 
 viridis 




 Purpose and model introduction
 
 
 
 
 
 This script simulates Poisson observations of an underlying spatially autocorrelated data generating process. It also provides Stan code for estimating parameters of the…

Ecological forecasting with dynamic GAMs

Ecological forecasting with dynamic Generalized Additive Models (DGAMs)

Distributed lags (and hierarchical distributed lags) using mgcv and mvgam

Here we will use mgcv to estimate parameters of nonlinear distributed lag models. These models are used to describe simultaneously non-linear and delayed functional relationships between a covariate and a response, and are sometimes referred to as exposure-lag-response models. If we assume \(\tilde{\boldsymbol{y}}_{t}\) is the conditional expectation of a response variable \(\boldsymbol{y}\) at…

Temporal autocorrelation in GAMs and the mvgam package


 Generalized Additive Models (GAMs) are flexible tools that have found particular application in the analysis of time series data. In ecology, a host of recent papers and workshops have drawn attention to the power of GAMs for addressing complex ecological analyses. For example, 
 Gavin Simpson regularly hosts workshops on GAMs in R , and 
 it is common to see GAMs on the…

mrIML

This goal of mrIML is to enable users to build and interpret multivariate machine learning models by harnessing the power and flexibility of the tidyverse (tidy model syntax in particular). This package builds off ideas from Gradient Forests (
 Ellis et al 2012 ), and ecological genomics (
 Fitzpatrick and Keller, 2014 ). 
 This package can be of use for any multi-response machine…

Ascertainment and near-term forecasting of tick paralysis admissions

Rapid winter warming associated with major shifts in coastal fish communities

MRFcov

This goal of MRFcov is to approximate interaction parameters of nodes in undirected Markov Random Fields (MRF) graphical networks. Models can incorporate covariates (a class of models known as Conditional Random Fields; CRFs; following methods developed by 
 Cheng et al 2014 and 
 Lindberg 2016 ), allowing users to estimate how interactions between nodes are predicted to change across…

Netlify

So far, we’ve been leveraging GitHub Pages for publishing. This works great, but for blogdown we’ll start using Netlify. Let’s start RIGHT NOW with a site we’ve already built and published. 




 Pre-requisites
 
 
 
 
 
 Pick either your postcards site, or your distill site from day 01. Refresh your memory- which repository was…

A postcard





 Pre-requisites
 
 
 
 
 
 First, make sure you have the latest version of the postcards package installed from CRAN: 
 install.packages('postcards')
 Restart your R session. If you use RStudio, use the menu item Session > Restart R or the associated keyboard shortcut: 
 
 Ctrl + Shift + F10 (Windows and Linux) or 
 Command + Shift +…

A distill site





 Pre-requisites
 
 
 
 
 
 First, make sure you have the latest version of the distill package installed from CRAN: 
 install.packages("distill")
 
 Restart your R session. If you use RStudio, use the menu item Session > Restart R or the associated keyboard shortcut: 
 
 Ctrl + Shift + F10 (Windows and Linux) or 
 Command + Shift…

Warm woolen mittens

&#xA; Hi, I'm the here-bot cat! &#xA; Use me to find your way in your website. &#xA; &#xA; &#xA; Here I am: &#xA; content/collection\day02\03-blogdown\index.md &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; To remove me, delete this line inside that file: {{< here >}} &#xA; &#xA; &#xA; My content section is: &#xA; collection &#xA; &#xA; &#xA; &#xA; My layout is: &#xA;…

A GitHub profile

&#xA;&#xA;&#xA;&#xA; Profile&#xA; &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; https://docs.github.com/en/github/setting-up-and-managing-your-github-profile/personalizing-your-profile &#xA;&#xA;&#xA;&#xA;&#xA; Pin projects to profile&#xA; &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; https://docs.github.com/en/github/setting-up-and-managing-your-github-profile/pinning-items-to-your-profile &#xA;&#xA;&#xA;&#xA;&#xA;…

Prework

Welcome to the &#xA; Introducing Yourself Online workshop! We look forward to meeting you. Before attending the workshop, please complete the following prework. &#xA;&#xA;&#xA;&#xA;&#xA; Set up RStudio Cloud&#xA; &#xA; &#xA; &#xA; &#xA; &#xA; Sign up for a free RStudio Cloud account at &#xA; https://rstudio.cloud/ before the workshop. I recommend logging in with an existing Google or GitHub…

Using blogdown

&#xA;&#xA;&#xA;&#xA; Pre-requisites&#xA; &#xA; &#xA; &#xA; &#xA; &#xA; First, make sure you have the latest version of the blogdown package installed from CRAN: &#xA; install.packages('blogdoown')&#xA; Restart your R session. If you use RStudio, use the menu item Session > Restart R or the associated keyboard shortcut: &#xA; &#xA; Ctrl + Shift + F10 (Windows and Linux) or &#xA; Command + Shift +…

Typography Styles & Element Examples

&#xA; &#xA; &#xA; Font Sizes &#xA; &#xA; &#xA; &#xA; &#xA; A &#xA; A &#xA; A &#xA; A &#xA; A &#xA; A &#xA; A &#xA; A &#xA; &#xA; &#xA; 6rem (96px) &#xA; 5rem (80px) &#xA; 3rem (48px) &#xA; 2.25rem (36px) &#xA; 1.5rem (24px) &#xA; 1.25rem (20px) &#xA; 1rem (16px) &#xA; .875rem (14px) &#xA; &#xA; &#xA; &#xA; &#xA; Type Samples &#xA; Head&shy;line &#xA; Sub&shy;head&shy;line &#xA; Level 1 Heading…

Collaborators and mentors

Thank you to the many folks who have made both technical and creative contributions to my work. In no particular order, here are some of them: &#xA; &#xA; &#xA; &#xA; Konstans Wells &#x1f992; (has cosupervised students with me, led grant proposals and been a general quant-ecologist in arms for many years) &#xA; &#xA; &#xA; &#xA; Alison Peel &#x1f987; (has cosupervised students with me, helped me…

License

My &#xA; blog posts are released under a &#xA; Creative Commons Attribution-ShareAlike 4.0 International License . Feel free to share or distribute as you like, but please be kind and give attribution where appropriate. I work hard on these :) &#xA; &#xD;&#xA; &#xD;&#xA;