2024
Guide to generating and rendering computational markdown content programmatically with Quarto
Learn how to use `knitr::knit()` in inline chunks to correctly render auto-generated R and markdown content in Quarto documents
Combine the best of RStudio and Visual Studio Code in Posit's new Positron IDE
Calculating the proportion of US state borders that are coastlines
Measuring coastlines is hard and causes fractal paradoxes, but we can use R and {sf} to try!
Calculating birthday probabilities with R instead of math
Probability math is hard. Use brute force simulation to find the probability that a household has a cluster of birthdays.
Visualizing {dplyr}'s mutate(), summarize(), group_by(), and ungroup() with animations
Visually explore how {dplyr}'s more complex core functions work together to wrangle data
Demystifying causal inference estimands: ATE, ATT, and ATU
Explore why we care about the ATE, ATT, and ATU and figure out how to calculate them with observational data
DIY API with Make and {plumber}
Use Make and {plumber} to create your own API and show live data in Quarto with R and Observable JS
2023
How to create separate bibliographies in a Quarto document
Use multibib and Quarto to create separate bibliographies for a document and an appendix
Guide to understanding the intuition behind the Dirichlet distribution
Learn about the Dirichlet distribution and explore how it's just a fancier version of the Beta distribution
Manually generate predicted values for logistic regression with matrix multiplication in R
This is like basic stats stuff, but I can never remember how to do it—here's how to use matrix multiplication to replicate the results of `predict()`
The ultimate practical guide to multilevel multinomial conjoint analysis with R
Learn how to use R, {brms}, {marginaleffects}, and {tidybayes} to analyze discrete choice conjoint data with fully specified hierarchical multilevel multinomial models
How to fill maps with density gradients with R, {ggplot2}, and {sf}
Fix overplotted points on maps by creating bins or filled desntiy gradients using R, {ggplot2}, and {sf}
The ultimate practical guide to conjoint analysis with R
Learn how to use R, {brms}, and {marginaleffects} to analyze conjoint data and find causal and descriptive quantities of interest, both frequentistly and Bayesianly
Road trip analysis! How to use and play with Google Location History in R
Learn how to use R to load and clean and play with all the location history data Google keeps about you and look at some neat plots and tables about our 5,000-mile summer road trip along the way
How to make fancy road trip maps with R and OpenStreetMap
Use R to get geocoded location and routing data from OpenStreetMap and explore our family's impending 5,000 mile road trip around the USA
A guide to Bayesian proportion tests with R and {brms}
Use R, Stan, and {brms} to calculate differences between categorical proportions in a principled Bayesian way
Making Middle Earth maps with R
Explore Tolkien's Middle Earth with R-based GIS tools, including {ggplot2} and {sf}
How old was Aragorn in regular human years?
Use statistical simulation and a hidden table of Númenórean ages from Tolkien's unpublished works to convert Aragorn's Dúnedan years to actual human years
One Simple Trick™ to create inline bibliography entries with Markdown and pandoc
By default, pandoc doesn't include full bibliographic references inline in documents, but with one tweak to a CSL file, you can create syllabus-like lists of citations with full references
How to migrate from BibDesk to Zotero for pandoc-based writing
Tips, tricks, and rationale for converting from a single big BibTeX file to a Zotero database
2022
How to use natural and base 10 log scales in ggplot2
Use the {scales} R package to automatically adjust and format x- and y-axis scales to use log base 10 and natural log values
Marginal and conditional effects for GLMMs with {marginaleffects}
Use the {marginaleffects} package to calculate tricky and nuanced marginal and conditional effects in generalized linear mixed models
A guide to different types of Bayesian posterior distributions and the nuances of posterior_predict, posterior_epred, and posterior_linpred
Quick and easy ways to deal with long labels in ggplot2
Explore different manual and automatic ways to rotate, dodge, recode, break up, and otherwise deal with long axis labels with ggplot2
Define what marginal effects even are, and then explore the subtle differences between average marginal effects, marginal effects at the mean, and marginal effects at representative values with the marginaleffects and emmeans R packages
Create, manipulate, understand, analyze, interpret, and plot Bayesian hurdle regression models (and a custom hurdle Gaussian model!) using R, the tidyverse, emmeans, brms, and Stan
2021
How to create a(n almost) fully Bayesian outcome model with inverse probability weights
Use a posterior distribution of inverse probability weights in a Bayesian outcome model to conduct (nearly) fully Bayesian causal inference with R, brms, and Stan
How to use Bayesian propensity scores and inverse probability weights
For mathematical and philosophical reasons, propensity scores and inverse probability weights don't work in Bayesian inference. But never fear! There's still a way to do it!
A guide to working with country-year panel data and Bayesian multilevel models
How to use multilevel models with R and brms to work with country-year panel data.
How to calculate grand means, conditional group means, and hypothetical group means of posterior predictions from multilevel brms models.
A guide to modeling proportions with Bayesian beta and zero-inflated beta regression models
Everything you ever wanted to know about beta regression! Use R and brms to correctly model proportion data, and learn all about the beta distribution along the way.
Use R to explore the three rules of do-calculus in plain language and derive the backdoor adjustment formula by hand
How to automatically convert TikZ images to SVG (with fonts!) from knitr
Make knitr and R Markdown convert TikZ graphics to font-embedded SVG files when knitting to HTML
Exploring Pamela Jakiela's simple TWFE diagnostics with R
Use R to explore possible biases that come from differential treatment timing in two-way fixed effects (TWFE) regression models
Exploring R² and regression variance with Euler/Venn diagrams
Use Venn diagrams to visualize the proportion of an outcome explained by a regression model
AFC Richmond / Ted Lasso cross stitch pattern
Make your own Ted Lasso AFC Richmond crest cross stitch with a free pattern and an Illustrator template
Hex sticker/logo cross stitch pattern
Make your own data science hex logo cross stitch with a free pattern and an Illustrator template
Bayesian (cross stitch) sampler
Make your own Bayesian cross stitch sampler with a free pattern of Bayes Theorem and the accompanying Illustrator template
Marginal structural models for panel data with GEE and multilevel models
Use R to correctly close backdoor confounding in panel data with marginal structural models and inverse probability weights with both GEE and multilevel models
2020
Use R to close backdoor confounding in panel data with marginal structural models and inverse probability weights for both binary and continuous treatments
Generating inverse probability weights for both binary and continuous treatments
Use R to close backdoor confounding by generating and using inverse probability weights for both binary and continuous treatments
Emergency online teaching resources
List of resources to help teach online as universities rapidly shut down during the COVID-19 pandemic
Ways to close backdoors in DAGs
Use regression, inverse probability weighting, and matching to close confounding backdoors and find causation in observational data
Automatically zip up subdirectories with Make
Use a Makefile to automatically zip up all subdirectories in a given folder while also accounting for dependencies
Create a dynamic dashboard with R, flexdashboard, and Shiny
Use R Markdown, flexdashboard, and Shiny to create a dashboard that automatically loads data from a Google Sheet
2019
Convert Markdown to rich text (with syntax highlighting!) in any macOS app
Create a macOS Automator service to convert Markdown to rich text from any app in macOS
Chidi's budget and utility: doing algebra and calculus with R and yacas
Use algebra and calculus with R and yacas to find Chidi's optimal level of pizza and frozen yogurt consumption given his budget and utility function.
Half a dozen frequentist and Bayesian ways to measure the difference in means in two groups
Learn how to run standard t-tests, simulations, and Bayesian difference in means tests with R and Stan
2018
Tidy text, parts of speech, and unique words in the Qur'an
Use R and parts-of-speech tagging to explore the Qur'an in Arabic
Tidy text, parts of speech, and unique words in the Bible
Use R and parts-of-speech tagging to explore the distinctive features of John
The academic job search finally comes to an end
Explore 2.5 years of applying for academic jobs with fancy data visualization
How to test any hypothesis with the infer package
Use the infer package in R to test any statistical hypothesis through simulation.
Create a cheap, disposable supercomputer with R, DigitalOcean, and future
Use the future R package to run computationally intensive R commands on a cluster of remote computers
Show multiply imputed results in a side-by-side regression table with broom and huxtable
Extend broom's tidy() and glance() to work with lists of multiply imputed regression models
Meld regression output from multiple imputations with tidyverse
Use tidyverse functions to correctly meld and pool multiply imputed model output.
Fun with empirical and function-based derivatives in R
Use R to do things with derivatives, both with actual functions and with existing empirical data.
2017
Working with R, Cairo graphics, custom fonts, and ggplot
The Cairo graphics library makes it easy to embed custom fonts in PDFs and create high resolution PNGs (with either AGG or Cairo).
Create supply and demand economics curves with ggplot2
Use ggplot to create economics-style, non-data-based conceptual graphs.
Quickly play with Polity IV and OECD data (and see the danger of US democracy)
Use ggplot to reproducibly see how much trouble the Polity Project thinks the US is in.
Exploring Minard's 1812 plot with ggplot2
Use ggplot to do fun and fancy things with Minard's famous plot of Napoleon's 1812 retreat from Russia.
Super basic practical guide to Docker and RStudio
Use RStudio inside Docker containers for portable and reproducible development environments.
2016
Save base graphics as pseudo-objects in R
Use pryr to save a series of R commands as a kind of macro you can call repeatedly.
Convert logistic regression standard errors to odds ratios with R
Correctly transform logistic regression standard errors to odds ratios using R
Drone sightings in the US, visualized
See where the FAA has reported hobbyist drone sightings from 2014–2016
Fauxcasts: Use a podcast app to listen to audiobooks
Create a temporary podcast feed of a CD-based audiobook and use a modern podcast app to listen to the book faster and better.
Use LibreOffice Base as a GUI for an SQLite database in OS X
Connect LibreOffice to an SQLite database to take advantage of SQLite’s ubiquitousness and LibreOffice’s form-based GUI.
2013
Toggle the Bluetooth menu item with AppleScript
The OS X Bluetooth menu item re-enables itself every time a device battery gets low. This simple application turns it back off.
True side-by-side page numbers in InDesign
Automatically create side-by-side page numbers for parallel texts or spread numbers in InDesign.
2012
Stop using boring, boilerplate Lorem ipsum filler text and build your own random, semi-coherent text from Project Gutenberg books.
Install R, RStudio, and R Commander in Windows and OS X
R, RStudio, and R Commander are all powerful open source statistical tools, but they can be a little tricky to install. These instructions make it easy to get everything working right.
2011
World-Ready Composer not Perfect
Even though InDesign’s new World-Ready Composer is awesome, it is still buggy and struggles with a few Arabic fonts.
Using Arabic in InDesign CS5 without InDesign ME
Use InDesign CS5‘s hidden World Ready Composer to typeset text in Arabic and other complex scripts.
Fake CloudApp with Dropbox and Quicksilver
Move files to your Dropbox public folder and generate a shareable URL instantly, à la CloudApp, with a combination of a few services and Quicksilver triggers.
Mona Prince on #jan25 Egyptian Protests
Mona Prince's personal account of the #jan25 Egyptian protests
2010
iOS 4, Multitasking, and Battery Life
The multitasking capabilities of iOS 4 seem to be draining my battery. Help me figure out how to stop it!
On February 28, 2010 at the American University in Cairo, Jordan's Queen Rania gave a speech on the importance of civic engagement in the Arab world. While her idea that regular citizens need to be more involved in government, the hardhanded policies of Arab governments make it almost impossible for that to happen.
2009
flashbakectl is a handy little script that starts and stops Flashbake by loading and unloading plist files.
Flashbake-iTunes is a plugin for Flashbake that allows you to include information for the current track in the periodic git commit message.
Using Google Voice and Gizmo Project Together
Description of how to make Google Voice and the Gizmo Project work together with an ATA so that you get a free phone number and almost free phone calls.
Pictures and details of a minor train wreck in Alexandria, Egypt on July 30, 2009.
A detailed, updated tutorial on how to install, use, and customize pdftk-php.php, which combines the power of pdftk and PHP, allowing you to serve dynamic PDF forms from the web.
On narrowing and redefining research
After a year of deliberation, I may have finally decided what to write about for my thesis.
Import a Blogger Blog to InDesign with Perl
This Perl script lets you take a backed-up Blogger XML file and convert it to an InDesign Tagged Text file for book layout.
After almost two years, I've officially developed and released pdftk-php--a script that lets you inject form data into a PDF with PHP.
Traffic in Cairo is horrible, especially when all the taxi drivers, the ubiquitous life-blood of the Egyptian streets, have a deathwish for you.
I got 25 Google Profile business cards for free. Woot!
Typing transliterated Arabic quickly
Use text-replacement software to automate Arabic transliteration.
Libya, obsolete paradigms, and Rip Van Winkle
Lisa Anderson's research of political systems in Libya reveals that standard Middle East Studies paradigms don't fully apply.
Do not succumb to economic stupidity
Listening to NPR's Planet Money economics podcast really does help to understand the current economic crisis.
I finally converted my ancient, inefficient PHP-ish website to a mean, lean, WordPresss running CMS.
2007
Populating a LiveCycle PDF with PHP and MySQL
Tutorial explaining how to populate a LiveCycle PDF form using PHP and MySQL.
Using Arabic in InDesign without InDesign ME
How to use the Glyphs panel in InDesign CS3 to insert Arabic text, despite the lack of support for Arabic.