-
Notifications
You must be signed in to change notification settings - Fork 9
/
tester.html
102 lines (94 loc) · 4.11 KB
/
tester.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>AB Result Display Scratchpad</title>
<link rel="stylesheet" type="text/css" href="confidence.css">
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<script type="text/javascript" src="vue/vue.js"></script>
<script type="text/javascript" src="jstat/jstat.min.js"></script>
<script type="text/javascript" src="experiment.js"></script>
</head>
<body>
<div id="app-tester" class="container">
<br />
<div class="row">
<div class="col-md-offset-3 col-md-6">
<div class="jumbotron">
<h2>A/B Testing Significance</h2>
</div>
<form class="form-inline">
<div class="form-group">
<label for="atraffic">A traffic</label>
<input v-model="input.b.traffic" type="number" class="form-control" id="atraffic" placeholder="Number of visitors in A"/>
</div>
<div class="form-group">
<label for="aconv">A conversions</label>
<input v-model="input.b.conversions" type="number" class="form-control" id="aconv" placeholder="Number of conversions in A"/>
</div>
<div class="form-group">
<label for="btraffic">B traffic</label>
<input v-model="input.v.traffic" type="number" class="form-control" id="btraffic" placeholder="Number of visitors in B"/>
</div>
<div class="form-group">
<label for="bconv">B conversions</label>
<input v-model="input.v.conversions" type="number" class="form-control" id="bconv" placeholder="Number of conversions in B"/>
</div>
<div class="form-group">
<label for="pval">Significance threshold (p-value)</label>
<input v-model="input.pval" type="number" class="form-control" id="pval" placeholder="Significance threshold (p-value)"/>
</div>
</form>
<br />
<div class="alert alert-warning" v-if="experiment.get_srm_p(1) < 0.005">
<em>Warning.</em> Possible sample ration mismatch detected ({{ display_srm_p }}).
The observed ratio of visitors in base does not match the expected ratio of 50% of traffic.
This is an indicator for randomisation failure or missing data issues.
<strong>Computed statistics may be invalid as a result.</strong>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<strong>Experiment</strong>
</div>
<experiment-table :e="experiment"></experiment-table>
</div>
<div class="text-center" v-if="experiment.get_srm_p(1) >= 0.005">
<small class="text-muted">No indication of sample ration mismatch ({{ display_srm_p }}).</small>
</div>
</div>
</div>
</div>
<script type="text/javascript">
tester = new Vue({
el: '#app-tester',
data: {
input: {
b: { traffic: 10000, conversions: 500 },
v: { traffic: 10000, conversions: 560 },
pval: 0.1,
},
e: new Experiment(0)
},
computed: {
experiment: function(val) {
this.e.set_pval(this.input.pval);
this.e.visits = [parseInt(this.input.b.traffic), parseInt(this.input.v.traffic)];
this.e.conversions = [parseInt(this.input.b.conversions), parseInt(this.input.v.conversions)];
return this.e;
},
display_srm_p: function() {
if (this.e.get_srm_p(1) < 0.0001) {
return "p < 0.0001";
} else {
return "p = " + this.e.get_srm_p(1).toFixed(4);
}
}
}
});
</script>
<script async defer src="https://scripts.simpleanalyticscdn.com/latest.js"></script>
<noscript><img src="https://queue.simpleanalyticscdn.com/noscript.gif" alt="" referrerpolicy="no-referrer-when-downgrade" /></noscript>
</body>
</html>