-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresearch_analysis.html
More file actions
2372 lines (2261 loc) · 149 KB
/
Copy pathresearch_analysis.html
File metadata and controls
2372 lines (2261 loc) · 149 KB
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.6.42">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>Panel Quality vs Quantity for Advertising Measurement</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
vertical-align: middle;
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
}
pre.numberSource { margin-left: 3em; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
</style>
<script src="research_analysis_files/libs/clipboard/clipboard.min.js"></script>
<script src="research_analysis_files/libs/quarto-html/quarto.js"></script>
<script src="research_analysis_files/libs/quarto-html/popper.min.js"></script>
<script src="research_analysis_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="research_analysis_files/libs/quarto-html/anchor.min.js"></script>
<link href="research_analysis_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="research_analysis_files/libs/quarto-html/quarto-syntax-highlighting-dark-b53751a350365c71b6c909e95f209ed1.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="research_analysis_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="research_analysis_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="research_analysis_files/libs/bootstrap/bootstrap-a08dec4820c4dacc752ef0bf3d412b40.min.css" rel="stylesheet" append-hash="true" id="quarto-bootstrap" data-mode="dark">
<script src="research_analysis_files/libs/kePrint-0.0.1/kePrint.js"></script>
<link href="research_analysis_files/libs/lightable-0.0.1/lightable.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js" type="text/javascript"></script>
<script type="text/javascript">
const typesetMath = (el) => {
if (window.MathJax) {
// MathJax Typeset
window.MathJax.typeset([el]);
} else if (window.katex) {
// KaTeX Render
var mathElements = el.getElementsByClassName("math");
var macros = [];
for (var i = 0; i < mathElements.length; i++) {
var texText = mathElements[i].firstChild;
if (mathElements[i].tagName == "SPAN") {
window.katex.render(texText.data, mathElements[i], {
displayMode: mathElements[i].classList.contains('display'),
throwOnError: false,
macros: macros,
fleqn: false
});
}
}
}
}
window.Quarto = {
typesetMath
};
</script>
</head>
<body>
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
<nav id="TOC" role="doc-toc" class="toc-active">
<h2 id="toc-title">Table of contents</h2>
<ul>
<li><a href="#executive-summary" id="toc-executive-summary" class="nav-link active" data-scroll-target="#executive-summary"><span class="header-section-number">1</span> Executive Summary</a>
<ul class="collapse">
<li><a href="#research-question" id="toc-research-question" class="nav-link" data-scroll-target="#research-question"><span class="header-section-number">1.1</span> Research Question</a></li>
<li><a href="#the-core-trade-off" id="toc-the-core-trade-off" class="nav-link" data-scroll-target="#the-core-trade-off"><span class="header-section-number">1.2</span> The Core Trade-off</a></li>
<li><a href="#key-research-contribution" id="toc-key-research-contribution" class="nav-link" data-scroll-target="#key-research-contribution"><span class="header-section-number">1.3</span> Key Research Contribution</a></li>
<li><a href="#key-finding-large-sparse-wins-for-multi-advertiser-platforms" id="toc-key-finding-large-sparse-wins-for-multi-advertiser-platforms" class="nav-link" data-scroll-target="#key-finding-large-sparse-wins-for-multi-advertiser-platforms"><span class="header-section-number">1.4</span> Key Finding: Large Sparse Wins for Multi-Advertiser Platforms</a>
<ul class="collapse">
<li><a href="#single-campaign-quality-from-simulation" id="toc-single-campaign-quality-from-simulation" class="nav-link" data-scroll-target="#single-campaign-quality-from-simulation"><span class="header-section-number">1.4.1</span> Single Campaign Quality (from simulation):</a></li>
<li><a href="#but-the-decisive-factor-panel-congestion" id="toc-but-the-decisive-factor-panel-congestion" class="nav-link" data-scroll-target="#but-the-decisive-factor-panel-congestion"><span class="header-section-number">1.4.2</span> But the Decisive Factor: Panel Congestion</a></li>
</ul></li>
</ul></li>
<li><a href="#research-motivation" id="toc-research-motivation" class="nav-link" data-scroll-target="#research-motivation"><span class="header-section-number">2</span> Research Motivation</a>
<ul class="collapse">
<li><a href="#the-itv-business-problem" id="toc-the-itv-business-problem" class="nav-link" data-scroll-target="#the-itv-business-problem"><span class="header-section-number">2.1</span> The ITV Business Problem</a></li>
<li><a href="#why-this-matters" id="toc-why-this-matters" class="nav-link" data-scroll-target="#why-this-matters"><span class="header-section-number">2.2</span> Why This Matters</a></li>
</ul></li>
<li><a href="#theoretical-framework" id="toc-theoretical-framework" class="nav-link" data-scroll-target="#theoretical-framework"><span class="header-section-number">3</span> Theoretical Framework</a>
<ul class="collapse">
<li><a href="#data-generating-process" id="toc-data-generating-process" class="nav-link" data-scroll-target="#data-generating-process"><span class="header-section-number">3.1</span> Data Generating Process</a>
<ul class="collapse">
<li><a href="#population" id="toc-population" class="nav-link" data-scroll-target="#population"><span class="header-section-number">3.1.1</span> Population</a></li>
<li><a href="#treatment-assignment-ad-exposure" id="toc-treatment-assignment-ad-exposure" class="nav-link" data-scroll-target="#treatment-assignment-ad-exposure"><span class="header-section-number">3.1.2</span> Treatment Assignment (Ad Exposure)</a></li>
<li><a href="#outcome-purchase" id="toc-outcome-purchase" class="nav-link" data-scroll-target="#outcome-purchase"><span class="header-section-number">3.1.3</span> Outcome (Purchase)</a></li>
</ul></li>
<li><a href="#measurement-error-model" id="toc-measurement-error-model" class="nav-link" data-scroll-target="#measurement-error-model"><span class="header-section-number">3.2</span> Measurement Error Model</a></li>
<li><a href="#estimation-strategy" id="toc-estimation-strategy" class="nav-link" data-scroll-target="#estimation-strategy"><span class="header-section-number">3.3</span> Estimation Strategy</a>
<ul class="collapse">
<li><a href="#unadjusted-estimator" id="toc-unadjusted-estimator" class="nav-link" data-scroll-target="#unadjusted-estimator"><span class="header-section-number">3.3.1</span> Unadjusted Estimator</a></li>
<li><a href="#adjusted-estimator-frequentist" id="toc-adjusted-estimator-frequentist" class="nav-link" data-scroll-target="#adjusted-estimator-frequentist"><span class="header-section-number">3.3.2</span> Adjusted Estimator (Frequentist)</a></li>
</ul></li>
</ul></li>
<li><a href="#decision-theoretic-framework" id="toc-decision-theoretic-framework" class="nav-link" data-scroll-target="#decision-theoretic-framework"><span class="header-section-number">4</span> Decision-Theoretic Framework</a>
<ul class="collapse">
<li><a href="#the-advertisers-problem" id="toc-the-advertisers-problem" class="nav-link" data-scroll-target="#the-advertisers-problem"><span class="header-section-number">4.1</span> The Advertiser’s Problem</a></li>
<li><a href="#expected-utility-under-uncertainty" id="toc-expected-utility-under-uncertainty" class="nav-link" data-scroll-target="#expected-utility-under-uncertainty"><span class="header-section-number">4.2</span> Expected Utility Under Uncertainty</a></li>
<li><a href="#decision-metrics" id="toc-decision-metrics" class="nav-link" data-scroll-target="#decision-metrics"><span class="header-section-number">4.3</span> Decision Metrics</a></li>
</ul></li>
<li><a href="#research-hypotheses" id="toc-research-hypotheses" class="nav-link" data-scroll-target="#research-hypotheses"><span class="header-section-number">5</span> Research Hypotheses</a>
<ul class="collapse">
<li><a href="#h1-quality-wins-with-high-confounding" id="toc-h1-quality-wins-with-high-confounding" class="nav-link" data-scroll-target="#h1-quality-wins-with-high-confounding"><span class="header-section-number">5.1</span> H1: Quality Wins with High Confounding</a></li>
<li><a href="#h2-quantity-wins-with-low-confounding" id="toc-h2-quantity-wins-with-low-confounding" class="nav-link" data-scroll-target="#h2-quantity-wins-with-low-confounding"><span class="header-section-number">5.2</span> H2: Quantity Wins with Low Confounding</a></li>
<li><a href="#h3-measurement-error-hurts-ls-more" id="toc-h3-measurement-error-hurts-ls-more" class="nav-link" data-scroll-target="#h3-measurement-error-hurts-ls-more"><span class="header-section-number">5.3</span> H3: Measurement Error Hurts LS More</a></li>
<li><a href="#h4-cross-over-point-depends-on-effect-size" id="toc-h4-cross-over-point-depends-on-effect-size" class="nav-link" data-scroll-target="#h4-cross-over-point-depends-on-effect-size"><span class="header-section-number">5.4</span> H4: Cross-over Point Depends on Effect Size</a></li>
</ul></li>
<li><a href="#simulation-design" id="toc-simulation-design" class="nav-link" data-scroll-target="#simulation-design"><span class="header-section-number">6</span> Simulation Design</a>
<ul class="collapse">
<li><a href="#parameter-space" id="toc-parameter-space" class="nav-link" data-scroll-target="#parameter-space"><span class="header-section-number">6.1</span> Parameter Space</a></li>
<li><a href="#workflow" id="toc-workflow" class="nav-link" data-scroll-target="#workflow"><span class="header-section-number">6.2</span> Workflow</a></li>
</ul></li>
<li><a href="#implementation" id="toc-implementation" class="nav-link" data-scroll-target="#implementation"><span class="header-section-number">7</span> Implementation</a>
<ul class="collapse">
<li><a href="#setup" id="toc-setup" class="nav-link" data-scroll-target="#setup"><span class="header-section-number">7.1</span> Setup</a></li>
<li><a href="#configuration" id="toc-configuration" class="nav-link" data-scroll-target="#configuration"><span class="header-section-number">7.2</span> Configuration</a></li>
<li><a href="#data-generating-process-demonstration" id="toc-data-generating-process-demonstration" class="nav-link" data-scroll-target="#data-generating-process-demonstration"><span class="header-section-number">7.3</span> Data Generating Process Demonstration</a></li>
<li><a href="#outcomes-with-confounding-and-measurement-error" id="toc-outcomes-with-confounding-and-measurement-error" class="nav-link" data-scroll-target="#outcomes-with-confounding-and-measurement-error"><span class="header-section-number">7.4</span> Outcomes with Confounding and Measurement Error</a></li>
<li><a href="#estimation-example" id="toc-estimation-example" class="nav-link" data-scroll-target="#estimation-example"><span class="header-section-number">7.5</span> Estimation Example</a></li>
</ul></li>
<li><a href="#simulation-results" id="toc-simulation-results" class="nav-link" data-scroll-target="#simulation-results"><span class="header-section-number">8</span> Simulation Results</a>
<ul class="collapse">
<li><a href="#run-simulation" id="toc-run-simulation" class="nav-link" data-scroll-target="#run-simulation"><span class="header-section-number">8.1</span> Run Simulation</a></li>
<li><a href="#summary-statistics" id="toc-summary-statistics" class="nav-link" data-scroll-target="#summary-statistics"><span class="header-section-number">8.2</span> Summary Statistics</a></li>
<li><a href="#key-findings-table" id="toc-key-findings-table" class="nav-link" data-scroll-target="#key-findings-table"><span class="header-section-number">8.3</span> Key Findings Table</a></li>
<li><a href="#visualizations" id="toc-visualizations" class="nav-link" data-scroll-target="#visualizations"><span class="header-section-number">8.4</span> Visualizations</a>
<ul class="collapse">
<li><a href="#bias-variance-trade-off" id="toc-bias-variance-trade-off" class="nav-link" data-scroll-target="#bias-variance-trade-off"><span class="header-section-number">8.4.1</span> Bias-Variance Trade-off</a></li>
<li><a href="#decision-accuracy" id="toc-decision-accuracy" class="nav-link" data-scroll-target="#decision-accuracy"><span class="header-section-number">8.4.2</span> Decision Accuracy</a></li>
<li><a href="#utility-loss-cost-of-uncertainty" id="toc-utility-loss-cost-of-uncertainty" class="nav-link" data-scroll-target="#utility-loss-cost-of-uncertainty"><span class="header-section-number">8.4.3</span> Utility Loss (Cost of Uncertainty)</a></li>
<li><a href="#cross-over-analysis" id="toc-cross-over-analysis" class="nav-link" data-scroll-target="#cross-over-analysis"><span class="header-section-number">8.4.4</span> Cross-over Analysis</a></li>
</ul></li>
</ul></li>
<li><a href="#discussion" id="toc-discussion" class="nav-link" data-scroll-target="#discussion"><span class="header-section-number">9</span> Discussion</a>
<ul class="collapse">
<li><a href="#hypothesis-testing" id="toc-hypothesis-testing" class="nav-link" data-scroll-target="#hypothesis-testing"><span class="header-section-number">9.1</span> Hypothesis Testing</a>
<ul class="collapse">
<li><a href="#h1-quality-wins-with-high-confounding-1" id="toc-h1-quality-wins-with-high-confounding-1" class="nav-link" data-scroll-target="#h1-quality-wins-with-high-confounding-1"><span class="header-section-number">9.1.1</span> H1: Quality Wins with High Confounding ✓</a></li>
<li><a href="#h2-quantity-wins-with-low-confounding-1" id="toc-h2-quantity-wins-with-low-confounding-1" class="nav-link" data-scroll-target="#h2-quantity-wins-with-low-confounding-1"><span class="header-section-number">9.1.2</span> H2: Quantity Wins with Low Confounding</a></li>
<li><a href="#h3-measurement-error-impact" id="toc-h3-measurement-error-impact" class="nav-link" data-scroll-target="#h3-measurement-error-impact"><span class="header-section-number">9.1.3</span> H3: Measurement Error Impact</a></li>
</ul></li>
<li><a href="#decision-rules-for-practitioners" id="toc-decision-rules-for-practitioners" class="nav-link" data-scroll-target="#decision-rules-for-practitioners"><span class="header-section-number">9.2</span> Decision Rules for Practitioners</a>
<ul class="collapse">
<li><a href="#recommended-panel-selection" id="toc-recommended-panel-selection" class="nav-link" data-scroll-target="#recommended-panel-selection"><span class="header-section-number">9.2.1</span> Recommended Panel Selection</a></li>
<li><a href="#investment-guidance" id="toc-investment-guidance" class="nav-link" data-scroll-target="#investment-guidance"><span class="header-section-number">9.2.2</span> Investment Guidance</a></li>
</ul></li>
<li><a href="#meta-analysis-and-contextual-factors" id="toc-meta-analysis-and-contextual-factors" class="nav-link" data-scroll-target="#meta-analysis-and-contextual-factors"><span class="header-section-number">9.3</span> Meta-Analysis and Contextual Factors</a>
<ul class="collapse">
<li><a href="#industry-benchmarks-for-advertising-effects" id="toc-industry-benchmarks-for-advertising-effects" class="nav-link" data-scroll-target="#industry-benchmarks-for-advertising-effects"><span class="header-section-number">9.3.1</span> Industry Benchmarks for Advertising Effects</a></li>
<li><a href="#when-confounding-is-likely-high-vs-low" id="toc-when-confounding-is-likely-high-vs-low" class="nav-link" data-scroll-target="#when-confounding-is-likely-high-vs-low"><span class="header-section-number">9.3.2</span> When Confounding is Likely High vs Low</a></li>
<li><a href="#real-world-cost-benefit-analysis" id="toc-real-world-cost-benefit-analysis" class="nav-link" data-scroll-target="#real-world-cost-benefit-analysis"><span class="header-section-number">9.3.3</span> Real-World Cost-Benefit Analysis</a></li>
<li><a href="#category-specific-guidance" id="toc-category-specific-guidance" class="nav-link" data-scroll-target="#category-specific-guidance"><span class="header-section-number">9.3.4</span> Category-Specific Guidance</a></li>
<li><a href="#the-unknown-confounding-problem" id="toc-the-unknown-confounding-problem" class="nav-link" data-scroll-target="#the-unknown-confounding-problem"><span class="header-section-number">9.3.5</span> The “Unknown Confounding” Problem</a></li>
<li><a href="#temporal-considerations" id="toc-temporal-considerations" class="nav-link" data-scroll-target="#temporal-considerations"><span class="header-section-number">9.3.6</span> Temporal Considerations</a></li>
<li><a href="#the-multi-advertiser-platform-problem-panel-congestion" id="toc-the-multi-advertiser-platform-problem-panel-congestion" class="nav-link" data-scroll-target="#the-multi-advertiser-platform-problem-panel-congestion"><span class="header-section-number">9.3.7</span> The Multi-Advertiser Platform Problem: Panel Congestion</a></li>
</ul></li>
<li><a href="#limitations" id="toc-limitations" class="nav-link" data-scroll-target="#limitations"><span class="header-section-number">9.4</span> Limitations</a></li>
</ul></li>
<li><a href="#conclusions" id="toc-conclusions" class="nav-link" data-scroll-target="#conclusions"><span class="header-section-number">10</span> Conclusions</a>
<ul class="collapse">
<li><a href="#key-findings" id="toc-key-findings" class="nav-link" data-scroll-target="#key-findings"><span class="header-section-number">10.1</span> Key Findings</a>
<ul class="collapse">
<li><a href="#statistical-performance-single-campaign-view" id="toc-statistical-performance-single-campaign-view" class="nav-link" data-scroll-target="#statistical-performance-single-campaign-view"><span class="header-section-number">10.1.1</span> Statistical Performance (Single Campaign View)</a></li>
<li><a href="#operational-reality-multi-advertiser-platform-view" id="toc-operational-reality-multi-advertiser-platform-view" class="nav-link" data-scroll-target="#operational-reality-multi-advertiser-platform-view"><span class="header-section-number">10.1.2</span> Operational Reality (Multi-Advertiser Platform View)</a></li>
</ul></li>
<li><a href="#practical-implications" id="toc-practical-implications" class="nav-link" data-scroll-target="#practical-implications"><span class="header-section-number">10.2</span> Practical Implications</a>
<ul class="collapse">
<li><a href="#for-multi-advertiser-platforms-itv-tv-networks-publishers" id="toc-for-multi-advertiser-platforms-itv-tv-networks-publishers" class="nav-link" data-scroll-target="#for-multi-advertiser-platforms-itv-tv-networks-publishers"><span class="header-section-number">10.2.1</span> For Multi-Advertiser Platforms (ITV, TV networks, publishers):</a></li>
<li><a href="#for-single-advertiser-use-cases-dedicated-panels" id="toc-for-single-advertiser-use-cases-dedicated-panels" class="nav-link" data-scroll-target="#for-single-advertiser-use-cases-dedicated-panels"><span class="header-section-number">10.2.2</span> For Single Advertiser Use Cases (dedicated panels):</a></li>
</ul></li>
<li><a href="#future-research" id="toc-future-research" class="nav-link" data-scroll-target="#future-research"><span class="header-section-number">10.3</span> Future Research</a></li>
</ul></li>
<li><a href="#technical-appendix" id="toc-technical-appendix" class="nav-link" data-scroll-target="#technical-appendix"><span class="header-section-number">11</span> Technical Appendix</a>
<ul class="collapse">
<li><a href="#session-information" id="toc-session-information" class="nav-link" data-scroll-target="#session-information"><span class="header-section-number">11.1</span> Session Information</a></li>
<li><a href="#references" id="toc-references" class="nav-link" data-scroll-target="#references"><span class="header-section-number">11.2</span> References</a></li>
</ul></li>
</ul>
<div class="quarto-alternate-formats"><h2>Other Formats</h2><ul><li><a href="research_analysis.pdf"><i class="bi bi-file-pdf"></i>PDF</a></li></ul></div></nav>
</div>
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">Panel Quality vs Quantity for Advertising Measurement</h1>
<p class="subtitle lead">A Decision-Theoretic Simulation Study</p>
</div>
<div class="quarto-title-meta">
</div>
</header>
<section id="executive-summary" class="level1" data-number="1">
<h1 data-number="1"><span class="header-section-number">1</span> Executive Summary</h1>
<section id="research-question" class="level2" data-number="1.1">
<h2 data-number="1.1" class="anchored" data-anchor-id="research-question"><span class="header-section-number">1.1</span> Research Question</h2>
<p><strong>When measuring advertising effectiveness, is it better to invest in a large but sparse panel (many individuals, few covariates, noisy measurements) or a small but rich panel (fewer individuals, many covariates, clean measurements)?</strong></p>
</section>
<section id="the-core-trade-off" class="level2" data-number="1.2">
<h2 data-number="1.2" class="anchored" data-anchor-id="the-core-trade-off"><span class="header-section-number">1.2</span> The Core Trade-off</h2>
<p>We compare two panel designs for measuring ITVX advertising effectiveness:</p>
<table class="caption-top table">
<colgroup>
<col style="width: 20%">
<col style="width: 42%">
<col style="width: 37%">
</colgroup>
<thead>
<tr class="header">
<th>Feature</th>
<th>Large Sparse (LS)</th>
<th>Small Rich (SR)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><strong>Sample size</strong></td>
<td>50,000</td>
<td>4,000</td>
</tr>
<tr class="even">
<td><strong>Sampling</strong></td>
<td>Biased (young, urban, wealthy over-represented)</td>
<td>Representative (SRS)</td>
</tr>
<tr class="odd">
<td><strong>Covariates</strong></td>
<td>Age, gender only</td>
<td>Age, gender, income, region, purchase history, media consumption, online shopper, brand awareness</td>
</tr>
<tr class="even">
<td><strong>Treatment tracking</strong></td>
<td>85% accuracy</td>
<td>98% accuracy</td>
</tr>
<tr class="odd">
<td><strong>Outcome linkage</strong></td>
<td>60% match rate</td>
<td>95% match rate</td>
</tr>
<tr class="even">
<td><strong>R² (treatment ~ X)</strong></td>
<td>~0.30</td>
<td>~0.80</td>
</tr>
</tbody>
</table>
<p><strong>Critical insight</strong>: LS can only adjust for 30% of confounding, while SR adjusts for 80%, but LS has 12.5× more observations.</p>
</section>
<section id="key-research-contribution" class="level2" data-number="1.3">
<h2 data-number="1.3" class="anchored" data-anchor-id="key-research-contribution"><span class="header-section-number">1.3</span> Key Research Contribution</h2>
<p>This study quantifies the <strong>confounding-precision trade-off</strong> using a <strong>decision-theoretic framework</strong> that converts statistical estimates into real business outcomes (£ profits/losses). We answer: <em>When does data quality beat data quantity for advertising measurement?</em></p>
</section>
<section id="key-finding-large-sparse-wins-for-multi-advertiser-platforms" class="level2" data-number="1.4">
<h2 data-number="1.4" class="anchored" data-anchor-id="key-finding-large-sparse-wins-for-multi-advertiser-platforms"><span class="header-section-number">1.4</span> Key Finding: Large Sparse Wins for Multi-Advertiser Platforms</h2>
<p><strong>While the statistical story is nuanced, the operational reality for ITV is clear</strong>:</p>
<section id="single-campaign-quality-from-simulation" class="level3" data-number="1.4.1">
<h3 data-number="1.4.1" class="anchored" data-anchor-id="single-campaign-quality-from-simulation"><span class="header-section-number">1.4.1</span> Single Campaign Quality (from simulation):</h3>
<ul>
<li><strong>High confounding</strong> (sophisticated targeting): Small Rich wins - saves £15-20k per campaign</li>
<li><strong>Low confounding</strong> (broad reach): Similar performance</li>
<li><strong>Industry benchmarks</strong> (Lewis & Rao 2015): Typical ad lift is 1-5%, median ~2-3%</li>
<li><strong>Our effect (0.18)</strong>: Represents a strong, above-median campaign</li>
</ul>
</section>
<section id="but-the-decisive-factor-panel-congestion" class="level3" data-number="1.4.2">
<h3 data-number="1.4.2" class="anchored" data-anchor-id="but-the-decisive-factor-panel-congestion"><span class="header-section-number">1.4.2</span> But the Decisive Factor: Panel Congestion</h3>
<p><strong>For multi-advertiser platforms like ITV</strong>:</p>
<table class="caption-top table">
<colgroup>
<col style="width: 15%">
<col style="width: 32%">
<col style="width: 35%">
<col style="width: 16%">
</colgroup>
<thead>
<tr class="header">
<th>Factor</th>
<th>Small Rich (4k)</th>
<th>Large Sparse (50k)</th>
<th>Winner</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><strong>Single campaign quality</strong></td>
<td>Excellent</td>
<td>Good</td>
<td>Small Rich ✓</td>
</tr>
<tr class="even">
<td><strong>Multi-advertiser capacity</strong></td>
<td>10-20 campaigns/year</td>
<td>200+ campaigns/year</td>
<td><strong>Large Sparse ✓✓✓</strong></td>
</tr>
<tr class="odd">
<td><strong>Panel fatigue</strong></td>
<td>High (over-surveyed)</td>
<td>Low (sustainable)</td>
<td><strong>Large Sparse ✓</strong></td>
</tr>
<tr class="even">
<td><strong>Cost per advertiser</strong></td>
<td>£13k</td>
<td>£1k</td>
<td><strong>Large Sparse ✓</strong></td>
</tr>
<tr class="odd">
<td><strong>Treatment isolation</strong></td>
<td>Conflated effects</td>
<td>Clean separation</td>
<td><strong>Large Sparse ✓</strong></td>
</tr>
</tbody>
</table>
<p><strong>Bottom line</strong>: With 50+ advertisers and 200+ campaigns/year, Small Rich would require each person to be in ~50 campaigns annually → <strong>panel fatigue makes it unusable</strong>. Would need 10-20 separate panels (40-80k people) at £5-10M/year, defeating the purpose.</p>
<p><strong>Practical implication</strong>: For ITV’s multi-advertiser platform, <strong>Large Sparse (50k) is the only viable option</strong>. The slight increase in per-campaign confounding bias is far outweighed by scalability, sustainability, and economics. The alternative (£5-10M for multiple Small Rich panels) is economically infeasible.</p>
<hr>
</section>
</section>
</section>
<section id="research-motivation" class="level1" data-number="2">
<h1 data-number="2"><span class="header-section-number">2</span> Research Motivation</h1>
<section id="the-itv-business-problem" class="level2" data-number="2.1">
<h2 data-number="2.1" class="anchored" data-anchor-id="the-itv-business-problem"><span class="header-section-number">2.1</span> The ITV Business Problem</h2>
<p>ITV wants to measure whether ITVX advertising drives sales. Key challenges:</p>
<ol type="1">
<li><strong>Small effects</strong>: Advertising typically lifts purchase probability by 5-25%</li>
<li><strong>Rare outcomes</strong>: Purchase rates ≈ 1%</li>
<li><strong>Confounding</strong>: Targeted advertising creates correlation between ad exposure and purchase propensity</li>
<li><strong>Measurement error</strong>: Incomplete ad tracking and outcome linkage</li>
<li><strong>Cost constraints</strong>: Budget must be allocated between N and covariate richness</li>
</ol>
</section>
<section id="why-this-matters" class="level2" data-number="2.2">
<h2 data-number="2.2" class="anchored" data-anchor-id="why-this-matters"><span class="header-section-number">2.2</span> Why This Matters</h2>
<ul>
<li><strong>Practical</strong>: Guides investment in panel infrastructure</li>
<li><strong>Methodological</strong>: Quantifies confounding-precision trade-off in advertising measurement</li>
<li><strong>Decision-focused</strong>: Evaluates panels by business outcomes (£), not just statistical metrics</li>
<li><strong>Generalizable</strong>: Framework applies to any digital advertising measurement context</li>
</ul>
<hr>
</section>
</section>
<section id="theoretical-framework" class="level1" data-number="3">
<h1 data-number="3"><span class="header-section-number">3</span> Theoretical Framework</h1>
<section id="data-generating-process" class="level2" data-number="3.1">
<h2 data-number="3.1" class="anchored" data-anchor-id="data-generating-process"><span class="header-section-number">3.1</span> Data Generating Process</h2>
<section id="population" class="level3" data-number="3.1.1">
<h3 data-number="3.1.1" class="anchored" data-anchor-id="population"><span class="header-section-number">3.1.1</span> Population</h3>
<p>UK-like reference population (N=5 million) with demographics <span class="math inline">\(X = \{age, gender, income, region, ...\}\)</span></p>
</section>
<section id="treatment-assignment-ad-exposure" class="level3" data-number="3.1.2">
<h3 data-number="3.1.2" class="anchored" data-anchor-id="treatment-assignment-ad-exposure"><span class="header-section-number">3.1.2</span> Treatment Assignment (Ad Exposure)</h3>
<p><span class="math display">\[P(T_i = 1 | X_i) = \text{logit}^{-1}\left(\alpha_0 + \sum_j \alpha_j X_{ij}\right)\]</span></p>
<p>Demographics drive exposure through <strong>ad targeting</strong>, creating selection on observables.</p>
</section>
<section id="outcome-purchase" class="level3" data-number="3.1.3">
<h3 data-number="3.1.3" class="anchored" data-anchor-id="outcome-purchase"><span class="header-section-number">3.1.3</span> Outcome (Purchase)</h3>
<p><span class="math display">\[P(Y_i = 1 | T_i, X_i) = \text{logit}^{-1}\left(\beta_0 + \tau \cdot T_i + \sum_j \beta_j X_{ij}\right)\]</span></p>
<p>Same demographics that drive targeting also drive purchase, creating <strong>confounding</strong>: <span class="math inline">\(Cov(T, Y | X) \neq 0\)</span></p>
<p><strong>Critical point</strong>: True effect <span class="math inline">\(\tau\)</span> is confounded unless we control for <span class="math inline">\(X\)</span></p>
</section>
</section>
<section id="measurement-error-model" class="level2" data-number="3.2">
<h2 data-number="3.2" class="anchored" data-anchor-id="measurement-error-model"><span class="header-section-number">3.2</span> Measurement Error Model</h2>
<p><strong>Treatment</strong> (observed ad exposure): <span class="math display">\[P(T^{obs}_i = 1 | T^{true}_i) = \begin{cases}
\rho_T & \text{if } T^{true}_i = 1 \\
1 - \rho_T & \text{if } T^{true}_i = 0
\end{cases}\]</span></p>
<p>where <span class="math inline">\(\rho_T \in \{0.85, 0.98\}\)</span> for LS and SR respectively.</p>
<p><strong>Outcome</strong> (observed purchase): <span class="math display">\[P(Y^{obs}_i = 1 | Y^{true}_i) = \begin{cases}
\rho_Y & \text{if } Y^{true}_i = 1 \\
1 - \rho_Y & \text{if } Y^{true}_i = 0
\end{cases}\]</span></p>
<p>where <span class="math inline">\(\rho_Y \in \{0.60, 0.95\}\)</span> for LS and SR respectively.</p>
<p><strong>Effect</strong>: Measurement error causes <strong>attenuation bias</strong> that doesn’t vanish as <span class="math inline">\(n \to \infty\)</span></p>
</section>
<section id="estimation-strategy" class="level2" data-number="3.3">
<h2 data-number="3.3" class="anchored" data-anchor-id="estimation-strategy"><span class="header-section-number">3.3</span> Estimation Strategy</h2>
<section id="unadjusted-estimator" class="level3" data-number="3.3.1">
<h3 data-number="3.3.1" class="anchored" data-anchor-id="unadjusted-estimator"><span class="header-section-number">3.3.1</span> Unadjusted Estimator</h3>
<p>Simple difference in means (biased under confounding)</p>
</section>
<section id="adjusted-estimator-frequentist" class="level3" data-number="3.3.2">
<h3 data-number="3.3.2" class="anchored" data-anchor-id="adjusted-estimator-frequentist"><span class="header-section-number">3.3.2</span> Adjusted Estimator (Frequentist)</h3>
<p>Logistic regression controlling for available covariates: <span class="math display">\[\text{logit}(P(Y_i = 1)) = \beta_0 + \tau \cdot T_i + \sum_j \gamma_j X_{ij}\]</span></p>
<p><strong>Expected bias</strong>: - LS: Moderate (residual confounding from unobserved X) - SR: Low (most confounding explained by rich covariates)</p>
<hr>
</section>
</section>
</section>
<section id="decision-theoretic-framework" class="level1" data-number="4">
<h1 data-number="4"><span class="header-section-number">4</span> Decision-Theoretic Framework</h1>
<section id="the-advertisers-problem" class="level2" data-number="4.1">
<h2 data-number="4.1" class="anchored" data-anchor-id="the-advertisers-problem"><span class="header-section-number">4.1</span> The Advertiser’s Problem</h2>
<p><strong>Decision</strong>: <span class="math inline">\(d \in \{\text{Run campaign}, \text{Don't run}\}\)</span></p>
<p><strong>Campaign parameters</strong> (configured in <code>R/config.R</code>):</p>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code>Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026</code></pre>
</div>
<div class="cell-output-display">
<table class="table table-striped table-hover caption-top table-sm small" data-quarto-postprocess="true">
<caption>Decision Parameters for Campaign Profitability</caption>
<thead>
<tr class="header">
<th style="text-align: left;" data-quarto-table-cell-role="th">Parameter</th>
<th style="text-align: left;" data-quarto-table-cell-role="th">Value</th>
<th style="text-align: left;" data-quarto-table-cell-role="th">Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">Ad Cost</td>
<td style="text-align: left;">£200,000</td>
<td style="text-align: left;">Total campaign media spend (typical ITVX campaign)</td>
</tr>
<tr class="even">
<td style="text-align: left;">Revenue per Conversion</td>
<td style="text-align: left;">£50</td>
<td style="text-align: left;">Average order value per conversion</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Gross Margin</td>
<td style="text-align: left;">50%</td>
<td style="text-align: left;">Profit margin on each sale</td>
</tr>
<tr class="even">
<td style="text-align: left;">Impressions</td>
<td style="text-align: left;">1,000,000</td>
<td style="text-align: left;">Number of ad impressions delivered</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Baseline Purchase Rate</td>
<td style="text-align: left;">30%</td>
<td style="text-align: left;">Baseline conversion rate without advertising</td>
</tr>
</tbody>
</table>
</div>
</div>
<p><strong>Payoff from running campaign</strong>: <span class="math display">\[\text{Profit}(\tau) = [\text{Lift} \times \text{Impressions} \times \text{Revenue} \times \text{Margin}] - \text{Ad Cost}\]</span></p>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code>**Break-even lift**: Campaign is profitable if lift > 2.7%</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>**Break-even effect (log-odds)**: 0.026</code></pre>
</div>
</div>
</section>
<section id="expected-utility-under-uncertainty" class="level2" data-number="4.2">
<h2 data-number="4.2" class="anchored" data-anchor-id="expected-utility-under-uncertainty"><span class="header-section-number">4.2</span> Expected Utility Under Uncertainty</h2>
<p>Given estimate <span class="math inline">\(\hat{\tau}\)</span> with standard error <span class="math inline">\(se\)</span>, simulate uncertainty: <span class="math display">\[\tau^{(s)} \sim N(\hat{\tau}, se) \text{ for } s = 1, ..., 1000\]</span></p>
<p>Compute expected utility: <span class="math display">\[EU(\text{Run} | \hat{\tau}) = \frac{1}{1000} \sum_{s=1}^{1000} \text{Profit}(\tau^{(s)})\]</span></p>
<p><strong>Decision rule</strong>: Run campaign if <span class="math inline">\(EU(\text{Run} | \hat{\tau}) > 0\)</span></p>
</section>
<section id="decision-metrics" class="level2" data-number="4.3">
<h2 data-number="4.3" class="anchored" data-anchor-id="decision-metrics"><span class="header-section-number">4.3</span> Decision Metrics</h2>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Metric</th>
<th>Definition</th>
<th>Good Value</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><strong>Correct Decision Rate</strong></td>
<td><span class="math inline">\(P(d^* = d^{true})\)</span></td>
<td>High (>0.90)</td>
</tr>
<tr class="even">
<td><strong>Expected Utility</strong></td>
<td><span class="math inline">\(E[U(d^* \| Data)]\)</span></td>
<td>Close to <span class="math inline">\(U^{true}\)</span></td>
</tr>
<tr class="odd">
<td><strong>Utility Loss</strong></td>
<td><span class="math inline">\(\|U^{true} - E[U(d^*)]\|\)</span></td>
<td>Low (minimal £ loss)</td>
</tr>
</tbody>
</table>
<p><strong>Key insight</strong>: A statistically significant result that leads to unprofitable campaigns is bad. A less precise estimate that still makes correct decisions is good.</p>
<hr>
</section>
</section>
<section id="research-hypotheses" class="level1" data-number="5">
<h1 data-number="5"><span class="header-section-number">5</span> Research Hypotheses</h1>
<section id="h1-quality-wins-with-high-confounding" class="level2" data-number="5.1">
<h2 data-number="5.1" class="anchored" data-anchor-id="h1-quality-wins-with-high-confounding"><span class="header-section-number">5.1</span> H1: Quality Wins with High Confounding</h2>
<p>When confounding is severe (gender factor ≥ 5), we predict: - SR has <strong>lower RMSE</strong> than LS (adjusted estimates) - SR has <strong>higher correct decision rate</strong> - SR has <strong>higher expected utility</strong></p>
<p><strong>Mechanism</strong>: LS cannot adequately control for confounding with only 2 covariates</p>
</section>
<section id="h2-quantity-wins-with-low-confounding" class="level2" data-number="5.2">
<h2 data-number="5.2" class="anchored" data-anchor-id="h2-quantity-wins-with-low-confounding"><span class="header-section-number">5.2</span> H2: Quantity Wins with Low Confounding</h2>
<p>When confounding is weak (factor ≤ 1.5), we predict: - LS has <strong>narrower confidence intervals</strong> - LS and SR have <strong>similar utility</strong> (both near optimal) - LS has <strong>higher power</strong> to detect positive effects</p>
<p><strong>Mechanism</strong>: Minimal residual confounding means precision dominates</p>
</section>
<section id="h3-measurement-error-hurts-ls-more" class="level2" data-number="5.3">
<h2 data-number="5.3" class="anchored" data-anchor-id="h3-measurement-error-hurts-ls-more"><span class="header-section-number">5.3</span> H3: Measurement Error Hurts LS More</h2>
<p>We predict larger deterioration in LS performance with measurement error: - Attenuation bias proportional to <span class="math inline">\((1 - \rho_T)(1 - \rho_Y)\)</span> - LS: <span class="math inline">\((0.15)(0.40) = 0.06\)</span> vs SR: <span class="math inline">\((0.02)(0.05) = 0.001\)</span></p>
</section>
<section id="h4-cross-over-point-depends-on-effect-size" class="level2" data-number="5.4">
<h2 data-number="5.4" class="anchored" data-anchor-id="h4-cross-over-point-depends-on-effect-size"><span class="header-section-number">5.4</span> H4: Cross-over Point Depends on Effect Size</h2>
<p>We predict confounding threshold where SR > LS decreases with effect size: - True effect = 0.30: SR wins if confounding > 5 - True effect = 0.18: SR wins if confounding > 2 - True effect = 0.10: SR wins if confounding > 1.5</p>
<hr>
</section>
</section>
<section id="simulation-design" class="level1" data-number="6">
<h1 data-number="6"><span class="header-section-number">6</span> Simulation Design</h1>
<section id="parameter-space" class="level2" data-number="6.1">
<h2 data-number="6.1" class="anchored" data-anchor-id="parameter-space"><span class="header-section-number">6.1</span> Parameter Space</h2>
<p>We simulate across:</p>
<ul>
<li><strong>Panel types</strong>: Large Sparse vs Small Rich (or sample size sweep: 1k to 50k)</li>
<li><strong>Confounding strength</strong>: 1.0, 1.5, 2.0, 3.0, 5.0, 10.0 (gender factor)</li>
<li><strong>True effect</strong>: 0.10, 0.15, 0.18, 0.25, 0.30 (log-odds scale)</li>
<li><strong>Measurement error</strong>: Present vs Absent</li>
<li><strong>Replications</strong>: 50-500 per scenario</li>
</ul>
<p><strong>Current mode</strong>: Sample size sweep (efficient design with 2,100-4,200 simulations)</p>
</section>
<section id="workflow" class="level2" data-number="6.2">
<h2 data-number="6.2" class="anchored" data-anchor-id="workflow"><span class="header-section-number">6.2</span> Workflow</h2>
<p>For each scenario:</p>
<ol type="1">
<li><strong>Generate panel</strong> from reference population (LS: biased sampling, SR: random)</li>
<li><strong>Assign treatment</strong> with confounding (<span class="math inline">\(P(T | X)\)</span> depends on demographics)</li>
<li><strong>Generate outcomes</strong> (<span class="math inline">\(P(Y | T, X)\)</span> depends on treatment AND demographics)</li>
<li><strong>Add measurement error</strong> (panel-specific corruption rates)</li>
<li><strong>Estimate effects</strong> (unadjusted and adjusted)</li>
<li><strong>Compute decision metrics</strong> (optimal decision, expected utility, utility loss)</li>
<li><strong>Aggregate results</strong> across replications</li>
</ol>
<hr>
</section>
</section>
<section id="implementation" class="level1" data-number="7">
<h1 data-number="7"><span class="header-section-number">7</span> Implementation</h1>
<section id="setup" class="level2" data-number="7.1">
<h2 data-number="7.1" class="anchored" data-anchor-id="setup"><span class="header-section-number">7.1</span> Setup</h2>
<div class="cell">
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Override parallelly's localhost worker limit</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="fu">options</span>(<span class="at">parallelly.maxWorkers.localhost =</span> params<span class="sc">$</span>n_cores)</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Load packages</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(here)</span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(cli)</span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(tidyverse)</span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(knitr)</span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(kableExtra)</span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a><span class="co"># Source project modules</span></span>
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="fu">here</span>(<span class="st">"R/config.R"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026</code></pre>
</div>
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="fu">here</span>(<span class="st">"R/population_generator.R"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026</code></pre>
</div>
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="fu">here</span>(<span class="st">"R/panel_generator.R"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026</code></pre>
</div>
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="fu">here</span>(<span class="st">"R/outcome_generator.R"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026</code></pre>
</div>
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="fu">here</span>(<span class="st">"R/estimation.R"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026</code></pre>
</div>
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="fu">here</span>(<span class="st">"R/decision_analysis.R"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026</code></pre>
</div>
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb16"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="fu">here</span>(<span class="st">"R/visualization.R"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026</code></pre>
</div>
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb18"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="fu">here</span>(<span class="st">"R/main_simulation.R"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026
Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026
Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026
Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026
Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026
Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026
Break-even percentage lift: 2.7%
Break-even effect (log-odds): 0.026</code></pre>
</div>
</div>
</section>
<section id="configuration" class="level2" data-number="7.2">
<h2 data-number="7.2" class="anchored" data-anchor-id="configuration"><span class="header-section-number">7.2</span> Configuration</h2>
<div class="cell">
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb20"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a><span class="fu">print_config</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="data-generating-process-demonstration" class="level2" data-number="7.3">
<h2 data-number="7.3" class="anchored" data-anchor-id="data-generating-process-demonstration"><span class="header-section-number">7.3</span> Data Generating Process Demonstration</h2>
<p>To illustrate the DGP without building the full 5M reference population, we demonstrate with a small synthetic population:</p>
<div class="cell">
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb21"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="fu">set.seed</span>(<span class="dv">123</span>)</span>
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a>small_pop <span class="ot"><-</span> <span class="fu">tibble</span>(</span>
<span id="cb21-3"><a href="#cb21-3" aria-hidden="true" tabindex="-1"></a> <span class="at">person_id =</span> <span class="dv">1</span><span class="sc">:</span><span class="dv">20000</span>,</span>
<span id="cb21-4"><a href="#cb21-4" aria-hidden="true" tabindex="-1"></a> <span class="at">age_group =</span> <span class="fu">sample</span>(<span class="dv">1</span><span class="sc">:</span><span class="dv">5</span>, <span class="dv">20000</span>, <span class="at">replace =</span> <span class="cn">TRUE</span>, <span class="at">prob =</span> UK_DEMOGRAPHICS<span class="sc">$</span>age_group),</span>
<span id="cb21-5"><a href="#cb21-5" aria-hidden="true" tabindex="-1"></a> <span class="at">region =</span> <span class="fu">sample</span>(<span class="dv">1</span><span class="sc">:</span><span class="dv">13</span>, <span class="dv">20000</span>, <span class="at">replace =</span> <span class="cn">TRUE</span>, <span class="at">prob =</span> UK_DEMOGRAPHICS<span class="sc">$</span>region),</span>
<span id="cb21-6"><a href="#cb21-6" aria-hidden="true" tabindex="-1"></a> <span class="at">income =</span> <span class="fu">sample</span>(<span class="dv">1</span><span class="sc">:</span><span class="dv">3</span>, <span class="dv">20000</span>, <span class="at">replace =</span> <span class="cn">TRUE</span>, <span class="at">prob =</span> UK_DEMOGRAPHICS<span class="sc">$</span>income),</span>
<span id="cb21-7"><a href="#cb21-7" aria-hidden="true" tabindex="-1"></a> <span class="at">gender =</span> <span class="fu">sample</span>(<span class="dv">1</span><span class="sc">:</span><span class="dv">2</span>, <span class="dv">20000</span>, <span class="at">replace =</span> <span class="cn">TRUE</span>, <span class="at">prob =</span> UK_DEMOGRAPHICS<span class="sc">$</span>gender)</span>
<span id="cb21-8"><a href="#cb21-8" aria-hidden="true" tabindex="-1"></a>) <span class="sc">%>%</span></span>
<span id="cb21-9"><a href="#cb21-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(</span>
<span id="cb21-10"><a href="#cb21-10" aria-hidden="true" tabindex="-1"></a> <span class="at">age_label =</span> <span class="fu">factor</span>(age_group, <span class="at">levels =</span> <span class="dv">1</span><span class="sc">:</span><span class="dv">5</span>,</span>
<span id="cb21-11"><a href="#cb21-11" aria-hidden="true" tabindex="-1"></a> <span class="at">labels =</span> <span class="fu">c</span>(<span class="st">"18-30"</span>,<span class="st">"31-45"</span>,<span class="st">"46-60"</span>,<span class="st">"61-75"</span>,<span class="st">"76+"</span>)),</span>
<span id="cb21-12"><a href="#cb21-12" aria-hidden="true" tabindex="-1"></a> <span class="at">income_label =</span> <span class="fu">factor</span>(income, <span class="at">levels =</span> <span class="dv">1</span><span class="sc">:</span><span class="dv">3</span>, <span class="at">labels =</span> <span class="fu">c</span>(<span class="st">"Low"</span>,<span class="st">"Medium"</span>,<span class="st">"High"</span>)),</span>
<span id="cb21-13"><a href="#cb21-13" aria-hidden="true" tabindex="-1"></a> <span class="at">gender_label =</span> <span class="fu">factor</span>(gender, <span class="at">levels =</span> <span class="dv">1</span><span class="sc">:</span><span class="dv">2</span>, <span class="at">labels =</span> <span class="fu">c</span>(<span class="st">"Male"</span>,<span class="st">"Female"</span>)),</span>
<span id="cb21-14"><a href="#cb21-14" aria-hidden="true" tabindex="-1"></a> <span class="at">purchase_history_latent =</span> <span class="fu">rpois</span>(<span class="fu">n</span>(), <span class="dv">2</span>),</span>
<span id="cb21-15"><a href="#cb21-15" aria-hidden="true" tabindex="-1"></a> <span class="at">media_minutes_latent =</span> <span class="fu">pmax</span>(<span class="dv">0</span>, <span class="fu">rnorm</span>(<span class="fu">n</span>(), <span class="dv">120</span>, <span class="dv">40</span>)),</span>
<span id="cb21-16"><a href="#cb21-16" aria-hidden="true" tabindex="-1"></a> <span class="at">online_shopper_latent =</span> <span class="fu">rbinom</span>(<span class="fu">n</span>(), <span class="dv">1</span>, <span class="fu">plogis</span>(<span class="sc">-</span><span class="fl">0.5</span> <span class="sc">+</span> <span class="fl">0.3</span><span class="sc">*</span>(age_group<span class="sc">==</span><span class="dv">1</span>) <span class="sc">+</span> <span class="fl">0.2</span><span class="sc">*</span>(income<span class="sc">==</span><span class="dv">3</span>))),</span>
<span id="cb21-17"><a href="#cb21-17" aria-hidden="true" tabindex="-1"></a> <span class="at">brand_awareness_latent =</span> <span class="fu">rbeta</span>(<span class="fu">n</span>(), <span class="at">shape1 =</span> <span class="dv">2</span> <span class="sc">+</span> <span class="fl">0.5</span><span class="sc">*</span>(age_group<span class="sc">>=</span><span class="dv">3</span>) <span class="sc">+</span> <span class="fl">0.3</span><span class="sc">*</span>(income<span class="sc">==</span><span class="dv">3</span>), <span class="at">shape2 =</span> <span class="dv">5</span>)</span>
<span id="cb21-18"><a href="#cb21-18" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb21-19"><a href="#cb21-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb21-20"><a href="#cb21-20" aria-hidden="true" tabindex="-1"></a><span class="co"># Generate both panel types</span></span>
<span id="cb21-21"><a href="#cb21-21" aria-hidden="true" tabindex="-1"></a>ls_panel <span class="ot"><-</span> <span class="fu">generate_panel</span>(small_pop, <span class="at">panel_type =</span> <span class="st">"large_sparse"</span>, <span class="at">n =</span> <span class="dv">5000</span>, <span class="at">seed =</span> <span class="dv">1</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>
Generating large_sparse panel (n=5,000)...
✓ Panel generated (5000 individuals)</code></pre>
</div>
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb23"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a>sr_panel <span class="ot"><-</span> <span class="fu">generate_panel</span>(small_pop, <span class="at">panel_type =</span> <span class="st">"small_rich"</span>, <span class="at">n =</span> <span class="dv">1000</span>, <span class="at">seed =</span> <span class="dv">2</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>
Generating small_rich panel (n=1,000)...
✓ Panel generated (1000 individuals)</code></pre>
</div>
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb25"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Compare panel characteristics</span></span>
<span id="cb25-2"><a href="#cb25-2" aria-hidden="true" tabindex="-1"></a><span class="fu">tibble</span>(</span>
<span id="cb25-3"><a href="#cb25-3" aria-hidden="true" tabindex="-1"></a> <span class="at">Panel =</span> <span class="fu">c</span>(<span class="st">"Large Sparse"</span>, <span class="st">"Small Rich"</span>),</span>
<span id="cb25-4"><a href="#cb25-4" aria-hidden="true" tabindex="-1"></a> <span class="at">N =</span> <span class="fu">c</span>(<span class="fu">nrow</span>(ls_panel), <span class="fu">nrow</span>(sr_panel)),</span>
<span id="cb25-5"><a href="#cb25-5" aria-hidden="true" tabindex="-1"></a> <span class="st">`</span><span class="at">Covariates Available</span><span class="st">`</span> <span class="ot">=</span> <span class="fu">c</span>(</span>
<span id="cb25-6"><a href="#cb25-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">paste</span>(<span class="fu">names</span>(ls_panel), <span class="at">collapse =</span> <span class="st">", "</span>),</span>
<span id="cb25-7"><a href="#cb25-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">paste</span>(<span class="fu">names</span>(sr_panel), <span class="at">collapse =</span> <span class="st">", "</span>)</span>
<span id="cb25-8"><a href="#cb25-8" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb25-9"><a href="#cb25-9" aria-hidden="true" tabindex="-1"></a>) <span class="sc">%>%</span></span>
<span id="cb25-10"><a href="#cb25-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">kable</span>(<span class="at">caption =</span> <span class="st">"Panel Comparison"</span>) <span class="sc">%>%</span></span>
<span id="cb25-11"><a href="#cb25-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">kable_styling</span>(<span class="at">bootstrap_options =</span> <span class="fu">c</span>(<span class="st">"striped"</span>, <span class="st">"hover"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<table class="table table-striped table-hover caption-top table-sm small" data-quarto-postprocess="true">
<caption>Panel Comparison</caption>
<thead>
<tr class="header">
<th style="text-align: left;" data-quarto-table-cell-role="th">Panel</th>
<th style="text-align: right;" data-quarto-table-cell-role="th">N</th>
<th style="text-align: left;" data-quarto-table-cell-role="th">Covariates Available</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">Large Sparse</td>
<td style="text-align: right;">5000</td>
<td style="text-align: left;">person_id, age_group, gender, age_label, gender_label, panel_type, exposure_quality, outcome_quality</td>
</tr>
<tr class="even">
<td style="text-align: left;">Small Rich</td>
<td style="text-align: right;">1000</td>
<td style="text-align: left;">person_id, age_group, gender, income, region, age_label, gender_label, income_label, purchase_history, media_minutes, online_shopper, brand_awareness, panel_type, exposure_quality, outcome_quality</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<section id="outcomes-with-confounding-and-measurement-error" class="level2" data-number="7.4">
<h2 data-number="7.4" class="anchored" data-anchor-id="outcomes-with-confounding-and-measurement-error"><span class="header-section-number">7.4</span> Outcomes with Confounding and Measurement Error</h2>
<div class="cell">
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb26"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Generate outcomes for both panels</span></span>
<span id="cb26-2"><a href="#cb26-2" aria-hidden="true" tabindex="-1"></a>ls_out <span class="ot"><-</span> <span class="fu">generate_outcomes</span>(</span>
<span id="cb26-3"><a href="#cb26-3" aria-hidden="true" tabindex="-1"></a> ls_panel,</span>
<span id="cb26-4"><a href="#cb26-4" aria-hidden="true" tabindex="-1"></a> <span class="at">true_effect =</span> <span class="fl">0.18</span>,</span>
<span id="cb26-5"><a href="#cb26-5" aria-hidden="true" tabindex="-1"></a> <span class="at">confounding_strength =</span> <span class="dv">2</span>,</span>
<span id="cb26-6"><a href="#cb26-6" aria-hidden="true" tabindex="-1"></a> <span class="at">include_measurement_error =</span> <span class="cn">TRUE</span>,</span>
<span id="cb26-7"><a href="#cb26-7" aria-hidden="true" tabindex="-1"></a> <span class="at">seed =</span> <span class="dv">10</span></span>
<span id="cb26-8"><a href="#cb26-8" aria-hidden="true" tabindex="-1"></a>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>
Generating outcomes (effect=0.180, confounding=2.0)...
Measurement agreement - Treatment: 85.0%, Outcome: 59.9%
✓ Outcomes generated
Treatment rate: 49.4%
Outcome rate (control): 38.59%
Outcome rate (treatment): 47.97%</code></pre>
</div>
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb28"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true" tabindex="-1"></a>sr_out <span class="ot"><-</span> <span class="fu">generate_outcomes</span>(</span>
<span id="cb28-2"><a href="#cb28-2" aria-hidden="true" tabindex="-1"></a> sr_panel,</span>
<span id="cb28-3"><a href="#cb28-3" aria-hidden="true" tabindex="-1"></a> <span class="at">true_effect =</span> <span class="fl">0.18</span>,</span>
<span id="cb28-4"><a href="#cb28-4" aria-hidden="true" tabindex="-1"></a> <span class="at">confounding_strength =</span> <span class="dv">2</span>,</span>
<span id="cb28-5"><a href="#cb28-5" aria-hidden="true" tabindex="-1"></a> <span class="at">include_measurement_error =</span> <span class="cn">TRUE</span>,</span>
<span id="cb28-6"><a href="#cb28-6" aria-hidden="true" tabindex="-1"></a> <span class="at">seed =</span> <span class="dv">20</span></span>
<span id="cb28-7"><a href="#cb28-7" aria-hidden="true" tabindex="-1"></a>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>
Generating outcomes (effect=0.180, confounding=2.0)...
Measurement agreement - Treatment: 98.9%, Outcome: 94.7%
✓ Outcomes generated
Treatment rate: 53.9%
Outcome rate (control): 49.24%
Outcome rate (treatment): 57.88%</code></pre>
</div>
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb30"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Summary statistics</span></span>
<span id="cb30-2"><a href="#cb30-2" aria-hidden="true" tabindex="-1"></a><span class="fu">tibble</span>(</span>
<span id="cb30-3"><a href="#cb30-3" aria-hidden="true" tabindex="-1"></a> <span class="at">Panel =</span> <span class="fu">c</span>(<span class="st">"Large Sparse"</span>, <span class="st">"Small Rich"</span>),</span>
<span id="cb30-4"><a href="#cb30-4" aria-hidden="true" tabindex="-1"></a> <span class="st">`</span><span class="at">Treatment Rate (True)</span><span class="st">`</span> <span class="ot">=</span> <span class="fu">c</span>(<span class="fu">mean</span>(ls_out<span class="sc">$</span>treatment_true), <span class="fu">mean</span>(sr_out<span class="sc">$</span>treatment_true)),</span>
<span id="cb30-5"><a href="#cb30-5" aria-hidden="true" tabindex="-1"></a> <span class="st">`</span><span class="at">Treatment Rate (Observed)</span><span class="st">`</span> <span class="ot">=</span> <span class="fu">c</span>(<span class="fu">mean</span>(ls_out<span class="sc">$</span>treatment_obs), <span class="fu">mean</span>(sr_out<span class="sc">$</span>treatment_obs)),</span>
<span id="cb30-6"><a href="#cb30-6" aria-hidden="true" tabindex="-1"></a> <span class="st">`</span><span class="at">Purchase Rate (True)</span><span class="st">`</span> <span class="ot">=</span> <span class="fu">c</span>(<span class="fu">mean</span>(ls_out<span class="sc">$</span>outcome_true), <span class="fu">mean</span>(sr_out<span class="sc">$</span>outcome_true)),</span>
<span id="cb30-7"><a href="#cb30-7" aria-hidden="true" tabindex="-1"></a> <span class="st">`</span><span class="at">Purchase Rate (Observed)</span><span class="st">`</span> <span class="ot">=</span> <span class="fu">c</span>(<span class="fu">mean</span>(ls_out<span class="sc">$</span>outcome_obs), <span class="fu">mean</span>(sr_out<span class="sc">$</span>outcome_obs))</span>
<span id="cb30-8"><a href="#cb30-8" aria-hidden="true" tabindex="-1"></a>) <span class="sc">%>%</span></span>
<span id="cb30-9"><a href="#cb30-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="fu">across</span>(<span class="fu">where</span>(is.numeric), <span class="sc">~</span>scales<span class="sc">::</span><span class="fu">percent</span>(.x, <span class="at">accuracy =</span> <span class="fl">0.1</span>))) <span class="sc">%>%</span></span>
<span id="cb30-10"><a href="#cb30-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">kable</span>(<span class="at">caption =</span> <span class="st">"Outcome Statistics by Panel Type"</span>) <span class="sc">%>%</span></span>
<span id="cb30-11"><a href="#cb30-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">kable_styling</span>(<span class="at">bootstrap_options =</span> <span class="fu">c</span>(<span class="st">"striped"</span>, <span class="st">"hover"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<table class="table table-striped table-hover caption-top table-sm small" data-quarto-postprocess="true">
<caption>Outcome Statistics by Panel Type</caption>
<thead>
<tr class="header">
<th style="text-align: left;" data-quarto-table-cell-role="th">Panel</th>
<th style="text-align: left;" data-quarto-table-cell-role="th">Treatment Rate (True)</th>
<th style="text-align: left;" data-quarto-table-cell-role="th">Treatment Rate (Observed)</th>
<th style="text-align: left;" data-quarto-table-cell-role="th">Purchase Rate (True)</th>
<th style="text-align: left;" data-quarto-table-cell-role="th">Purchase Rate (Observed)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">Large Sparse</td>
<td style="text-align: left;">49.4%</td>
<td style="text-align: left;">50.5%</td>
<td style="text-align: left;">43.2%</td>
<td style="text-align: left;">48.9%</td>
</tr>
<tr class="even">
<td style="text-align: left;">Small Rich</td>
<td style="text-align: left;">53.9%</td>
<td style="text-align: left;">53.8%</td>
<td style="text-align: left;">53.9%</td>
<td style="text-align: left;">53.2%</td>
</tr>
</tbody>
</table>
</div>
</div>
<p><strong>Observation</strong>: Measurement error creates discrepancy between true and observed rates, with larger discrepancies in the Large Sparse panel (lower measurement quality).</p>
</section>
<section id="estimation-example" class="level2" data-number="7.5">
<h2 data-number="7.5" class="anchored" data-anchor-id="estimation-example"><span class="header-section-number">7.5</span> Estimation Example</h2>
<div class="cell">
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb31"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb31-1"><a href="#cb31-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Estimate effects</span></span>
<span id="cb31-2"><a href="#cb31-2" aria-hidden="true" tabindex="-1"></a>est_ls_adj <span class="ot"><-</span> <span class="fu">estimate_effect_frequentist</span>(ls_out, <span class="at">method =</span> <span class="st">"adjusted"</span>)</span>
<span id="cb31-3"><a href="#cb31-3" aria-hidden="true" tabindex="-1"></a>est_sr_adj <span class="ot"><-</span> <span class="fu">estimate_effect_frequentist</span>(sr_out, <span class="at">method =</span> <span class="st">"adjusted"</span>)</span>
<span id="cb31-4"><a href="#cb31-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb31-5"><a href="#cb31-5" aria-hidden="true" tabindex="-1"></a><span class="co"># Decision utilities</span></span>
<span id="cb31-6"><a href="#cb31-6" aria-hidden="true" tabindex="-1"></a>util_ls <span class="ot"><-</span> <span class="fu">compute_decision_utility</span>(est_ls_adj<span class="sc">$</span>estimate)</span>
<span id="cb31-7"><a href="#cb31-7" aria-hidden="true" tabindex="-1"></a>util_sr <span class="ot"><-</span> <span class="fu">compute_decision_utility</span>(est_sr_adj<span class="sc">$</span>estimate)</span>
<span id="cb31-8"><a href="#cb31-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb31-9"><a href="#cb31-9" aria-hidden="true" tabindex="-1"></a><span class="co"># Compare estimates</span></span>
<span id="cb31-10"><a href="#cb31-10" aria-hidden="true" tabindex="-1"></a><span class="fu">tibble</span>(</span>
<span id="cb31-11"><a href="#cb31-11" aria-hidden="true" tabindex="-1"></a> <span class="at">Panel =</span> <span class="fu">c</span>(<span class="st">"Large Sparse"</span>, <span class="st">"Small Rich"</span>),</span>
<span id="cb31-12"><a href="#cb31-12" aria-hidden="true" tabindex="-1"></a> <span class="st">`</span><span class="at">Estimate</span><span class="st">`</span> <span class="ot">=</span> <span class="fu">c</span>(est_ls_adj<span class="sc">$</span>estimate, est_sr_adj<span class="sc">$</span>estimate),</span>
<span id="cb31-13"><a href="#cb31-13" aria-hidden="true" tabindex="-1"></a> <span class="st">`</span><span class="at">Std Error</span><span class="st">`</span> <span class="ot">=</span> <span class="fu">c</span>(est_ls_adj<span class="sc">$</span>se, est_sr_adj<span class="sc">$</span>se),</span>
<span id="cb31-14"><a href="#cb31-14" aria-hidden="true" tabindex="-1"></a> <span class="st">`</span><span class="at">95% CI Lower</span><span class="st">`</span> <span class="ot">=</span> <span class="fu">c</span>(est_ls_adj<span class="sc">$</span>ci_lower, est_sr_adj<span class="sc">$</span>ci_lower),</span>
<span id="cb31-15"><a href="#cb31-15" aria-hidden="true" tabindex="-1"></a> <span class="st">`</span><span class="at">95% CI Upper</span><span class="st">`</span> <span class="ot">=</span> <span class="fu">c</span>(est_ls_adj<span class="sc">$</span>ci_upper, est_sr_adj<span class="sc">$</span>ci_upper),</span>
<span id="cb31-16"><a href="#cb31-16" aria-hidden="true" tabindex="-1"></a> <span class="st">`</span><span class="at">Expected Utility (£)</span><span class="st">`</span> <span class="ot">=</span> <span class="fu">c</span>(util_ls<span class="sc">$</span>expected_utility, util_sr<span class="sc">$</span>expected_utility)</span>
<span id="cb31-17"><a href="#cb31-17" aria-hidden="true" tabindex="-1"></a>) <span class="sc">%>%</span></span>
<span id="cb31-18"><a href="#cb31-18" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="fu">across</span>(<span class="fu">c</span>(Estimate, <span class="st">`</span><span class="at">Std Error</span><span class="st">`</span>, <span class="st">`</span><span class="at">95% CI Lower</span><span class="st">`</span>, <span class="st">`</span><span class="at">95% CI Upper</span><span class="st">`</span>), <span class="sc">~</span><span class="fu">round</span>(.x, <span class="dv">3</span>))) <span class="sc">%>%</span></span>
<span id="cb31-19"><a href="#cb31-19" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="st">`</span><span class="at">Expected Utility (£)</span><span class="st">`</span> <span class="ot">=</span> scales<span class="sc">::</span><span class="fu">dollar</span>(<span class="st">`</span><span class="at">Expected Utility (£)</span><span class="st">`</span>, <span class="at">prefix =</span> <span class="st">"£"</span>)) <span class="sc">%>%</span></span>
<span id="cb31-20"><a href="#cb31-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">kable</span>(<span class="at">caption =</span> <span class="st">"Effect Estimates and Decision Utilities (True Effect = 0.18)"</span>) <span class="sc">%>%</span></span>
<span id="cb31-21"><a href="#cb31-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">kable_styling</span>(<span class="at">bootstrap_options =</span> <span class="fu">c</span>(<span class="st">"striped"</span>, <span class="st">"hover"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<table class="table table-striped table-hover caption-top table-sm small" data-quarto-postprocess="true">
<caption>Effect Estimates and Decision Utilities (True Effect = 0.18)</caption>
<thead>
<tr class="header">
<th style="text-align: left;" data-quarto-table-cell-role="th">Panel</th>
<th style="text-align: right;" data-quarto-table-cell-role="th">Estimate</th>
<th style="text-align: right;" data-quarto-table-cell-role="th">Std Error</th>
<th style="text-align: right;" data-quarto-table-cell-role="th">95% CI Lower</th>
<th style="text-align: right;" data-quarto-table-cell-role="th">95% CI Upper</th>
<th style="text-align: left;" data-quarto-table-cell-role="th">Expected Utility (£)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">Large Sparse</td>
<td style="text-align: right;">0.017</td>
<td style="text-align: right;">0.057</td>
<td style="text-align: right;">-0.095</td>
<td style="text-align: right;">0.129</td>
<td style="text-align: left;">-£109,702</td>
</tr>
<tr class="even">
<td style="text-align: left;">Small Rich</td>
<td style="text-align: right;">0.291</td>
<td style="text-align: right;">0.136</td>
<td style="text-align: right;">0.025</td>
<td style="text-align: right;">0.557</td>
<td style="text-align: left;">£1,411,201</td>
</tr>
</tbody>
</table>
</div>
</div>
<hr>
</section>
</section>
<section id="simulation-results" class="level1" data-number="8">
<h1 data-number="8"><span class="header-section-number">8</span> Simulation Results</h1>
<section id="run-simulation" class="level2" data-number="8.1">
<h2 data-number="8.1" class="anchored" data-anchor-id="run-simulation"><span class="header-section-number">8.1</span> Run Simulation</h2>
<div class="cell">
<details open="" class="code-fold">
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb32"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb32-1"><a href="#cb32-1" aria-hidden="true" tabindex="-1"></a>results <span class="ot"><-</span> <span class="fu">main</span>(<span class="at">pilot =</span> <span class="cn">TRUE</span>, <span class="at">n_cores =</span> params<span class="sc">$</span>n_cores)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>
=== GENERATING REFERENCE POPULATION ===
Generating reference population of 5e+06 individuals...
✓ Reference population generated (5000000 individuals)
Population Demographics:
Age distribution:
18-30 31-45 46-60 61-75 76+
0.1802084 0.1999918 0.2498306 0.2199626 0.1500066
Gender distribution:
Male Female
0.49023 0.50977
Income distribution:
Low Medium High
0.3298536 0.3401662 0.3299802
=== RUNNING PILOT SIMULATION ===
Total scenarios: 16
Using 24 cores
Running simulations...
Generating large_sparse panel (n=50,000)...
✓ Panel generated (50000 individuals)
Generating outcomes (effect=0.180, confounding=1.0)...
Measurement agreement - Treatment: 84.8%, Outcome: 60.0%
✓ Outcomes generated
Treatment rate: 40.5%
Outcome rate (control): 32.16%
Outcome rate (treatment): 35.47%
Generating large_sparse panel (n=50,000)...
✓ Panel generated (50000 individuals)