Parameter(s) of Interest

The parameter of interest is the population value a study is designed to learn about. It is almost always unknown — a true population parameter such as a mean, a proportion, a difference between two of them, or a regression coefficient — and naming it is the first decision in a design, not a formality at the end.

  • A study of exam scores: the true population mean \(\mu\), estimated by the sample mean \(\bar{x}\)
  • An A/B test: the true conversion rates \(p_A\) and \(p_B\), or their difference \(p_B - p_A\)
  • A medical trial: the difference in recovery probability, \(P(\text{recovery} \mid \text{drug}) - P(\text{recovery} \mid \text{placebo})\)
  • A regression: the coefficients \(\beta_1, \beta_2, \dots\) relating predictors to the outcome

Estimators, hypothesis tests and confidence intervals are all machinery for making statements about whatever was named there. Which is why two things follow that the list does not show: the choice changes the answer, and making the choice late destroys the guarantees.

The same experiment, four parameters, two decisions

An A/B test on a conversion rate does not have one effect to report. The difference in rates, the relative lift, the odds ratio and the number of users per extra conversion are four different parameters, each with its own estimate and its own interval, all computed from the same four counts.

import numpy as np
from scipy.stats import binom, norm

z = norm.ppf(0.975)
nA = nB = 10_000
xA, xB = 1000, 1200
pA, pB = xA / nA, xB / nB
"""One experiment. The numbers below are all computed from these four values,
   and they are four different parameters, not four views of one."""

diff = pB - pA
se_d = np.sqrt(pA * (1 - pA) / nA + pB * (1 - pB) / nB)
lr = np.log(pB / pA)
se_lr = np.sqrt((1 - pA) / (pA * nA) + (1 - pB) / (pB * nB))
odds = (pB / (1 - pB)) / (pA / (1 - pA))
se_lo = np.sqrt(1 / xA + 1 / (nA - xA) + 1 / xB + 1 / (nB - xB))

print(f"  control {xA}/{nA:,} = {pA:.4f}, treatment {xB}/{nB:,} = {pB:.4f}")
print(f"{'parameter of interest':>26}{'estimate':>12}{'95% interval':>26}")
print(f"{'difference in rates':>26}{diff:>12.4f}"
      f"{'[' + format(diff - z * se_d, '.4f') + ', ' + format(diff + z * se_d, '.4f') + ']':>26}")
print(f"{'relative lift':>26}{np.exp(lr) - 1:>12.4f}"
      f"{'[' + format(np.exp(lr - z * se_lr) - 1, '.4f') + ', ' + format(np.exp(lr + z * se_lr) - 1, '.4f') + ']':>26}")
print(f"{'odds ratio':>26}{odds:>12.4f}"
      f"{'[' + format(np.exp(np.log(odds) - z * se_lo), '.4f') + ', ' + format(np.exp(np.log(odds) + z * se_lo), '.4f') + ']':>26}")
print(f"{'users needed per extra':>26}{1 / diff:>12.4f}"
      f"{'[' + format(1 / (diff + z * se_d), '.1f') + ', ' + format(1 / (diff - z * se_d), '.1f') + ']':>26}")

print(f"    'ship if the rate rises by more than 3 points'"
      f"   -> upper end {diff + z * se_d:.4f}, so no")
print(f"    'ship if the rate rises by more than 10%'"
      f"      -> lower end {np.exp(lr - z * se_lr) - 1:.4f}, so yes")

rng = np.random.default_rng(0)
runs, groups, m, base = 40_000, 10, 2000, 0.10
a = binom.ppf(rng.random((runs, groups)), m, base) / m
b = binom.ppf(rng.random((runs, groups)), m, base) / m
"""Ten segments, and the treatment does nothing in any of them:
   the true difference is 0 everywhere."""
d = b - a
se = np.sqrt(a * (1 - a) / m + b * (1 - b) / m)
pick = np.argmax(d, axis=1)
r = np.arange(runs)
dp, sp = d[r, pick], se[r, pick]
fixed = (d[:, 0] - z * se[:, 0] <= 0) & (0 <= d[:, 0] + z * se[:, 0])

