Notes

Notes-to-self and other noodlings.

2026

First note This is a short test note.

2025

A leave-one-out apply helper I had to compare how each listener differed from the mean of the other listeners,...

Bits and pieces This entry collects some quick quotes and links.

Computing the mean of the logit-normal with Stan's integrate_1d() Here is a quick note on using Stan to compute a 1-dimension integral.

Positron notes Getting up and running with R is pretty straightforward: install R, install RStudio, install packages...

Three meanings of weights in statistics There are three different meanings of “weights” in statistics explains Thomas Lumley: Precision/analytic weights, frequency...

Resuming a renv project without restoring the environment Steps for resuming a renv project when you don’t care about restoring the previous package...

Selecting models from lists and running anova() I was making a notebook with a list of related models, like

Model condition number and kappa() A colleague got the following warning when fitting a regression model in Python:

Confidence interval overlap and p-values Two 95% confidence intervals can overlap and still have a statistically significant difference at p...

Don’t compare discrete and continuous models with AIC Don’t use AIC to compare a discrete and a continuous model says Thomas Lumley. “The...

sweep() demo sweep(data, margin, stats, fun) is a goofy function for adjusting cols or rows. For example,...

'A random variable is not random and not a variable' “A random variable is not random and not a variable”. Yep, it’s a random number...

Log-likelihood functions These two ways of computing the log-likelihood (an automatic way and naive way) differ because...

Use GAMs for assessing nonlinearity of effects A Data Colada post describes a problem and one proposed solution: how to assess a...

Bits and pieces This entry collects some quick links and tips.

2024

local_ and with_ symmetry in withr I was reading the withr 3.0.0 release notes and noticed a pleasing symmetry the with_...

Helper functions for vector indexing and manipulation Here are some pipe-friendly functions I made during an Advent of Code run. When I...

targets + crew for parallel builds In targets, by default, targets are dispatched to be built one at a time, but...

Making targets handle large bootstrap workflows Here is a summary of how I got targets to handle a bunch of bootstrapping:...

Sentence similarity with dot product and cosine similarity I read an article I had bookmarked for a while. Suppose you have word embedding...

How to write an 'iterative' recursive function I revisited SICP during the Christmas break. I don’t know why this stuck out to...

The pipe placeholder works better now Andrew Heiss pointed out to me that the placeholder since 4.3.0 is a lot better....

purrr::pluck() accepts accessor functions purrr::pluck() is better than I had realized. ?purrr::pluck():

Simulation for a probability paradox This paradox is a flavor of the Sleeping Beauty paradox or the Boy or Girl...

A null-safe map() function I got sick of writing null-guard clauses like:

Mutual recursion and Tailcall() in R I toyed with the experimental Tailcall() feature in R-devel. I can’t actually run this code...

MFA installation: do not change the conda solver My colleague and I independently ran into an issue where the Montreal Forced Aligner installation...

A custom knitr engine for blockquotes Here’s how easy it is to create a knitr language engine:

2023

Gompertz functions and parameterization The Gompertz function “describes growth as being slowest at the start and end of a...

2022

Using DuckDB with dplyr to query control files duckdb is awesome. I used it in a project to read in all of control...

Windows Terminal settings for Miniconda Here is how to add the Miniconda prompt to Windows Terminal. Analogous steps probably will...

The BIC I was wondering about the so-called Bayesian information criterion (BIC) today. What’s the deal with...

Getting downlit to work on notebook HTML notestar, which I use to create project notebooks, produces an HTML file. I can then...