Moving Average in R, tidyverse

Problem Given some dataset, you might want to find the rolling or moving average. We can visualize this in a sample dataset as follows. Note, the k-lag moving average we want, MA-k, is the mean of the last k observations in time, including the current one. # A tibble: 48...

Read more

Build a Neural Network with Julia

Audience If you’re reading this, I assume you are already motivated to learn how a neural network actually works. They are relevant and powerful tools, so the sell shouldn’t be too difficult anyway. There are many other excellent guides out there that I will link to below. If you find...

Read more

Replicate STATA Robust Errors

Overview In STATA, it’s good practice to estimate your OLS model with “robust” standard errors. For example, in STATA you type: reg y x1 x2, r And magic happens. As it turns out, it’s not complete magic - it’s math. This post will recreate the robust standard error calculation using...

Read more



A blog on data, prediction, and causal inference.