R

Calibrating a Marketing Mix Model With an Incrementality Test in R: Why the Experiment Loses

The 2026 measurement consensus is triangulation: calibrate the MMM with an incrementality test. On simulated data with a known answer, the recommended recipe moved a badly biased ROI estimate about two thirds of the way to the experiment's answer and then stopped, leaving it 77% above the truth. The prior lost to the likelihood, because a misspecified MMM is confidently wrong. Here is the diagnostic to run before you calibrate anything.

Difference-in-Differences With a Continuous Treatment in R: The Dose Coefficient Is Not Marginal ROI

Put spend on the right-hand side of a fixed effects regression and the coefficient looks like marginal return. On simulated data with randomly assigned dose, it overstates the true marginal return by 31%. Here is why, and how the new contdid package fixes it.

If You Roll Out Market by Market, Your Lift Estimate Is Probably Too Low

The two-way fixed effects regression is the default for staggered geo rollouts. On simulated data where the true lift is known, it understates the effect by 41%. Here is why, and the estimator that fixes it, in R and Python.

Resolving the "expl3.sty" and Format File Mismatch Error in LaTeX (TeX Live/TinyTeX)

If you’re encountering the following LaTeX error when compiling a Bookdown or Quarto PDF document: ! LaTeX Error: Mismatched LaTeX support files detected. (LaTeX) Loading 'expl3.sty' aborted! (LaTeX) The L3 programming layer in the LaTeX format (LaTeX) is dated 2025-03-26, but in your TeX tree the files require (LaTeX) at least 2025-04-14.

Create your own package in R

From .R Files to R Packages: A Game Changer for Empirical Researchers Hello, fellow data enthusiasts! Today, we’re going to embark on a journey that will take us from a scattered mess of .

Adding utteranc.es to blogdown academic hugo theme

After several hours struggling with multiple recommendations by David Fong Salmon Jesus Velez pugillum robb Michele Scipioni I still cannot see my comment section using https://utteranc.es/ I realize I did not have my webpage repo public.

Handle duplicate packages in different paths

If you work with multiple work stations (multiple computers/laptops) sharing the same cloud folder. You might encounter this problem. Your Rstudio in different computers will have different default paths to install and load packages.

Correct Bibtex format

If you work with bookdown, Latex, Python, or anything that uses BibTex as the underlying citation document, you will understand the struggle that sometimes your document cannot be rendered correctly because you might miss a comma, year, or author.

Johnson-Neyman for meta analysis

In applied research, we typically look at moderation effect of a moderator on the relationship between a predictor and an outcome variable. However, looking at the interaction term alone is very misleading.

Setup Java with R

To prevent future problems when using Java, you need to install Java to your machine correctly. Download the correct version of Java from https://www.java.com/en/download/manual.jsp Right-click the Java setup app to “Run as Admin” After installing Java, go to R and let your machine know the right path to Java (Make sure you run R as Admin as well).