visualisation

depictr: One visual language from first look to final figure

Post

Figures often change their visual language as an analysis moves from exploration to reporting. This post uses depictr to examine a simulated lexical-decision experiment, plot its mixed-model estimates, audit a figure and correct the accessibility problems that the audit finds.

Greenhouse gas emissions in context: Raw totals, income groups and human development

Post

Greenhouse gas emissions can be reported as raw totals or per-capita values, each answering a different descriptive question. Using the 2025 release of the Emissions Database for Global Atmospheric Research, the World Bank income classification and the Human Development Index, this post compares totals, per-capita figures, sectors and a descriptive association with human development.

You shall know a word by the company it keeps — so choose your prompts wisely

Post

In 1957, the linguist J. R. Firth observed that ‘you shall know a word by the company it keeps’. The principle that words sharing contexts share meaning underlies generative AI, from early Latent Semantic Analysis to today's largest Transformers. This post traces that lineage with three interactive LSA-to-PCA visualisations in R, built from Reuters newswire, State of the Union addresses and IMDB reviews. They show where simple co-occurrence models succeed and where they fail, and the post explains how scale and the Transformer turned a modest insight into the technology behind ChatGPT. It then examines why LLMs, optimised for fluency, cannot be rid of hallucination entirely, and argues that careful prompt engineering is the best tool we have for steering a fundamentally heuristic machine.

ggplotting power curves from the simr package

Post

A custom R function to create ggplot2 visualizations of power curves generated by the simr package's powerCurve function for mixed-effects models.

How to discretise the colour variable in sjPlot::plot_model into equally-sized intervals

Post

Custom functions that extend sjPlot to discretise continuous variables in interaction plots into equally-sized intervals (deciles or sextiles) that include minimum and maximum values, with legend counts showing sample sizes per level.

How to map more informative values onto fill argument of sjPlot::plot_model

Post

Custom function that extends sjPlot to display original categorical variable values in interaction plot legends instead of transformed values, facilitating clearer communication when using sum-coded or other transformed predictors.

How to visually assess the convergence of a mixed-effects model by plotting various optimizers

Post

A custom R function to create ggplot2 visualizations of fixed effects from models refitted with multiple optimizers using lme4's allFit function, enabling visual assessment of convergence validity in mixed-effects models.

A new function to plot convergence diagnostics from lme4::allFit()

Post

When a model has struggled to find enough information in the data to account for every predictor—especially for every random effect—, convergence warnings appear (Brauer & Curtin, 2018; Singmann & Kellen, 2019). In this article, I review the issue of convergence before presenting a new plotting function in R that facilitates the visualisation of the fixed effects fitted by different optimization algorithms (also dubbed optimizers).

Plotting two-way interactions from mixed-effects models using alias variables

Post

Custom function extending sjPlot that plots interactions between continuous and categorical variables while replacing categorical variables with alias variables to facilitate back-transformation of sum-coded predictors for clearer result communication.

Plotting two-way interactions from mixed-effects models using ten or six bins

Post

Custom functions extending sjPlot for plotting interactions between two continuous variables by dividing one into ten bins (deciles) or six bins (sextiles), with optional sample size display in legend for individual differences research.

Bayesian workflow: Prior determination, predictive checks and sensitivity analyses

Post

This post presents a run-through of a Bayesian workflow in R. The content is closely based on Bernabeu (2022), which was in turn based on lots of other references, also cited here.