Novelty and Primacy Effects in A/B Tests: Detect Them in Python

Check whether an A/B test's lift is fading, fit an exponential decay to separate the novelty bump from the lasting effect, and compare new and returning users.

A novelty effect is a lift that fades as users get used to a change, and a primacy effect is the reverse: a dip while users adapt, followed by recovery. To check for either, plot the lift by day since launch instead of looking only at the pooled number. If the daily lift trends, the average over the whole test does not describe what you will get after launch. This post shows how to detect the pattern, estimate the lasting effect with scipy.optimize.curve_fit, and split new from returning users.

Quick Example

This simulates a four-week test on a 10% baseline conversion rate. The treatment has a lasting +1.2 percentage point (pp) lift plus a +3 pp novelty bump that decays with a time constant of 5 days. The code computes the daily lift with 95% intervals, the cumulative lift, and the lift in the first and last weeks.

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

rng = np.random.default_rng(64)

# Sample data: daily conversions per arm
days = np.arange(1, 29)
n = 20_000                     # users per arm per day
base = 0.10
lasting, bump, tau = 0.012, 0.030, 5.0
p_treat = base + lasting + bump * np.exp(-days / tau)
df = pd.DataFrame({
    "day": days,
    "n_control": n, "n_treat": n,
    "conv_control": rng.binomial(n, base, days.size),
    "conv_treat": rng.binomial(n, p_treat),
})
df["rate_c"] = df.conv_control / df.n_control
df["rate_t"] = df.conv_treat / df.n_treat
df["lift"] = df.rate_t - df.rate_c
df["se"] = np.sqrt(df.rate_c * (1 - df.rate_c) / df.n_control + df.rate_t * (1 - df.rate_t) / df.n_treat)


def pooled(sub):
    """Lift and standard error pooled over the days in `sub`."""
    c = sub.conv_control.sum() / sub.n_control.sum()
    t = sub.conv_treat.sum() / sub.n_treat.sum()
    se = np.sqrt(c * (1 - c) / sub.n_control.sum() + t * (1 - t) / sub.n_treat.sum())
    return t - c, se


for label, sub in [("whole test", df), ("first 7 days", df[df.day <= 7]), ("last 7 days", df[df.day > 21])]:
    lift, se = pooled(sub)
    print(f"{label:13s} lift {lift * 100:.2f} pp +/- {1.96 * se * 100:.2f}")

cum_lift = [pooled(df[df.day <= d])[0] for d in df.day]

fig, ax = plt.subplots(figsize=(9, 4.6))
ax.errorbar(df.day, df.lift * 100, yerr=1.96 * df.se * 100, fmt="o", color="#7a4ea3", ecolor="#c8b3dc",
            capsize=2, ms=4, label="Daily lift (95% CI)")
ax.plot(df.day, np.array(cum_lift) * 100, color="#e76f51", lw=2.2, label="Cumulative lift since launch")
ax.axhline(0, color="black", lw=0.8)
ax.axhline(lasting * 100, color="#2a9d8f", ls="--", lw=1.5, label="Lasting lift (true value)")
ax.set_xlabel("Days since launch")
ax.set_ylabel("Conversion lift (percentage points)")
ax.set_title("Daily lift fades while the cumulative number keeps looking good")
ax.legend(loc="upper right")
fig.tight_layout()

Daily conversion lift with 95 percent intervals falling from about 3.3 points on day 1 to about 1.2 points by week three, with a cumulative lift line that falls more slowly and stays above the dashed lasting-lift line

The first week averaged a lift of 2.55 pp (interval ±0.24), and the last week 1.10 pp (±0.23). The whole-test lift is 1.60 pp (±0.12), which is neither number: it blends the bump with the lasting effect. The cumulative line shows the pattern clearly, falling from 2.55 pp at day 7 to 2.03 at day 14 and 1.60 at day 28, still drifting toward the daily values. A test stopped at day 7 would have reported double the lasting lift.

How Do I Know if a Lift Is Fading?

Three checks, from quickest to most formal:

  1. Plot daily (or weekly) lift with intervals. A downward trend that goes beyond the interval width is the signal. Single noisy days (day 27 here) are not.
  2. Compare the first and last windows. The intervals above (2.55 ± 0.24 vs 1.10 ± 0.23) do not overlap.
  3. Fit a model and compare it with a flat line. The next section does this.

Look at the metric by day since each user was first exposed, not by calendar day, when users enter the test at different times. Otherwise late joiners dilute the early effect.

How Do I Estimate the Lasting Effect with a Decay Curve?

Model the daily lift as a lasting part plus a decaying part: lift(day) = L + A * exp(-day / tau). curve_fit with the daily standard errors as sigma gives weighted estimates and uncertainty.

from scipy.optimize import curve_fit


def decay(d, L, A, t):
    return L + A * np.exp(-d / t)


popt, pcov = curve_fit(decay, df.day, df.lift, p0=[0.01, 0.03, 5], sigma=df.se, absolute_sigma=True)
perr = np.sqrt(np.diag(pcov))
print("lasting lift L (pp):", round(popt[0] * 100, 2), "+/-", round(1.96 * perr[0] * 100, 2))
print("novelty size A (pp):", round(popt[1] * 100, 2), "+/-", round(1.96 * perr[1] * 100, 2))
print("decay time tau (days):", round(popt[2], 1), "+/-", round(1.96 * perr[2], 1))

