News for hackers. Stuff that matters.
Re:Winning A/B results were not translating into improved us... by pmiller2 on Monday September 29, 2014 @11:09AM (#8383207)
The red flag here for me was that Optimizely encourages you to stop the test as soon as it "reaches significance." You shouldn't do that. What you should do is precalculate a sample size based on the statistical power you need, which involves determining your tolerance for the probability of making an error and on the minimum effect size you need to detect. Then, you run the test to completion and crunch the numbers afterward. This helps prevent the scenario where your page tests 18% better than itself by minimizing probability that your "results" are just a consequence of a streak of positive results in one branch of the test.

I was also disturbed that the effect size was taken into account in the sample size selection. You need to know this before you do any type of statistical test. Otherwise, you are likely to get "positive" results that just don't mean anything.

OTOH, I wasn't too concerned that the test was a one-tailed test. Honestly, in a website A/B test, all I really am concerned about is whether my new page is better than the old page. A one-tailed test tells you that. It might be interesting to run two-tailed tests just so you can get an idea what not to do, but for this use I think a one-tailed test is fine. It's not like you're testing drugs, where finding any effect, either positive or negative, can be valuable.

I should also note that I only really know enough about statistics to not shoot myself in the foot in a big, obvious way. You should get a real stats person to work on this stuff if your livelihood depends on it.

Re:Winning A/B results were not translating into improved us... by dsiroker on Monday September 29, 2014 @02:11PM (#8384206)
Hi pmiller, Dan from Optimizely here. Thanks for your thoughtful response. This is a really important issue for us, so I wanted to set the record straight on a couple of points:

#1 - “Optimizely encourages you to stop the test as soon as it reaches ‘statistical significance.’” - This actually isn’t true. We recommend you calculate your sample size before you start your test using a statistical significance calculator and waiting until you reach that sample size before stopping your test. We wrote a detailed article about how long to run a test, here: https://help.optimizely.com/hc/en-us/articles/200133789-How-...

We also have a sample size calculator you can use, here: https://www.optimizely.com/resources/sample-size-calculator

#2 - Optimizely uses a one-tailed test, rather than a 2-tailed test. - This is a point the article makes and it came up in our customer community a few weeks ago. One of our statisticians wrote a detailed reply, and here’s the TL;DR:

- Optimizely actually uses two 1-tailed tests, not one.

- There is no mathematical difference between a 2-tailed test at 95% confidence and two 1-tailed tests at 97.5% confidence.

- There is a difference in the way you describe error, and we believe we define error in a way that is most natural within the context of A/B testing.

- You can achieve the same result as a 2-tailed test at 95% confidence in Optimizely by requiring the Chance to Beat Baseline to exceed 97.5%.

- We’re working on some exciting enhancements to our methodologies to make results even easier to interpret and more meaningfully actionable for those with no formal Statistics background. Stay tuned!

Here’s the full response if you’re interested in reading more: http://community.optimizely.com/t5/Strategy-Culture/Let-s-ta...

Overall I think it’s great that we’re having this conversation in a public forum because it draws attention to the fact that statistics matter in interpreting test results accurately. All too often, I see people running A/B tests without thinking about how to ensure their results are statistically valid.

Dan

Re:Winning A/B results were not translating into improved us... by pmiller2 on Monday September 29, 2014 @06:50PM (#8385795)
Thanks for replying. I agree with all the points you mention your statistician covered, but you should make sure your users know what kind of test you're using. The only reason I say this is because this article gives me the impression that you were using a single one-tailed test (which, as I said in my post, is a perfectly acceptable thing to do in the context of web site A/B testing).

But, as far as "Optimezely encourages you to stop the test as soon as it reaches 'statistical significance,'" I'm not saying your user documentation or anything encourages people to stop tests early. I'm saying (and this is based only on the article as I've never used Optimizely) that your platform is psychologically encouraging users to stop tests early. E.g. from the article:

    Most A/B testing tools recommend terminating tests as soon as they show significance, even though that significance may very well be due to short-term bias. A little green indicator will pop up, as it does in Optimizely, and the marketer will turn the test off.

    <image with a green check mark saying "Variation 1 is beating Variation 2 by 18.1%">

    But most tests should run longer and in many cases it’s likely that the results would be less impressive if they did. Again, this is a great example of the default settings in these platforms being used to increase excitement and keep the users coming back for more.
I am aware of literature in experimental design that talks about criteria for stopping an experiment before its designed conclusion. Such things are useful in, say, medical research, where if you see a very strong positive or negative result early on, you want to have that safety valve to either get the drug/treatment to market more quickly or to avoid hurting people unnecessarily.

Unless you've built that analysis into when you display your "success message" that "Variation 1 is beating Variation 2 by 18.1%," I'd argue that you're doing users a disservice. When I see that message, I want to celebrate, declare victory, and stop the test; and that's not what you should encourage people to do unless it's statistically sound to do so.

The other thing in the article that lead me to this position is that you display "conversion rate over time" as a time series graph. Again, if I see that and I notice one variation is outperforming the other, what I want to do is declare victory and stop the test. That might not be mathematically/statistically warranted.

IMO, as a provider of statistical software, I think you'd do your users a service to not display anything about a running experiment by default until it's either finished or you can mathematically say it's safe to stop the trial. Some people will want their pretty graphs and such, so give them a way to see them, but make them expend some effort to do so. Same thing with prematurely ended experiments; don't provide any conclusions based on an incomplete trial. Give users the ability to download the raw data from a prematurely ended experiment, but don't make it easy or the default.

Re:Winning A/B results were not translating into improved us... by pocp2 on Monday September 29, 2014 @11:19AM (#8383263)
For a second I thought you were Evan Miller who wrote about the exact same thing: http://www.evanmiller.org/how-not-to-run-an-ab-test.html
Re:Winning A/B results were not translating into improved us... by pmiller2 on Monday September 29, 2014 @02:43PM (#8384424)
No, I'm not him, but stuff like fixing a sample size in advance and not stopping tests early without careful analysis are things I learned in my stat classes. This stuff should be stressed in any good intro stats class covering hypothesis testing. (I was a math major in college, so I had all of 2 courses in mathematical statistics and 0 in experimental design. I didn't go to the best school, but my stats teacher was a former industry statistician focusing on quality control.)
Re:Winning A/B results were not translating into improved us... by wmt on Monday September 29, 2014 @11:25AM (#8383299)
"Honestly, in a website A/B test, all I really am concerned about is whether my new page is better than the old page. A one-tailed test tells you that."

No, it's the other way around. One tailed test is only usable for testing if the new design worse than the old one, because it being better than the old one does not matter as long it's not worse. If you are testing that is the new design better, you definitely need to test both tails or else you may likely switch to a worse design than the old one.

Re:Winning A/B results were not translating into improved us... by yummyfajitas on Monday September 29, 2014 @12:05PM (#8383501)
More precisely, before you start the test you need to choose a "default" choice. If the default choice is the old version, then it's safe to switch to the new version provided it isn't worse. Apply the converse if your default choice is the new version.

The key point here is that you aren't choosing a testing procedure, you are choosing a decision procedure.

Re:Winning A/B results were not translating into improved us... by jules on Monday September 29, 2014 @01:02PM (#8383782)
Frequentism rears its ugly head again...
Re:Winning A/B results were not translating into improved us... by yummyfajitas on Monday September 29, 2014 @02:16PM (#8384240)
This problem exists with Bayesian techniques also, its just more obvious how to set up the problem.
Re:Winning A/B results were not translating into improved us... by jules on Monday September 29, 2014 @03:57PM (#8384892)
Exactly! The problems arise because of the disconnect between what the math is actually saying and what people think the math is saying. Or rather: what people wish it was saying. Frequentist methods give you "if page A performs the same as page B then then the likelihood of observing something at least as extreme as this measurement is less than X%". In practice we never want to know this information. What people actually want to know is "given this measurement, the probability of page A being better than page B is X%", so they interpret whatever number comes out of the frequentist method like that...wishful thinking.

Just give them 2 posterior distributions of the conversion rate of page A and page B. It may look more daunting than a single number at first, but it's much easier to interpret than that single number that comes out of hypothesis testing, and, you know, it's the information they actually need to make a decision whether to pick page A or page B.

Re:Winning A/B results were not translating into improved us... by Machow on Monday September 29, 2014 @11:19PM (#8386611)
"given this measurement and our prior beliefs, the probability of page A being better than page B is X%"

FTFY ;). I think Bayesian methods add a lot of interpretive power, but I'm not sure that it would help people make a correct interpretation. I suspect that if practitioners are neglecting the difference between a one-sided and two-sided test, they will likely forget (or gloss over) what priors are (and their non-trivial implementation).

I definitely agree that their is a disconnect between the math and its interpretation, though.

Re:Winning A/B results were not translating into improved us... by jules on Tuesday September 30, 2014 @07:20PM (#8391993)
In an A/B test where you usually get so much data, priors honestly don't matter much. Just use a flat prior. You'll overestimate the uncertainty a bit, so you may need a couple more data points than necessary but it's still way less than you'd need for a frequentist method. An A/B testing company could even automatically come up with better priors based on A/B tests that their customers have done in the past.
Re:Winning A/B results were not translating into improved us... by yummyfajitas on Monday September 29, 2014 @11:29PM (#8386641)
Even in the Bayesian case, you need more than 2 posteriors. You need a decision rule. Comparing posteriors is not sufficient.

http://www.bayesianwitch.com/blog/2014/bayesian_ab_test.html

Re:Winning A/B results were not translating into improved us... by jules on Tuesday September 30, 2014 @07:16PM (#8391979)
You can just show the posterior and let your brain be the decision rule. You can visually see the difference in conversion rate and the uncertainty around it. That info makes it easy to decide whether to continue the test or stop the test and pick the best performer. Much better information to base a decision on than a hypothesis test with a significance threshold that people pull out of their ass.

If you want to be fancy you could even implement a strategy that maximizes the total conversions based on bayesian decision theory, so that it automatically tends to show the best performer as time goes on.

That article is weird. It uses a normal distribution as the prior for the conversion rate. That could produce a negative conversion rate or a conversion rate above 100%. Then in the section "So why doesn’t everyone already do this?" they say "The answer is simple - it’s computationally inefficient.". No shit if you are using a normal prior. A much better way to do this is to use a beta prior (or a Dirichlet prior in case you have more than 2 alternatives). Then the math becomes trivial & fast and you don't have nonsense negative or above 100% conversion rates.

Re:Winning A/B results were not translating into improved us... by yummyfajitas on Tuesday September 30, 2014 @10:55PM (#8392583)
I didn't say hypothesis test, I said decision rule. The method I describe in the article has only two quantities "pulled out of the ass" - the threshold of caring and the prior. If you visually inspect the posterior, your are implicitly pulling out of your ass an unknown "threshold of visual similarity".

That article is weird. It uses a normal distribution as the prior for the conversion rate.

That's incorrect. From the article: "To begin we will choose a Beta distribution prior." The computational intensiveness is not caused by the choice of prior, it's caused by the need to evaluate an integral over the joint posterior.

A Dirichlet prior is also not what you'd use for more than 2 alternatives - you have two beta distributions, one representing the posterior for the control and the other for the variation. If you had a second variation, you'd have 3 beta distributions, and you'd need to evaluate a 3 dimensional integral.

Re:Winning A/B results were not translating into improved us... by jules on Wednesday October 01, 2014 @08:09AM (#8393880)
> I didn't say hypothesis test, I said decision rule.

I did not say that you said hypothesis test.

> If you visually inspect the posterior, your are implicitly pulling out of your ass an unknown "threshold of visual similarity".

Yes, but you are "implicitly pulling a number out of your ass" based on a lot more information. When you ask somebody to come up with a mechanical decision rule before seeing the posterior, it's unlikely that you will get as good a decision as when you just show them the posterior.

> That's incorrect. From the article: "To begin we will choose a Beta distribution prior." The computational intensiveness is not caused by the choice of prior, it's caused by the need to evaluate an integral over the joint posterior.

Ah, I was confused because they are specifying the prior in terms of a mean and standard deviation. That is a very weird way to represent a beta distribution.

> The computational intensiveness is not caused by the choice of prior, it's caused by the need to evaluate an integral over the joint posterior.

I see, they are computing expected_value(max(ctr[A]-ctr[B], 0.0)). That is still weird though. What you want to know is if it's worth it to run the test another time. So you want to compare E(final conversion rate if stop now) with E(final conversion rate if run another time), and if the latter is not much greater than the former you stop the test. Both of those have a closed form. Even better would be to compare E(final conversion rate if stop now) and E(final conversion rate if we test A) and E(final conversion rate if we test B). Then you would also automatically decide the best version to show (e.g. if the uncertainty about A is small and the uncertainty about B is big, you'll show B).

> A Dirichlet prior is also not what you'd use for more than 2 alternatives

Hm? Lets say you have a free plan, basic plan, and enterprise plan. This is a very common scenario in practice. A dirichlet prior would be the natural thing to use here, IMO.

Re:Winning A/B results were not translating into improved us... by yummyfajitas on Thursday October 02, 2014 @12:18AM (#8399403)
E(final conversion rate if run another time)... Both of those have a closed form.

I'm curious - where can I learn more?

Lets say you have a free plan, basic plan, and enterprise plan...A dirichlet prior would be the natural thing to use here, IMO.

This would be handled via Dirichlet, and then the results multiplied by their LTV. I thought you were referring to multiple variants - i.e., landing page A, landing page B, landing page C.

Re:Winning A/B results were not translating into improved us... by jules on Thursday October 02, 2014 @06:54AM (#8400186)
Suppose you have Beta(a1,b2) and Beta(a2,b2) at the current step. The expected conversion rates are:

    M(a,b) = a/(a+b)

    E1 = M(a1,b1)
    E2 = M(a2,b2)
If we stop now the expected conversion rate is E = max(E1,E2).

If we continue for another timestep with option 1 then the question is whether that can make us switch from 1 to 2 or from 2 to 1 or not. If it can't then the expected conversion rate is the same whether or not we execute one more step. Lets assume without loss of generality that option 2 is currently winning, but if option 1 gets another conversion then 1 is winning. So the new expected conversion rate is:

    E' = int(p_1(r)*(r*r + (1-r)*E2)), r=0..1)
where p_1 is the probability density of Beta(a1,b1). All the moments of the beta distribution have a closed form, so E' also has a closed form.

You could generalize this to running it for n more times instead of one more time, you'd get an expression of the form:

   E = int(p_1(r1)*p_2(r2)*polynomial(r1,r2))
I suspect that also has a closed form but I'm not sure at first glance.
Re:Winning A/B results were not translating into improved us... by aggie on Monday September 29, 2014 @01:35PM (#8383962)
Why not run a two-tailed test and double the alpha? If I'm understanding it correctly, you'll still make the same conclusion at either tail as a one-tailed test, but this way you have both directions covered. I could be missing something, just thinking out loud.