-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSurveyBook.tex
2632 lines (2093 loc) · 95.2 KB
/
SurveyBook.tex
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
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{book}
\usepackage{amsmath,amssymb}
\usepackage{lmodern}
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{248,248,248}
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{0.94,0.16,0.16}{#1}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.77,0.63,0.00}{#1}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\BuiltInTok}[1]{#1}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{#1}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{0.64,0.00,0.00}{\textbf{#1}}}
\newcommand{\ExtensionTok}[1]{#1}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\ImportTok}[1]{#1}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\NormalTok}[1]{#1}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.81,0.36,0.00}{\textbf{#1}}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{#1}}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\RegionMarkerTok}[1]{#1}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\usepackage{longtable,booktabs,array}
\usepackage{calc} % for calculating minipage widths
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{5}
\usepackage{booktabs}
\usepackage{amsthm}
\makeatletter
\def\thm@space@setup{%
\thm@preskip=8pt plus 2pt minus 4pt
\thm@postskip=\thm@preskip
}
\makeatother
\ifLuaTeX
\usepackage{selnolig} % disable illegal ligatures
\fi
\usepackage[]{natbib}
\bibliographystyle{apalike}
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same} % disable monospaced font for URLs
\hypersetup{
pdftitle={Survey Data: Design and Examples},
pdfauthor={M. Ehsan Karim},
hidelinks,
pdfcreator={LaTeX via pandoc}}
\title{Survey Data: Design and Examples}
\author{M. Ehsan Karim}
\date{2022-09-10}
\begin{document}
\maketitle
{
\setcounter{tocdepth}{1}
\tableofcontents
}
\hypertarget{preamble}{%
\chapter*{Preamble}\label{preamble}}
\addcontentsline{toc}{chapter}{Preamble}
\hypertarget{description}{%
\section*{Description}\label{description}}
\addcontentsline{toc}{section}{Description}
Surveys are designed to gather and assess national level health-related information. Usually governments collect these data, and make some effort to publish a version of the data for researchers to use. In this document, we will talk about various survey designs, some examples, how to download some of these data sources from Canadian and US sources. An example is included at the end regarding how to reproduce results from a paper that used one of these open data sources.
\hypertarget{outline}{%
\section*{Outline}\label{outline}}
\addcontentsline{toc}{section}{Outline}
\begin{itemize}
\tightlist
\item
Review of Model-based Approach
\item
Introduction to Design-based Approach
\item
Complex survey design examples
\item
Canadian Community Health Survey - Annual Component (CCHS)
\begin{itemize}
\tightlist
\item
Data import to R
\end{itemize}
\item
National Health and Nutrition Examination Survey (NHANES)
\begin{itemize}
\tightlist
\item
Understanding NHANES data and documentation structure
\item
Data import to R
\item
Reproducing results from an article
\end{itemize}
\end{itemize}
\hypertarget{version-history}{%
\subsection*{Version history}\label{version-history}}
\addcontentsline{toc}{subsection}{Version history}
Materials were updated over time through various deliveries of the content:
\begin{itemize}
\tightlist
\item
Teaching materials for SPPH 504-007 (till 2021)
\item
Teaching materials for SPPH 604 (2022-)
\end{itemize}
\hypertarget{prerequisites}{%
\section*{Prerequisites}\label{prerequisites}}
\addcontentsline{toc}{section}{Prerequisites}
The prerequisites are knowledge of basic probability. Software demonstrations and codes will be provided in R, although proficiency in R is not required for understanding the concepts. If you are not familiar with R, and want to gain further understanding, I would suggest the following tutorial.
\begin{rmdcomment}
\textbf{R tutorial}
Karim ME, Hoang A and Qu Y ``Introduction to R for health data
analysis'' URL:
\href{https://ehsanx.github.io/intro2R/}{ehsanx.github.io/intro2R/}
\end{rmdcomment}
\hypertarget{license}{%
\subsection*{License}\label{license}}
\addcontentsline{toc}{subsection}{License}
\includegraphics[width=0.25\linewidth]{images/by-nc-sa}
The online version of this book is licensed under the \href{https://creativecommons.org/licenses/by-nc-sa/4.0/}{Creative Commons Attribution-NonCommercial-ShareAlike 4.0} International License. You may share, adapt the content and may distribute your contributions under the same license (CC BY-NC-SA 4.0), but you have to give appropriate credit, and cannot use material for the commercial purposes.
\begin{rmdcomment}
\textbf{How to cite}
Karim, ME (2022) ``Survey Data: Design and Examples'', URL:
\href{https://ehsanx.github.io/SPPH504007SurveyData/docs/}{ehsanx.github.io/SPPH504007SurveyData}
\end{rmdcomment}
\hypertarget{comments}{%
\subsection*{Comments}\label{comments}}
\addcontentsline{toc}{subsection}{Comments}
For any comments regarding this document, reach out to \href{http://ehsank.com/}{me}.
\hypertarget{tab-3}{%
\chapter{Model-based Approach}\label{tab-3}}
Review of regression analysis and ANOVA from pre-requisites (+ some extra concepts). Below we see an example of a random data generating process that depends on specification of a probability model. We assume that the population data was generated from a \texttt{Normal\ distribution}, and we are merely dealing with a sample. All our inferences (point estimate or hypothesis testing) will depend on how closely the data fulfill such assumption. We call such approach as `\texttt{model-based}' approach.
\hypertarget{example}{%
\section{Example}\label{example}}
Does plant weight increase with added nutrition?
The following problem was taken from Exercise set 2.5 (2.1) from \citet{dobson2008gml}:
\begin{quote}
``Genetically similar seeds are randomly assigned to be raised in either a nutritionally enriched environment (treatment group) or standard conditions (control group) using a completely randomized experimental design. After a predetermined time all plants are harvested, dried and weighed.''
\end{quote}
\hypertarget{research-question}{%
\section{Research question}\label{research-question}}
We want to test whether there is any difference in yield (weight) between the two groups
\begin{itemize}
\tightlist
\item
plants from nutritionally enriched environment (treatment group) and
\item
plants from standard conditions (control group)
\end{itemize}
\hypertarget{notations}{%
\subsection{Notations}\label{notations}}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
Let \(k\) be the index of each plant, and \(k = 1,...,20\) for both groups.
\item
Let \(j\) be the index for groups. Here, \(j = 1\) for the treatment group (\texttt{Trt}), \(j = 2\) for the control group (\texttt{Ctl}).
\item
Let \(Y_{jk}\) denote the \(k\)th observation of weights in the \(j\)th group.
\end{enumerate}
\hypertarget{assumptions}{%
\subsection{Assumptions}\label{assumptions}}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
Assume that the \(Y_{jk}\)'s are independent random variables with \(Y_{jk} \sim N(\mu_j , \sigma^2)\).
\item
We also assume that the variances are homogenious, that is, \({\sigma_1}^2\) and \({\sigma_2}^2\) are not very different (and could be pooled to one single value of \(\sigma^2\)).
\end{enumerate}
\hypertarget{hypothesis}{%
\subsection{Hypothesis}\label{hypothesis}}
The null hypothesis \(H_0 : \mu_1 = \mu_2 = \mu\), that there is no difference, is to be compared with the alternative hypothesis \(H_1 : \mu_1 \ne \mu_2\).
\hypertarget{data}{%
\section{Data}\label{data}}
\hypertarget{data-table}{%
\subsection{Data table}\label{data-table}}
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{ctl }\OtherTok{\textless{}{-}} \FunctionTok{c}\NormalTok{(}\FloatTok{4.17}\NormalTok{,}\FloatTok{5.58}\NormalTok{,}\FloatTok{5.18}\NormalTok{,}\FloatTok{6.11}\NormalTok{,}\FloatTok{4.50}\NormalTok{,}\FloatTok{4.61}\NormalTok{,}\FloatTok{5.17}\NormalTok{,}\FloatTok{4.53}\NormalTok{,}\FloatTok{5.33}\NormalTok{,}\FloatTok{5.14}\NormalTok{)}
\NormalTok{trt }\OtherTok{\textless{}{-}} \FunctionTok{c}\NormalTok{(}\FloatTok{4.81}\NormalTok{,}\FloatTok{4.17}\NormalTok{,}\FloatTok{4.41}\NormalTok{,}\FloatTok{3.59}\NormalTok{,}\FloatTok{5.87}\NormalTok{,}\FloatTok{3.83}\NormalTok{,}\FloatTok{6.03}\NormalTok{,}\FloatTok{4.89}\NormalTok{,}\FloatTok{4.32}\NormalTok{,}\FloatTok{4.69}\NormalTok{)}
\FunctionTok{length}\NormalTok{(ctl);}\FunctionTok{length}\NormalTok{(trt)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## [1] 10
\end{verbatim}
\begin{verbatim}
## [1] 10
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{group }\OtherTok{\textless{}{-}} \FunctionTok{rep}\NormalTok{(}\FunctionTok{c}\NormalTok{(}\StringTok{"Ctl"}\NormalTok{,}\StringTok{"Trt"}\NormalTok{), }\AttributeTok{each =} \FunctionTok{length}\NormalTok{(ctl))}
\NormalTok{group}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## [1] "Ctl" "Ctl" "Ctl" "Ctl" "Ctl" "Ctl" "Ctl" "Ctl" "Ctl" "Ctl" "Trt" "Trt"
## [13] "Trt" "Trt" "Trt" "Trt" "Trt" "Trt" "Trt" "Trt"
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{mode}\NormalTok{(group)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## [1] "character"
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{weight }\OtherTok{\textless{}{-}} \FunctionTok{c}\NormalTok{(ctl, trt)}
\NormalTok{weight}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## [1] 4.17 5.58 5.18 6.11 4.50 4.61 5.17 4.53 5.33 5.14 4.81 4.17 4.41 3.59 5.87
## [16] 3.83 6.03 4.89 4.32 4.69
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{mode}\NormalTok{(weight)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## [1] "numeric"
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{Plant.Weight.Data }\OtherTok{\textless{}{-}} \FunctionTok{data.frame}\NormalTok{(}\AttributeTok{group=}\NormalTok{group, }\AttributeTok{weight =} \FunctionTok{c}\NormalTok{(ctl, trt)) }
\FunctionTok{mode}\NormalTok{(Plant.Weight.Data)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## [1] "list"
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{dim}\NormalTok{(Plant.Weight.Data)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## [1] 20 2
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{str}\NormalTok{(Plant.Weight.Data)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## 'data.frame': 20 obs. of 2 variables:
## $ group : chr "Ctl" "Ctl" "Ctl" "Ctl" ...
## $ weight: num 4.17 5.58 5.18 6.11 4.5 4.61 5.17 4.53 5.33 5.14 ...
\end{verbatim}
The results, expressed in grams, for 20 plants in each group are shown in the following Table.
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{library}\NormalTok{(DT)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## Warning: package 'DT' was built under R version 4.2.1
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{datatable}\NormalTok{(Plant.Weight.Data)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.
\end{verbatim}
\hypertarget{visualization}{%
\subsection{Visualization}\label{visualization}}
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{boxplot}\NormalTok{(weight}\SpecialCharTok{\textasciitilde{}}\NormalTok{ group,}\AttributeTok{data=}\NormalTok{Plant.Weight.Data)}
\NormalTok{weight.means }\OtherTok{\textless{}{-}} \FunctionTok{aggregate}\NormalTok{(weight }\SpecialCharTok{\textasciitilde{}}\NormalTok{ group, }\AttributeTok{data=}\NormalTok{Plant.Weight.Data, }\AttributeTok{FUN=}\NormalTok{mean)}
\NormalTok{weight.means}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## group weight
## 1 Ctl 5.032
## 2 Trt 4.661
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{weight.medians }\OtherTok{\textless{}{-}} \FunctionTok{aggregate}\NormalTok{(weight }\SpecialCharTok{\textasciitilde{}}\NormalTok{ group, }\AttributeTok{data=}\NormalTok{Plant.Weight.Data, }\AttributeTok{FUN=}\NormalTok{median)}
\NormalTok{weight.medians}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## group weight
## 1 Ctl 5.155
## 2 Trt 4.550
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{points}\NormalTok{(}\DecValTok{1}\SpecialCharTok{:}\DecValTok{2}\NormalTok{, weight.means}\SpecialCharTok{$}\NormalTok{weight, }\AttributeTok{pch =} \StringTok{"*"}\NormalTok{, }\AttributeTok{col =} \StringTok{"blue"}\NormalTok{)}
\FunctionTok{text}\NormalTok{(}\FunctionTok{c}\NormalTok{(}\DecValTok{1}\SpecialCharTok{:}\DecValTok{2}\NormalTok{)}\SpecialCharTok{+}\FloatTok{0.25}\NormalTok{, weight.means}\SpecialCharTok{$}\NormalTok{weight, }\AttributeTok{labels =}
\FunctionTok{paste}\NormalTok{(}\StringTok{"Mean = "}\NormalTok{, weight.means}\SpecialCharTok{$}\NormalTok{weight), }\AttributeTok{col =} \StringTok{"blue"}\NormalTok{)}
\FunctionTok{text}\NormalTok{(}\FunctionTok{c}\NormalTok{(}\DecValTok{1}\SpecialCharTok{:}\DecValTok{2}\NormalTok{)}\SpecialCharTok{{-}}\FloatTok{0.25}\NormalTok{, weight.means}\SpecialCharTok{$}\NormalTok{weight, }\AttributeTok{labels =}
\FunctionTok{paste}\NormalTok{(}\StringTok{"Median = "}\NormalTok{,weight.medians}\SpecialCharTok{$}\NormalTok{weight), }\AttributeTok{col =} \StringTok{"black"}\NormalTok{)}
\end{Highlighting}
\end{Shaded}
\includegraphics{SurveyBook_files/figure-latex/rawDataShow2-1.pdf}
Wait: so, plan weight reduces as we add nutrition? How confidently can we say that this added nutrition harmful for the plants (e.g., so that the weight will be reduced)?
\hypertarget{checking-assumptions}{%
\section{Checking assumptions}\label{checking-assumptions}}
Test of normality of the outcomes (Shapiro-Wilk normality test):
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{shapiro.test}\NormalTok{(Plant.Weight.Data}\SpecialCharTok{$}\NormalTok{weight)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
##
## Shapiro-Wilk normality test
##
## data: Plant.Weight.Data$weight
## W = 0.97311, p-value = 0.8187
\end{verbatim}
Therefore, we cannot reject the null hypothesis that samples come from a population which has a normal distribution. Also check a normal quantile-quantile plot:
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{qqnorm}\NormalTok{(Plant.Weight.Data}\SpecialCharTok{$}\NormalTok{weight)}
\FunctionTok{qqline}\NormalTok{(Plant.Weight.Data}\SpecialCharTok{$}\NormalTok{weight)}
\end{Highlighting}
\end{Shaded}
\includegraphics{SurveyBook_files/figure-latex/testing11-1.pdf}
Test of homogeneity of variances, that tests \(H_0 : \sigma_1 = \sigma_2\) vs.~\(H_1 : \sigma_1 \ne \sigma_2\):
\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# SD from each groups}
\FunctionTok{tapply}\NormalTok{(Plant.Weight.Data}\SpecialCharTok{$}\NormalTok{weight, }
\AttributeTok{INDEX =}\NormalTok{ Plant.Weight.Data}\SpecialCharTok{$}\NormalTok{group, }\AttributeTok{FUN =}\NormalTok{ sd)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## Ctl Trt
## 0.5830914 0.7936757
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{bartlett.test}\NormalTok{(weight }\SpecialCharTok{\textasciitilde{}}\NormalTok{ group, }\AttributeTok{data =}\NormalTok{ Plant.Weight.Data) }\CommentTok{\# Bartlett\textquotesingle{}s test}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
##
## Bartlett test of homogeneity of variances
##
## data: weight by group
## Bartlett's K-squared = 0.79805, df = 1, p-value = 0.3717
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# leveneTest(weight \textasciitilde{} group, data = Plant.Weight.Data) \# Levene\textquotesingle{}s test}
\end{Highlighting}
\end{Shaded}
\hypertarget{analysis}{%
\section{Analysis}\label{analysis}}
\hypertarget{two-sample-t-test}{%
\subsection{Two-sample t-test}\label{two-sample-t-test}}
A two-sample (independent) t-test compares the weights of control and treatment group as follows (assuming equal variance; judging from the IQR from the boxplots or the above Bartlett test):
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{ttest}\OtherTok{\textless{}{-}} \FunctionTok{t.test}\NormalTok{(weight }\SpecialCharTok{\textasciitilde{}}\NormalTok{ group, }\AttributeTok{data =}\NormalTok{ Plant.Weight.Data, }
\AttributeTok{paired =} \ConstantTok{FALSE}\NormalTok{, }\AttributeTok{var.equal =} \ConstantTok{TRUE}\NormalTok{)}
\NormalTok{ttest}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
##
## Two Sample t-test
##
## data: weight by group
## t = 1.1913, df = 18, p-value = 0.249
## alternative hypothesis: true difference in means between group Ctl and group Trt is not equal to 0
## 95 percent confidence interval:
## -0.2833003 1.0253003
## sample estimates:
## mean in group Ctl mean in group Trt
## 5.032 4.661
\end{verbatim}
Here, we test \(H_0 : \mu_1 = \mu_2 = \mu\) vs.~\(H_1 : \mu_1 \ne \mu_2\).
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{ttest}\SpecialCharTok{$}\NormalTok{statistic}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## t
## 1.19126
\end{verbatim}
\hypertarget{regression}{%
\subsection{Regression}\label{regression}}
A simple linear model exploring the relationship between the plant weight and the group status can be fitted as follows:
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{lm.group.including.intercept }\OtherTok{\textless{}{-}} \FunctionTok{lm}\NormalTok{(weight }\SpecialCharTok{\textasciitilde{}} \DecValTok{1} \SpecialCharTok{+}\NormalTok{ group, }\AttributeTok{data =}\NormalTok{ Plant.Weight.Data)}
\NormalTok{lm.group.including.intercept}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
##
## Call:
## lm(formula = weight ~ 1 + group, data = Plant.Weight.Data)
##
## Coefficients:
## (Intercept) groupTrt
## 5.032 -0.371
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{lm.group }\OtherTok{\textless{}{-}} \FunctionTok{lm}\NormalTok{(weight }\SpecialCharTok{\textasciitilde{}}\NormalTok{ group, }\AttributeTok{data =}\NormalTok{ Plant.Weight.Data)}
\NormalTok{lm.group}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
##
## Call:
## lm(formula = weight ~ group, data = Plant.Weight.Data)
##
## Coefficients:
## (Intercept) groupTrt
## 5.032 -0.371
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{confint}\NormalTok{(lm.group)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## 2.5 % 97.5 %
## (Intercept) 4.56934 5.4946602
## groupTrt -1.02530 0.2833003
\end{verbatim}
\hypertarget{interpretation}{%
\subsubsection{Interpretation}\label{interpretation}}
Note that the variable \texttt{group} is dummy coded. \texttt{R} generally chooses the first category as the reference category.
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{levels}\NormalTok{(}\FunctionTok{as.factor}\NormalTok{(Plant.Weight.Data}\SpecialCharTok{$}\NormalTok{group))}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## [1] "Ctl" "Trt"
\end{verbatim}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
In this case, the intercept 5.032 tells us the predicted mean value for the plant weights for the control group (reference category of the group variable).
\item
On the other hand, the slope in interpreted as the expected difference in the mean of the plant weights for that treatment group as compared to the control group. On average, weight is 0.371 units (lb?) lower in plants who are in the treatment condition compared to those in the control condition.
\end{enumerate}
\hypertarget{summary-of-the-regression-fit}{%
\subsubsection{Summary of the regression fit}\label{summary-of-the-regression-fit}}
The complete summary of the results is as follows:
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{summary}\NormalTok{(lm.group)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
##
## Call:
## lm(formula = weight ~ group, data = Plant.Weight.Data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.0710 -0.4938 0.0685 0.2462 1.3690
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.0320 0.2202 22.850 9.55e-15 ***
## groupTrt -0.3710 0.3114 -1.191 0.249
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.6964 on 18 degrees of freedom
## Multiple R-squared: 0.07308, Adjusted R-squared: 0.02158
## F-statistic: 1.419 on 1 and 18 DF, p-value: 0.249
\end{verbatim}
This is testing a different hypothesis (from the table): \(H_0: \alpha = 0\) vs.~\(H_1: \alpha \ne 0\) (\(\alpha\) being the intercept) and \(H_0: \beta = 0\) vs.~\(H_1: \beta \ne 0\) (\(\beta\) being the slope). At the bottom of the \texttt{summary} output, the \texttt{F-statistic} tests \(H_0: \beta = 0\) vs.~\(H_1: \beta \ne 0\). This is an overall, and could accomodate more slopes if the regression had more slopes. E.g., for 2 slopes, this would have tested \(H_0: \beta_1 = \beta_2 = 0\).
\hypertarget{regression-plot}{%
\subsubsection{Regression plot}\label{regression-plot}}
Let us visualize the scatter plot and the regression line:
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{Plant.Weight.Data}\SpecialCharTok{$}\NormalTok{group.code }\OtherTok{\textless{}{-}}
\FunctionTok{ifelse}\NormalTok{(Plant.Weight.Data}\SpecialCharTok{$}\NormalTok{group }\SpecialCharTok{==} \StringTok{"Trt"}\NormalTok{, }\DecValTok{1}\NormalTok{, }\DecValTok{0}\NormalTok{)}
\NormalTok{Plant.Weight.Data}\SpecialCharTok{$}\NormalTok{group.code}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## [1] 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{lm.code }\OtherTok{\textless{}{-}} \FunctionTok{lm}\NormalTok{(weight }\SpecialCharTok{\textasciitilde{}}\NormalTok{ group.code, }\AttributeTok{data =}\NormalTok{ Plant.Weight.Data)}
\FunctionTok{plot}\NormalTok{(weight }\SpecialCharTok{\textasciitilde{}}\NormalTok{ group.code, }\AttributeTok{data =}\NormalTok{ Plant.Weight.Data, }
\AttributeTok{axes =} \ConstantTok{FALSE}\NormalTok{, }\AttributeTok{xlab =} \StringTok{"Groups"}\NormalTok{)}
\FunctionTok{axis}\NormalTok{(}\DecValTok{1}\NormalTok{, }\DecValTok{0}\SpecialCharTok{:}\DecValTok{1}\NormalTok{, }\FunctionTok{levels}\NormalTok{(Plant.Weight.Data}\SpecialCharTok{$}\NormalTok{group))}
\FunctionTok{axis}\NormalTok{(}\DecValTok{2}\NormalTok{)}
\FunctionTok{abline}\NormalTok{(lm.code, }\AttributeTok{col =} \StringTok{"blue"}\NormalTok{) }\CommentTok{\# regression line}
\FunctionTok{abline}\NormalTok{(}\AttributeTok{h=}\FunctionTok{coef}\NormalTok{(lm.code)[}\DecValTok{1}\NormalTok{], }\AttributeTok{col =} \StringTok{"red"}\NormalTok{) }\CommentTok{\# intercept}
\end{Highlighting}
\end{Shaded}
\includegraphics{SurveyBook_files/figure-latex/simpleAnalysisplot-1.pdf}
\hypertarget{assumption-checking-for-the-residuals}{%
\subsubsection{Assumption checking for the residuals}\label{assumption-checking-for-the-residuals}}
Checking normality of the residuals:
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{lm.residual }\OtherTok{\textless{}{-}} \FunctionTok{residuals}\NormalTok{(lm.group)}
\FunctionTok{shapiro.test}\NormalTok{(lm.residual)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
##
## Shapiro-Wilk normality test
##
## data: lm.residual
## W = 0.94744, p-value = 0.3299
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{qqnorm}\NormalTok{(lm.residual)}
\FunctionTok{qqline}\NormalTok{(lm.residual)}
\end{Highlighting}
\end{Shaded}
\includegraphics{SurveyBook_files/figure-latex/simpleAnalysis224-1.pdf}
\hypertarget{null-model}{%
\subsubsection{Null model}\label{null-model}}
A null model (with only intercept):
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{lm.null }\OtherTok{\textless{}{-}} \FunctionTok{lm}\NormalTok{(weight }\SpecialCharTok{\textasciitilde{}} \DecValTok{1}\NormalTok{, }\AttributeTok{data =}\NormalTok{ Plant.Weight.Data) }\CommentTok{\# Including just the intercept}
\FunctionTok{summary}\NormalTok{(lm.null)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
##
## Call:
## lm(formula = weight ~ 1, data = Plant.Weight.Data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.2565 -0.4590 -0.0965 0.3710 1.2635
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.8465 0.1574 30.79 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.704 on 19 degrees of freedom
\end{verbatim}
\hypertarget{anova}{%
\subsection{ANOVA}\label{anova}}
For testing for the significance of the group membership, we can compare the current model to the null model (is adding the variable \texttt{group} in the model useful?).
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{anova}\NormalTok{(lm.null,lm.group)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## Analysis of Variance Table
##
## Model 1: weight ~ 1
## Model 2: weight ~ group
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 19 9.4175
## 2 18 8.7292 1 0.68821 1.4191 0.249
\end{verbatim}
Or, we could directly test \(H_0 : \mu_1 = \mu_2 = \mu\) vs.~\(H_1 : \mu_1 \ne \mu_2\) under the homogeneity of variances assumption:
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{anova}\NormalTok{(lm.group)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## Analysis of Variance Table
##
## Response: weight
## Df Sum Sq Mean Sq F value Pr(>F)
## group 1 0.6882 0.68820 1.4191 0.249
## Residuals 18 8.7292 0.48496
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# Alternate ways to do the same}
\CommentTok{\# car::Anova(lm.group,type="II")}
\NormalTok{aov.fit }\OtherTok{\textless{}{-}} \FunctionTok{aov}\NormalTok{(lm.group)}
\FunctionTok{summary}\NormalTok{(aov.fit)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## Df Sum Sq Mean Sq F value Pr(>F)
## group 1 0.688 0.6882 1.419 0.249
## Residuals 18 8.729 0.4850
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# Multiple pairwise{-}comparison: }
\CommentTok{\# (compare with t{-}test; same p{-}value?)}
\FunctionTok{TukeyHSD}\NormalTok{(aov.fit) }
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = lm.group)
##
## $group
## diff lwr upr p adj
## Trt-Ctl -0.371 -1.0253 0.2833003 0.2490232
\end{verbatim}
Checking normality of the residuals (not run; same as above):
\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# aov.residual \textless{}{-} residuals(aov.fit)}
\CommentTok{\# shapiro.test(aov.residual)}
\CommentTok{\# qqnorm(aov.residual)}
\CommentTok{\# qqline(aov.residual)}
\end{Highlighting}
\end{Shaded}
ANOVA is basically a generalization of the two-sample t-test (verify that the calculated \(F = t^2\)):
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{ttest}\SpecialCharTok{$}\NormalTok{statistic}\SpecialCharTok{\^{}}\DecValTok{2}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## t
## 1.419101
\end{verbatim}
An alternative non-parametric version of this independent 2-sample test is as follows (a Kruskal-Wallis rank sum test):
\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# Assuming groups come from similar shaped populations:}
\FunctionTok{kruskal.test}\NormalTok{(weight }\SpecialCharTok{\textasciitilde{}}\NormalTok{ group, }\AttributeTok{data =}\NormalTok{ Plant.Weight.Data) }
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
##
## Kruskal-Wallis rank sum test
##
## data: weight by group
## Kruskal-Wallis chi-squared = 1.7513, df = 1, p-value = 0.1857
\end{verbatim}
\hypertarget{verdict}{%
\section{Verdict}\label{verdict}}
\hypertarget{informal-conclusion}{%
\subsection{Informal conclusion}\label{informal-conclusion}}
With added nutrition, plant weights generally decrease (judging from the point estimate), but such trend could be due to sampling fluctuation (e.g., as the 95\% confidence interval includes the null value of 0) and we can not confidently (not at least with 95\% confidence) say that adding nutrition will cause plant weights to go down.
\hypertarget{a-word-of-caution}{%
\subsection{A word of caution}\label{a-word-of-caution}}
Note that, we are inherently trying to infer `causality' out of a statistical analysis, even though our hypothesis is not about `cause' explicitly. Unfortunately, correlation does not imply causation, and we need to know more about the subject-area and study-design before we make such inference or interpretation.
\hypertarget{exercises-optional}{%
\section{Exercises (Optional)}\label{exercises-optional}}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
What is the difference between a regression analysis with a dummy coded predictor variable vs.~an ANOVA?
\item
Was multiple pairwise-comparison (\texttt{TukeyHSD}) necessary in the above example?\\
\item
Which \texttt{R} package includes the \texttt{leveneTest} function? (hint: use \texttt{help.search()} function.)
\item
Is `multicollinearity' an issue in the above example?
\item
In the current example, can we interpret the slope as follows: \texttt{the\ change\ in\ Y\ for\ a\ 1-unit\ change\ in\ X} where, \(Y\) being the outcome and \(X\) being the predictor? Why, or why not?
\end{enumerate}
\hypertarget{design-based-approach}{%
\chapter{Design-based Approach}\label{design-based-approach}}
Before discussing design-based approach, let us review some of concepts related to \texttt{sampling}.
\hypertarget{sampling}{%
\section{Sampling}\label{sampling}}
\hypertarget{steps-of-generalization}{%
\subsection{Steps of generalization}\label{steps-of-generalization}}
\includegraphics[width=0.65\linewidth]{images/sampling0}
Example: Let us consider CCHS.
\begin{itemize}
\tightlist
\item
Target population: You think about a \texttt{target\ population} in you PICOT.
\begin{itemize}
\tightlist
\item
Canadian population 12 years of age and over
\end{itemize}
\item
Sampling Frame: But all of your target population may not belong to a \texttt{sampling\ frame} compiled by a government.
\begin{itemize}
\tightlist
\item
Canadian population 12 years of age and over exluding about 3\% population (e.g., aboriginal settlements, canadian Forces, institutionalized, foster care, 2 selected Quebec health regions)
\end{itemize}
\item
Active Frame: People that are still reachable
\begin{itemize}
\tightlist
\item
E.g., not dead or have not moved
\end{itemize}
\item
Sampling list
\begin{itemize}
\tightlist
\item
Prepared from a specific sampling technique (SRS, stratified, cluster, complex)
\end{itemize}
\item
Actual sample: people that have responded
\begin{itemize}
\tightlist
\item
some don't respond
\end{itemize}
\end{itemize}
Note that, results from `actual sample' are generalized to the `active frame'. An inference from a sample may not really be generalizable to the target population (strictly speaking).
\hypertarget{types-of-sampling-techniques}{%
\subsection{Types of sampling techniques}\label{types-of-sampling-techniques}}
\begin{itemize}
\tightlist
\item
Probability
\item
Non-probability
\end{itemize}
\includegraphics[width=0.85\linewidth]{images/sampling1}
\hypertarget{statistical-inference}{%
\section{Statistical inference}\label{statistical-inference}}
\hypertarget{model-based}{%
\subsection{Model-based}\label{model-based}}
Most of the statistical techniques we have seen in our pre-requisite courses (\texttt{SPPH\ 400,\ 500}) generally assumed that we are dealing with a sample that was obtained from an infinite population. We usually assume that a random process can approximate such data generation process, and the data was collected by a simple random sampling or SRS (everyone has equal opportunity to be selected in the sample). All our conclusions are based on such assumptions. If we are wrong in specifying correct distribution to approximate the data generating process, our subsequent inferences may not be valid anymore.
\includegraphics[width=0.85\linewidth]{images/design1}
\hypertarget{design-based}{%
\subsection{Design-based}\label{design-based}}
Generally, when wide-scale surveys are designed, simple random sampling or SRS may not be feasible for various practical considerations. May be researchers and policy-makers want that a special but small sub-group subjects should be included in our sample (e.g., people suffering from a rare disease), but it is possible that by a SRS scheme, none of the subject from that small subgroup will be included. For convenience of sampling, and for controlling variance, researchers may have to make desicions regarding how the survey needs to collect sample. Researchers may resort to cluster or stratified sampling; or a mix of both (trade-off between cost and precision). Unfortunately, in these cases, equal probability of being selected in the sample is not there any more. \citet{lumley2011complex} discussed the following properties for making design-based inference:
\begin{itemize}
\tightlist
\item
properties needed to get valid estimates
\begin{itemize}
\tightlist