When I am showing off a plotting technique in
ggplot2, I sometimes like to include
the R code that produced the plot as part of the plot. Here is an
example I made to demonstrate the debug parameter in
element_text():
library(ggplot2)
self_document(
...
I recently developed and released an R package called
solarizeddocx. It provides solarizeddocx::document(), an
RMarkdown output format for
solarized-highlighted Microsoft Word documents . The image below
shows a comparison of the solarizeddocx and the ...
On one of the Slacks I browse, someone asked how to de-identify a
column of participant IDs. The original dataset was a wait list, so
the ordering of IDs itself was a sensitive feature of the data and we
need to scramble the order of IDs produced.
For... [Read more...]
A few weeks ago, I had a bad debugging session. The code was just not
doing what I expected, and I went down a lot of deadends trying to fix
or simplify things. I could not get the problem to happen in a
reproducible example (reprex) or
interactively (in RStudio). ...
In a previous post, I used simulations
to estimate how long it would take to collect the unique Unowns in
Pokemon Go! The message of the post was that we can use simulations
to solve problems when the analytic solution is not clear or obvious.
The curr...
In programming languages, we find logical operators for and
and or. In fact, Python uses the actual words and and or
for these operators.
# Python via the reticulate package
x = True
y = False
x and y
#__ False
x or y
#__ True
In Javascript, we ... [Read more...]
For a long time, I’ve been curious about something. It is a truth I’ve
seen casually dropped in textbooks, package documentation, and tweets:
random effects and penalized smoothing splines are the same thing.
It sounds so profound and enlightened. Wha...
I am going to describe my favorite knitr trick: Using lists to simplify inline reporting. Trick might not do it justice. I consider this a best practice for working with knitr.
Plug it in
Inline reporting lets you insert R expressions inside of
markd... [Read more...]
One of the things I have come to appreciate is how programming is a great way to
learn statistics. My eyes will glaze over at a series of equations in a
derivation, but ask me to program the procedure and I’ll never forget how it works.
This post will ...
In my last post, I walked through
an intuition-building visualization I created to describe mixed-effects models
for a nonspecialist audience. For that presentation, I also created an analogous
visualization to introduce Bayes’ Theorem, so here I will walk through that
figure..
As in the earlier post, let’s start by ...
Last week, I presented an analysis on the longitudinal development of
intelligibility in children with cerebral palsy—that is, how well do strangers
understand these children’s speech from 2 to 8 years old. My analysis used a
Bayesian nonlinear mixed effects Beta regression model. If some models are livestock and some ...
I am happy to announce the release of ICC Bot, an app for computing
interrater reliability scores using the intraclass correlation coefficient
(ICC).
A screenshot of ICC Bot, an interactive app for computing intraclass correlation coefficients.
The ICC statistic appears in repeated measures or multilevel modeling
literature as a way ...
In this post, I walk through the code I used to make a nice diagram illustrating
the parameters in a logistic growth curve. I made this figure for a conference
submission. I had a tight word limit (600 words) and a complicated
statistical method (Bayesian nonlinear mixed effects beta regression), so ...
Here’s the problem: I have some data with nested time series. Lots of them. It’s
like there’s many, many little datasets inside my data. There are too many
groups to plot all of the time series at once, so I just want to preview a
handful of ...
There is a celebrated Commodore 64 program that randomly prints outs / and \
characters and fills the screen with neat-looking maze designs. It is just one
line of code, but there is a whole book written about
it.
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
Screenshots of the 10 PRINT program in action. Images taken from the 10 PRINT book.
...
At the end of March, Jonah Gabry and I released
bayesplot 1.5.0. The major additions
to the package were visualizations using ridgelines and a new plot for PIT
diagnostics from LOO validation. I don’t know what that LOO PIT thing is yet, so
I’ll ta...
Do you ever have to recode many values at once? It’s a frequent chore when
preparing data. For example, suppose we had to replace state abbreviations
with the full names:
abbs [Read more...]
I recently completed all 25 days of Advent of Code 2017, an annual
series of recreational programming puzzles. Each day describes a programming
puzzle and illustrates a handful of simple examples of the problem. The puzzle
then requires the participant to solve a much, much larger form of the problem.
For five ... [Read more...]
Last week at Thanksgiving, my family drew names from a hat for our annual game
of Secret Santa. Actually, it wasn’t a hat but you know what I mean. (Now that I
think about it, I don’t think I’ve ever seen names drawn from a literal hat
... [Read more...]
Recently, I joined the development team for
bayesplot, an R package by the Stan team for
plotting Bayesian models. Because visualizing Bayesian models in ggplot2 is a
recurring
topic
here, it was a natural fit. So from time to
time, I’ll post about some programming techniques and new features ...