-
Notifications
You must be signed in to change notification settings - Fork 7
/
21-Inference-Intro.Rmd
163 lines (129 loc) · 6.18 KB
/
21-Inference-Intro.Rmd
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
# (PART) Analysis {-}
# Introducing inference {#IntroducingInference}
\index{Hypothesis testing}\index{Confidence intervals}
<!-- Introductions; easier to separate by format -->
```{r, child = if (knitr::is_html_output()){'./introductions/21-Inference-Intro-HTML.Rmd'} else {'./introductions/21-Inference-Intro-LaTeX.Rmd'}}
```
<!-- Define colours as appropriate -->
```{r, child = if (knitr::is_html_output()) {'./children/coloursHTML.Rmd'} else {'./children/coloursLaTeX.Rmd'}}
```
After posing a RQ (Chap.\ \@ref(RQs)), a study is designed (Chaps.\ \@ref(ResearchDesign)--\@ref(Interpretation)) to gather the evidence to answer the RQ (Chap.\ \@ref(CollectingDataProcedures)).
Then the data are classified (Chap.\ \@ref(DescribingVars)) and summarised accordingly (Chaps.\ \@ref(SummariseQualData) to\ \@ref(SummariseComments)) in preparation for answering the RQ.
This Part introduces *analysis*: where the data are used to answer the research question about the population.
Answering the RQ (which is about a *parameter*) is difficult, since we only study one of the countless possible samples, and hence observe only one of the countless possible values for the *statistic*.
This is called *sampling variation* (Chap.\ \@ref(SamplingVariation)).
Analysis provides the tools for learning about a population parameter, based on observing one of the numerous possible values of a sample statistic.
The appropriate type of analysis depends upon the number and types of variables, and the purpose of the RQ (Sect.\ \@ref(TwoPurposesOfRQs)):
* *Confidence intervals* answer estimation RQ, where the interest is in how precisely a *statistic* estimates a *parameter* (Chaps.\ \@ref(CIOneProportion) to\ \@ref(OneMeanConfInterval); \@ref(AnalysisPaired) to \@ref(AnalysisOddsRatio); Sect.\ \@ref(RegressionCI)).\index{Confidence intervals}
* *Hypothesis tests* answer decision-making RQs, where *decisions* are required about a *parameter* based on the value of the *statistic* (Chaps.\ \@ref(TestOneProportion) to\ \@ref(TestOneMean); \@ref(AnalysisPaired) to \@ref(AnalysisOddsRatio); Sects.\ \@ref(CorrelationTesting) and\ \@ref(RegressionHT).)\index{Hypothesis testing}
Different scenarios require different confidence intervals and hypothesis tests; those discussed in this book are shown in Table\ \@ref(tab:OverviewTable).
(ref:CI-OneProp) Chap.\ \@ref(CIOneProportion)
(ref:HT-OneProp) Chap.\ \@ref(TestOneProportion)
(ref:CI-OneMean) Chap.\ \@ref(OneMeanConfInterval)
(ref:HT-OneMean) Chap.\ \@ref(TestOneMean)
(ref:CI-TwoMeans) Chap.\ \@ref(AnalysisTwoMeans)
(ref:HT-TwoMeans) Chap.\ \@ref(AnalysisTwoMeans)
(ref:CI-Paired) Chap.\ \@ref(AnalysisPaired)
(ref:HT-Paired) Chap.\ \@ref(AnalysisPaired)
(ref:CI-OddsR) Chap.\ \@ref(AnalysisOddsRatio)
(ref:HT-OddsR) Chap.\ \@ref(AnalysisOddsRatio)
(ref:CI-Cor) Sect.\ \@ref(CorrelationCI)
(ref:HT-Cor) Sect.\ \@ref(CorrelationTesting)
(ref:HT-Reg) Sect.\ \@ref(RegressionHT)
(ref:CI-Reg) Sect.\ \@ref(RegressionCI)
```{r OverviewTable}
Overview <- array(dim = c(7, 3))
colnames(Overview) <- c("",
"confidence intervals)",
"hypothesis tests)")
Overview[1, ] <- c("Single proportions",
"(ref:CI-OneProp)",
"(ref:HT-OneProp)")
Overview[2, ] <- c("Single means",
"(ref:CI-OneMean)",
"(ref:HT-OneMean)")
Overview[3, ] <- c("Mean differences (paired data)",
"(ref:CI-Paired)",
"(ref:HT-Paired)" )
Overview[4, ] <- c("Comparing two means",
"(ref:CI-TwoMeans)",
"(ref:HT-TwoMeans)")
Overview[5, ] <- c("Comparing two odds or proportions",
"(ref:CI-OddsR)",
"(ref:HT-OddsR)")
Overview[6, ] <- c("Correlation",
"(ref:CI-Cor)",
"(ref:HT-Cor)")
Overview[7, ] <- c("Regression",
"(ref:CI-Reg)",
"(ref:HT-Reg)")
if( knitr::is_latex_output() ) {
kable(Overview,
format = "latex",
booktabs = TRUE,
align = c("l", "c","c"),
longtable = FALSE,
caption = "Confidence intervals and hypothesis tests for different situations.") %>%
kable_styling("striped",
font_size = 8,
full_width = FALSE) %>%
row_spec(0, bold = TRUE) %>%
pack_rows("Descriptive RQs",
start_row = 1,
end_row = 2,
bold = FALSE,
italic = TRUE) %>%
pack_rows("Repeated-measures RQs",
start_row = 3,
end_row = 3,
bold = FALSE,
italic = TRUE) %>%
pack_rows("Relational RQs",
start_row = 4,
end_row = 5,
bold = FALSE,
italic = TRUE) %>%
pack_rows("Correlational RQs",
start_row = 6,
end_row = 7,
bold = FALSE,
italic = TRUE) %>%
add_header_above( c(" " = 1,
"(for forming" = 1,
"(for conducting" = 1),
bold = TRUE,
line = FALSE) %>%
add_header_above( c(" " = 1,
"Estimation RQs" = 1,
"Decision-making RQs" = 1),
bold = TRUE,
line = FALSE)
}
if( knitr::is_html_output() ) {
kable(Overview,
format = "html",
booktabs = TRUE,
align = c("l", "c","c"),
longtable = FALSE,
caption = "Confidence interrvals and hypothesis tests for different situations.") %>%
kable_styling("striped",
full_width = FALSE) %>%
pack_rows("Descriptive RQs",
start_row = 1,
end_row = 3) %>%
pack_rows("Repeated-measures RQs",
start_row = 3,
end_row = 3) %>%
pack_rows("Relational RQs",
start_row = 4,
end_row = 5) %>%
pack_rows("Correlational RQs",
start_row = 6,
end_row = 7) %>%
add_header_above( c(" " = 1,
"Estimation" = 1,
"Decision-making" = 1),
bold = TRUE,
line = FALSE)
}
```