chi_flat = (((df.lift - np.average(df.lift, weights=1 / df.se**2)) / df.se) ** 2).sum()
chi_decay = (((df.lift - decay(df.day, *popt)) / df.se) ** 2).sum()
print(f"chi-square: flat {chi_flat:.1f} on {len(df) - 1} df, decay {chi_decay:.1f} on {len(df) - 3} df")

fig, ax = plt.subplots(figsize=(9, 4.6))
ax.scatter(df.day, df.lift * 100, color="#7a4ea3", s=22, label="Daily lift")
grid = np.linspace(1, 28, 200)
ax.plot(grid, decay(grid, *popt) * 100, color="#1b6ca8", lw=2.4,
        label=f"Fit: {popt[0]*100:.1f} pp + {popt[1]*100:.1f} pp * exp(-day / {popt[2]:.1f})")
ax.axhline(popt[0] * 100, color="#2a9d8f", ls="--", lw=1.5, label=f"Fitted lasting lift: {popt[0]*100:.2f} pp")
ax.set_xlabel("Days since launch")
ax.set_ylabel("Conversion lift (percentage points)")
ax.legend(loc="upper right")
fig.tight_layout()

Scatter of daily lift in percentage points with a fitted exponential decay curve dropping from about 3.5 to a flat line near 1.1, and a dashed line marking the fitted lasting lift

The fit recovers a lasting lift of 1.11 pp (±0.22), a novelty size of 2.82 pp (±0.66), and a time constant of 5.4 days (±2.4). The true values were 1.2, 3.0 and 5.0, so all three intervals cover them. The chi-square statistic for a flat line is 126.1 on 27 degrees of freedom, and only 17.0 on 25 for the decay model, so a constant lift does not fit this data.

Treat the fit as an estimate with a wide time constant, not a precise measurement. With fewer users per day, or a shorter test, the tau interval gets wide and the fit can fail to converge. Assuming an exponential shape is a modeling choice. Real novelty effects can be slower or step-shaped, so check the curve against the points.

What About Primacy Effects?

A primacy effect looks like the mirror image: the lift starts below its eventual level or even negative (users are confused by the change) and climbs. The same tools apply. The decay function above handles it if A comes out negative. Primacy effects tend to hit users with the most habit built up around the old design, so the split by new and returning users below is where they show up.

Do New Users and Returning Users Respond Differently?

Returning users have a baseline expectation to compare against, so they feel the change. New users have no memory of the old design, so they show the effect of the design alone. If the lift is similar for new users from week one, a fading average points to a novelty effect among returning users and not to a change in the product's real value. This simulation builds that scenario in, with a novelty bump only for returning users:

rng2 = np.random.default_rng(65)
nn = 20_000
rows = []
for seg, extra in [("Returning users", 0.030), ("New users", 0.0)]:
    for w in range(1, 5):
        pt = base + lasting + extra * np.exp(-(w - 0.5) * 7 / tau)
        c, t = rng2.binomial(nn, base), rng2.binomial(nn, pt)
        rows.append({"seg": seg, "week": w, "lift": t / nn - c / nn,
                     "se": np.sqrt(c / nn * (1 - c / nn) / nn + t / nn * (1 - t / nn) / nn)})
seg = pd.DataFrame(rows)

fig, ax = plt.subplots(figsize=(8, 4.4))
for name, color, off in [("Returning users", "#e76f51", -0.06), ("New users", "#2a9d8f", 0.06)]:
    s = seg[seg.seg == name]
    ax.errorbar(s.week + off, s.lift * 100, yerr=1.96 * s.se * 100, fmt="o-", color=color, capsize=3, lw=2, label=name)
ax.axhline(0, color="black", lw=0.8)
ax.set_xticks([1, 2, 3, 4])
ax.set_xlabel("Week since launch")
ax.set_ylabel("Conversion lift (percentage points)")
ax.set_title("Only returning users show the novelty bump in week 1")
ax.legend()
fig.tight_layout()

Weekly lift with 95 percent intervals for returning and new users. Returning users start near 3 points in week 1 and drop to about 1.5. New users sit between 0.8 and 1.4 throughout

Returning users' lift is 3.03 pp in week 1 and about 1.5 pp afterwards. New users sit between 0.8 and 1.4 pp the whole time. This is a simulated scenario where I decided new users have no bump, so in real data treat it as a diagnostic, not proof: new users also differ from returning ones in intent and channel. It needs a tenure or first-seen-date column in your data.

How Long Should I Run the Test?

Situation What to do
Daily lift is flat within noise Standard fixed-horizon analysis is fine
Daily lift trends down, then flattens Run until it flattens, then report the lift from the flat part (or the fitted L)
Daily lift is still trending at the planned end Extend the test, or report the trend and a range instead of one number
You cannot run longer Report the last week's lift, not the whole-test average, and say so

Do not use the early peak as the forecast, and do not stop a test as soon as it first looks significant. Stopping rules are covered in the peeking and sequential testing post.

Practical Tips

  • Always keep the date or day-since-exposure on the data you analyze. Once you only have the pooled counts, you cannot check for time trends.
  • Run for at least one full weekly cycle so weekday and weekend behavior are both included, and longer when you suspect a novelty effect.
  • A holdout group kept on the old experience after launch is the best long-run check. It measures the lasting effect directly.
  • The numbers here come from one seeded simulation with a known exponential decay. In real data the shape is less clean.

Similar Topics