Yuan Blog

「仰望星空 脚踏实地」

Quantifying Cumulative Lift Variance in Time Based Regression

variance decomposition

Problem overview When analyzing a time series experiment (like a geo-experiment), the core logic relies on using historical data to predict what would have happened without the intervention. The ...

Minimum Detectable Effect in Time Series Data

Explain in code and formula

When designing a Time-Based Regression (TBR) in a geo-experiment, the most critical question is: “How much of a change do I need to see to be sure it wasn’t just noise?” This is the Minimum Detect...

Extreme Programming Essentials

5 most important tips

Below I listed the 5 most important “XP” points for my reference during development: Test First (TDD) Write the test before the code. If it doesn’t fail, don’t write the logic. ...

Rewrite A Class In A Third party Package

From Runtime Replacement To Classpath Shadowing

How to Rewrite a Class in a Third-Party Package You can rewrite a class in a third-party package. The strategy you choose depends heavily on your programming language (dynamic vs. static) and the...

Deep Dive: How Google's TBR Matched Markets Algorithm Searches for Treatments and Controls

searching strategies explained

In Causal Impact analysis (specifically Time-Based Regression or TBR), the hardest part isn’t running the regression—it’s designing the experiment. Finding the perfect combination of Treatment loc...

Magic Methods in Python

with examples

Python Magic Methods (Dunder Methods) “Magic methods” (also known as dunder methods, short for “double underscore”) allow you to define how your custom objects behave with built-in Python operatio...

Statistical Inference of Time Series Prediction Intervals in Linear Regression

Understanding the cihw calculation in Time Based Regression

This document breaks down the statistical logic behind the confidence interval half-width (cihw) formula used in TBR analysis. It explains how the code translates standard OLS prediction variance ...

Python Property Decorator

explained with examples

In Python Class, @ decorator with @property is used to implement encapsulation, meaning that methods are disguised as attributes, so that when the user reads or modifies the data, additional check...

tricks_running_notebooks_in_cloud_clusters

env_long run_etc

Cloud clusters hum, notebooks run, and you just wait the work get done. Run notebook in the background Build a new notebook in the same directly of (NOTEBOOK_TO_RUN), and run it! Click Cell...

Power Analysis for ANOVA

Post hoc ANOVA type 2 and type 3 analysis

Beyond the F-Test: Power’s Echo in Post-Hoc Truths Note: Python codes can be found here( power_analysis_python_readingFromExcel.ipynb ) Note: [Anova – Type I/II/III SS explained]( is...