R

Customer Lifetime Value in R: A Third of Your Best Customers Have Already Left

On the CDNOW panel, with a real 39 week holdout as ground truth, a Pareto/NBD model flags 32 percent of the top decile by historical spend as probably inactive. The median flagged customer then buys nothing at all, against a median of 130 for the rest of the decile. Extrapolating repeat spending overstates the holdout by 35 percent and the model undershoots it by 16, so the level is not where the argument is strongest. Fitted in R with CLVTools, with a bootstrap confidence interval computed in Python.

Synthetic Respondents in Conjoint Analysis: The Average Survives, the Price Does Not

LLM synthetic respondents are known to produce response distributions that are too narrow. Nobody writes down what that costs you. Running a conjoint through a mixed logit and into a market simulator, a panel with correct mean price sensitivity and compressed heterogeneity reproduced the human holdout choice shares almost exactly, then set the revenue-maximizing price 26% too low and sized the premium segment at less than half its true value. Simulated in R with logitr, cross-checked in Python by Gauss-Hermite quadrature.

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.