-
Notifications
You must be signed in to change notification settings - Fork 0
/
Analyze_ab_test_results_notebook.ipynb.json
1922 lines (1922 loc) Β· 74.2 KB
/
Analyze_ab_test_results_notebook.ipynb.json
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Analyze A/B Test Results\n",
"\n",
"This project will assure you have mastered the subjects covered in the statistics lessons. The hope is to have this project be as comprehensive of these topics as possible. Good luck!\n",
"\n",
"## Table of Contents\n",
"- [Introduction](#intro)\n",
"- [Part I - Probability](#probability)\n",
"- [Part II - A/B Test](#ab_test)\n",
"- [Part III - Regression](#regression)\n",
"\n",
"\n",
"<a id='intro'></a>\n",
"### Introduction\n",
"\n",
"A/B tests are very commonly performed by data analysts and data scientists. It is important that you get some practice working with the difficulties of these \n",
"\n",
"For this project, you will be working to understand the results of an A/B test run by an e-commerce website. Your goal is to work through this notebook to help the company understand if they should implement the new page, keep the old page, or perhaps run the experiment longer to make their decision.\n",
"\n",
"**As you work through this notebook, follow along in the classroom and answer the corresponding quiz questions associated with each question.** The labels for each classroom concept are provided for each question. This will assure you are on the right track as you work through the project, and you can feel more confident in your final submission meeting the criteria. As a final check, assure you meet all the criteria on the [RUBRIC](https://review.udacity.com/#!/projects/37e27304-ad47-4eb0-a1ab-8c12f60e43d0/rubric).\n",
"\n",
"<a id='probability'></a>\n",
"#### Part I - Probability\n",
"\n",
"To get started, let's import our libraries."
]
},
{
"cell_type": "code",
"execution_count": 201,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import random\n",
"import matplotlib.pyplot as plt\n",
"import statsmodels.api as sm\n",
"\n",
"%matplotlib inline\n",
"#We are setting the seed to assure you get the same answers on quizzes as we set up\n",
"random.seed(42)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`1.` Now, read in the `ab_data.csv` data. Store it in `df`. **Use your dataframe to answer the questions in Quiz 1 of the classroom.**\n",
"\n",
"a. Read in the dataset and take a look at the top few rows here:"
]
},
{
"cell_type": "code",
"execution_count": 202,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>user_id</th>\n",
" <th>timestamp</th>\n",
" <th>group</th>\n",
" <th>landing_page</th>\n",
" <th>converted</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>851104</td>\n",
" <td>2017-01-21 22:11:48.556739</td>\n",
" <td>control</td>\n",
" <td>old_page</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>804228</td>\n",
" <td>2017-01-12 08:01:45.159739</td>\n",
" <td>control</td>\n",
" <td>old_page</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>661590</td>\n",
" <td>2017-01-11 16:55:06.154213</td>\n",
" <td>treatment</td>\n",
" <td>new_page</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>853541</td>\n",
" <td>2017-01-08 18:28:03.143765</td>\n",
" <td>treatment</td>\n",
" <td>new_page</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>864975</td>\n",
" <td>2017-01-21 01:52:26.210827</td>\n",
" <td>control</td>\n",
" <td>old_page</td>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" user_id timestamp group landing_page converted\n",
"0 851104 2017-01-21 22:11:48.556739 control old_page 0\n",
"1 804228 2017-01-12 08:01:45.159739 control old_page 0\n",
"2 661590 2017-01-11 16:55:06.154213 treatment new_page 0\n",
"3 853541 2017-01-08 18:28:03.143765 treatment new_page 0\n",
"4 864975 2017-01-21 01:52:26.210827 control old_page 1"
]
},
"execution_count": 202,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df = pd.read_csv('ab_data.csv')\n",
"df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"b. Use the below cell to find the number of rows in the dataset."
]
},
{
"cell_type": "code",
"execution_count": 203,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"294478"
]
},
"execution_count": 203,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.shape[0]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"c. The number of unique users in the dataset."
]
},
{
"cell_type": "code",
"execution_count": 204,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"290584"
]
},
"execution_count": 204,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.user_id.nunique()"
]
},
{
"cell_type": "code",
"execution_count": 205,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3894"
]
},
"execution_count": 205,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.user_id.duplicated().sum()"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"d. The proportion of users converted."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.11965919355605512"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.converted.mean()"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"e. The number of times the `new_page` and `treatment` don't line up."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3893"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(df.query('group == \"treatment\" and landing_page == \"old_page\"'))+len(df.query('group == \"control\" and landing_page == \"new_page\"'))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"f. Do any of the rows have missing values?"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"user_id 0\n",
"timestamp 0\n",
"group 0\n",
"landing_page 0\n",
"converted 0\n",
"dtype: int64"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.isna().sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`2.` For the rows where **treatment** is not aligned with **new_page** or **control** is not aligned with **old_page**, we cannot be sure if this row truly received the new or old page. Use **Quiz 2** in the classroom to provide how we should handle these rows. \n",
"\n",
"a. Now use the answer to the quiz to create a new dataset that meets the specifications from the quiz. Store your new dataframe in **df2**."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"df.drop(df.query(\"group == 'treatment' and landing_page == 'old_page'\").index, inplace=True)\n",
"df.drop(df.query(\"group == 'control' and landing_page == 'new_page'\").index, inplace=True)\n"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"df2=df"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2[((df2['group'] == 'treatment') == (df2['landing_page'] == 'new_page')) == False].shape[0]"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"Int64Index: 290585 entries, 0 to 294477\n",
"Data columns (total 5 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 user_id 290585 non-null int64 \n",
" 1 timestamp 290585 non-null object\n",
" 2 group 290585 non-null object\n",
" 3 landing_page 290585 non-null object\n",
" 4 converted 290585 non-null int64 \n",
"dtypes: int64(2), object(3)\n",
"memory usage: 13.3+ MB\n"
]
}
],
"source": [
"df2.info()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`3.` Use **df2** and the cells below to answer questions for **Quiz3** in the classroom."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"a. How many unique **user_id**s are in **df2**?"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"290584"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2.user_id.nunique()"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"b. There is one **user_id** repeated in **df2**. What is it?"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>user_id</th>\n",
" <th>timestamp</th>\n",
" <th>group</th>\n",
" <th>landing_page</th>\n",
" <th>converted</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2893</th>\n",
" <td>773192</td>\n",
" <td>2017-01-14 02:55:59.590927</td>\n",
" <td>treatment</td>\n",
" <td>new_page</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" user_id timestamp group landing_page converted\n",
"2893 773192 2017-01-14 02:55:59.590927 treatment new_page 0"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2[df2.duplicated('user_id')]\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"c. What is the row information for the repeat **user_id**? "
]
},
{
"cell_type": "code",
"execution_count": 85,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>user_id</th>\n",
" <th>timestamp</th>\n",
" <th>group</th>\n",
" <th>landing_page</th>\n",
" <th>converted</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2893</th>\n",
" <td>773192</td>\n",
" <td>2017-01-14 02:55:59.590927</td>\n",
" <td>treatment</td>\n",
" <td>new_page</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" user_id timestamp group landing_page converted\n",
"2893 773192 2017-01-14 02:55:59.590927 treatment new_page 0"
]
},
"execution_count": 85,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2[df2.user_id == 773192]\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"d. Remove **one** of the rows with a duplicate **user_id**, but keep your dataframe as **df2**."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df2.drop(labels = 1899, axis=0, inplace=True)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`4.` Use **df2** in the below cells to answer the quiz questions related to **Quiz 4** in the classroom.\n",
"\n",
"a. What is the probability of an individual converting regardless of the page they receive?"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.11959708724499628"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2.converted.mean()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"b. Given that an individual was in the `control` group, what is the probability they converted?"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.1203863045004612"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2.query(\"group == 'control'\").converted.mean()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"c. Given that an individual was in the `treatment` group, what is the probability they converted?"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.11880806551510564"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2.query(\"group == 'treatment'\").converted.mean()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"d. What is the probability that an individual received the new page?"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.5000619442226688"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(df2['landing_page'] == 'new_page').mean()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Consider your results from a. through d. above, and explain below whether you think there is sufficient evidence to say that the new treatment page leads to more conversions."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<a id='ab_test'></a>\n",
"### Part II - A/B Test\n",
"\n",
"Notice that because of the time stamp associated with each event, you could technically run a hypothesis test continuously as each observation was observed. \n",
"\n",
"However, then the hard question is do you stop as soon as one page is considered significantly better than another or does it need to happen consistently for a certain amount of time? How long do you run to render a decision that neither page is better than another? \n",
"\n",
"These questions are the difficult parts associated with A/B tests in general. \n",
"\n",
"\n",
"`1.` For now, consider you need to make the decision just based on all the data provided. If you want to assume that the old page is better unless the new page proves to be definitely better at a Type I error rate of 5%, what should your null and alternative hypotheses be? You can state your hypothesis in terms of words or in terms of **$p_{old}$** and **$p_{new}$**, which are the converted rates for the old and new pages."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Put your answer here.**"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`2.` Assume under the null hypothesis, $p_{new}$ and $p_{old}$ both have \"true\" success rates equal to the **converted** success rate regardless of page - that is $p_{new}$ and $p_{old}$ are equal. Furthermore, assume they are equal to the **converted** rate in **ab_data.csv** regardless of the page. <br><br>\n",
"\n",
"Use a sample size for each page equal to the ones in **ab_data.csv**. <br><br>\n",
"\n",
"Perform the sampling distribution for the difference in **converted** between the two pages over 10,000 iterations of calculating an estimate from the null. <br><br>\n",
"\n",
"Use the cells below to provide the necessary parts of this simulation. If this doesn't make complete sense right now, don't worry - you are going to work through the problems below to complete this problem. You can use **Quiz 5** in the classroom to make sure you are on the right track.<br><br>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"a. What is the **convert rate** for $p_{new}$ under the null? "
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.11959708724499628"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ππππ€=df2.converted.mean()\n",
"ππππ€"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"b. What is the **convert rate** for $p_{old}$ under the null? <br><br>"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.11959708724499628"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ππππ = df2.converted.mean()\n",
"ππππ"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"c. What is $n_{new}$?"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"145310"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ππππ€=df2.query(\"group == 'treatment'\").shape[0]\n",
"ππππ€"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"d. What is $n_{old}$?"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"145274"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ππππ=df2.query(\"group == 'control'\").shape[0]\n",
"ππππ"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"e. Simulate $n_{new}$ transactions with a convert rate of $p_{new}$ under the null. Store these $n_{new}$ 1's and 0's in **new_page_converted**."
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [],
"source": [
"new_page_converted=np.random.binomial(1, ππππ€, ππππ€)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"f. Simulate $n_{old}$ transactions with a convert rate of $p_{old}$ under the null. Store these $n_{old}$ 1's and 0's in **old_page_converted**."
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [],
"source": [
"old_page_converted=np.random.binomial(1, ππππ ,ππππ)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"g. Find $p_{new}$ - $p_{old}$ for your simulated values from part (e) and (f)."
]
},
{
"cell_type": "code",
"execution_count": 59,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-0.001048519870444381"
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"diff = new_page_converted.mean()-old_page_converted.mean()\n",
"diff"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"h. Simulate 10,000 $p_{new}$ - $p_{old}$ values using this same process similarly to the one you calculated in parts **a. through g.** above. Store all 10,000 values in a numpy array called **p_diffs**."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"p_diffs=[]\n",
"for _ in range(10000):\n",
" new_page_converted=np.random.binomial(1, ππππ€, ππππ€).mean()\n",
" old_page_converted=np.random.binomial(1, ππππ ,ππππ).mean()\n",
" p_diffs.append(new_page_converted - old_page_converted)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"i. Plot a histogram of the **p_diffs**. Does this plot look like what you expected? Use the matching problem in the classroom to assure you fully understand what was computed here."
]
},
{
"cell_type": "code",
"execution_count": 115,
"metadata": {},
"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eTnJxVT1/GocyMhMYk6Pb/hvgncBl7fLPQjaXrwk52uZAksXAHwI/n2XdM/WrR8YyHklewyDw76iqb4+n62MzjjF5F/CuJBuA1wJvSPLPVfXXYzmCSd8Yme8J+AyvvGn56WnanAs8w+CG5ZI2f25bduxNyw3TrL+fM+tG7ljGBFjP4Guzl036GOc4DosZ3KA+j/+/SXfBMW2u55U36e5q8xfwypt0TzO46TfrNhfqNKbxCIP7Pl+Y9PEtlDE5Zt1LGfON3IkP4gR+aG8E7gP2Ad8fCq51wFeG2r2fwY2WKeC6ofo64HEGd97/kfap5mP2caaF/ljGpLV7DnikTV+a9LHOYSw2MHii5KfAja32CeBdbf61wL+0Y3sQeNPQuje29Z7ilU91HbfNM2Ua9XgAb2fwoMOjQ78Xx504LeRpHL8jQ8vHHvp+DYMkdaTHp3ckqVuGviR1xNCXpI4Y+pLUEUNfkjpi6EtSRwx9SerI/wHlALuvjI417QAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"diffs = np.array(p_diffs)\n",
"\n",
"plt.hist(diffs);"
]
},
{
"cell_type": "code",
"execution_count": 124,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"10000"
]
},
"execution_count": 124,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(p_diffs)"
]
},
{
"cell_type": "code",
"execution_count": 126,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD4CAYAAAAAczaOAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAQV0lEQVR4nO3df6xfdX3H8edrRTGbOsradV3brGi6P8ofQ9Ygif7BwgalGIv/GEimHZrUZJBoZrJU+QOjIUGdP0LmMFUbS4YyNjU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lyng2qH6BuBxBnfi/5H2iedp+ziTQn8s49HaPQc80qYvTvpYTzAGmxg8UfJj4IZW+zjwzjb/OuBf2zE9ALxpaN0b2npPcfyTXK/a5pkyjXo8gLczeLjh0aGfh1edLC3WaRw/H0PLxxL6fg2DJHXEp3ckqSOGviR1xNCXpI4Y+pLUEUNfkjpi6EtSRwx9SerI/wO55bYqXTcbaAAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"null_vals = np.random.normal(0, diffs.std(), diffs.size)\n",
"plt.hist(null_vals);"
]