print(f"  {groups} segments, true effect 0 in every one, {runs:,} experiments:")
print(f"{'how the segment was chosen':>30}{'coverage of 0':>16}{'mean estimate':>16}")
print(f"{'fixed in advance':>30}{fixed.mean():>16.4f}{d[:, 0].mean():>16.6f}")
print(f"{'the best-looking one':>30}{((dp - z * sp <= 0) & (0 <= dp + z * sp)).mean():>16.4f}"
      f"{dp.mean():>16.6f}")
print(f"  picking after looking turns a 95% interval into a {((dp - z * sp <= 0) & (0 <= dp + z * sp)).mean() * 100:.1f}% one and")
print(f"  reports an average effect of {dp.mean():.4f} where the truth is 0")
#   control 1000/10,000 = 0.1000, treatment 1200/10,000 = 0.1200
#      parameter of interest    estimate              95% interval
#        difference in rates      0.0200          [0.0113, 0.0287]
#              relative lift      0.2000          [0.1086, 0.2989]
#                 odds ratio      1.2273          [1.1229, 1.3414]
#     users needed per extra     50.0000              [34.9, 88.2]
#     'ship if the rate rises by more than 3 points'   -> upper end 0.0287, so no
#     'ship if the rate rises by more than 10%'      -> lower end 0.1086, so yes
#   10 segments, true effect 0 in every one, 40,000 experiments:
#     how the segment was chosen   coverage of 0   mean estimate
#               fixed in advance          0.9500        0.000025
#           the best-looking one          0.7741        0.014648
#   picking after looking turns a 95% interval into a 77.4% one and
#   reports an average effect of 0.0146 where the truth is 0

Reading the two halves

The first half is not a trick played by a badly chosen statistic. Both shipping rules are ones a team might genuinely hold, and the data supports one and rejects the other. A rule stated in percentage points and a rule stated in percent are rules about different quantities, and 2 percentage points on a 10% baseline conversion rate is a 20% relative increase in conversions, not 20% of all traffic. Deciding which of the four rows matters is a product judgment about what the change is for, and it has to be made before the experiment, because afterward there are four numbers to choose among and the temptation is obvious.

The second half is what happens when the choice is made afterward. Ten segments with no effect anywhere, take the best-looking one, and a nominal 95% interval covers the truth 77.4% of the time while reporting an average effect of 0.0146 on data generated with zero. The maximum can estimate a maximum population effect, but selecting the largest noisy estimate creates upward selection bias. A confidence interval calibrated for a prespecified segment need not retain its coverage after that selection. This is the mechanism behind multiple comparisons, seen from the parameter’s side rather than the test’s.

Making it concrete before the data arrives

A parameter is specified when four things are fixed: the population it is defined over, the quantity itself, the scale it is measured on, and the size that would count as worth acting on. “Conversion improves” specifies none of them. “The difference in seven-day trial-to-paid rate among new sign-ups on the web, at least 2 percentage points” specifies all four, and it determines the sample size before anyone looks at a result.

Secondary questions do not have to be abandoned, only relabeled. Segment results and alternative scales are worth computing and worth reporting as exploratory — findings that generate the next experiment rather than conclusions from this one. The cost of the relabeling is nothing; the cost of skipping it is the 77.4% above, presented as 95%.

One caution on the fourth row of the table. The reciprocal of a difference is unstable near zero: as the lower end of the difference interval approaches 0, the upper end of “users needed” runs to infinity. A parameter that is well behaved on one scale need not be on another, which is one more reason the scale belongs in the specification.

References

  • SciPy documentation, scipy.stats.binom and scipy.stats.norm. docs.scipy.org

Discover more from Insightful Data Lab

Subscribe to get the latest posts sent to your email.

Similar Posts

Questions, corrections, or additional insights?

This site uses Akismet to reduce spam. Learn how your comment data is processed.