CONTENTS
Cover
Title Page
Copyright
Preface
Chapter 1: Fundamentals
Everything Varies
Significance
Good and Bad Hypotheses
Null Hypotheses
p Values
Interpretation
Model Choice
Statistical Modelling
Maximum Likelihood
Experimental Design
The Principle of Parsimony (Occam's Razor)
Observation, Theory and Experiment
Controls
Replication: It's the ns that Justify the Means
How Many Replicates?
Power
Randomization
Strong Inference
Weak Inference
How Long to Go On?
Pseudoreplication
Initial Conditions
Orthogonal Designs and Non-Orthogonal Observational Data
Aliasing
Multiple Comparisons
Summary of Statistical Models in R
Organizing Your Work
Housekeeping within R
References
Further Reading
Chapter 2: Dataframes
Selecting Parts of a Dataframe: Subscripts
Sorting
Summarizing the Content of Dataframes
Summarizing by Explanatory Variables
First Things First: Get to Know Your Data
Relationships
Looking for Interactions between Continuous Variables
Graphics to Help with Multiple Regression
Interactions Involving Categorical Variables
Further Reading
Chapter 3: Central Tendency
Further Reading
Chapter 4: Variance
Degrees of Freedom
Variance
Variance: A Worked Example
Variance and Sample Size
Using Variance
A Measure of Unreliability
Confidence Intervals
Bootstrap
Non-constant Variance: Heteroscedasticity
Further Reading
Chapter 5: Single Samples
Data Summary in the One-Sample Case
The Normal Distribution
Calculations Using z of the Normal Distribution
Plots for Testing Normality of Single Samples
Inference in the One-Sample Case
Bootstrap in Hypothesis Testing with Single Samples
Student's t Distribution
Higher-Order Moments of a Distribution
Skew
Kurtosis
Reference
Further Reading
Chapter 6: Two Samples
Comparing Two Variances
Comparing Two Means
Student's t Test
Wilcoxon Rank-Sum Test
Tests on Paired Samples
The Binomial Test
Binomial Tests to Compare Two Proportions
Chi-Squared Contingency Tables
Fisher's Exact Test
Correlation and Covariance
Correlation and the Variance of Differences between Variables
Scale-Dependent Correlations
Reference
Further Reading
Chapter 7: Regression
Linear Regression
Linear Regression in R
Calculations Involved in Linear Regression
Partitioning Sums of Squares in Regression: SSY = SSR + SSE
Measuring the Degree of Fit, r2
Model Checking
Transformation
Polynomial Regression
Non-Linear Regression
Generalized Additive Models
Influence
Further Reading
Chapter 8: Analysis of Variance
One-Way ANOVA
Shortcut Formulas
Effect Sizes
Plots for Interpreting One-Way ANOVA
Factorial Experiments
Pseudoreplication: Nested Designs and Split Plots
Split-Plot Experiments
Random Effects and Nested Designs
Fixed or Random Effects?
Removing the Pseudoreplication
Analysis of Longitudinal Data
Derived Variable Analysis
Dealing with Pseudoreplication
Variance Components Analysis (VCA)
References
Further Reading
Chapter 9: Analysis of Covariance
Further Reading
Chapter 10: Multiple Regression
The Steps Involved in Model Simplification
Caveats
Order of Deletion
Carrying Out a Multiple Regression
A Trickier Example
Further Reading
Chapter 11: Contrasts
Contrast Coefficients
An Example of Contrasts in R
A Priori Contrasts
Treatment Contrasts
Model Simplification by Stepwise Deletion
Contrast Sums of Squares by Hand
The Three Kinds of Contrasts Compared
Reference
Further Reading
Chapter 12: Other Response Variables
Introduction to Generalized Linear Models
The Error Structure
The Linear Predictor
Fitted Values
A General Measure of Variability
The Link Function
Canonical Link Functions
Akaike's Information Criterion (AIC) as a Measure of the Fit of a Model
Further Reading
Chapter 13: Count Data
A Regression with Poisson Errors
Analysis of Deviance with Count Data
The Danger of Contingency Tables
Analysis of Covariance with Count Data
Frequency Distributions
Further Reading
Chapter 14: Proportion Data
Analyses of Data on One and Two Proportions
Averages of Proportions
Count Data on Proportions
Odds
Overdispersion and Hypothesis Testing
Applications
Logistic Regression with Binomial Errors
Proportion Data with Categorical Explanatory Variables
Analysis of Covariance with Binomial Data
Further Reading
Chapter 15: Binary Response Variable
Incidence Functions
ANCOVA with a Binary Response Variable
Further Reading
Chapter 16: Death and Failure Data
Survival Analysis with Censoring
Further Reading
Appendix: Essentials of the R Language
R as a Calculator
Built-in Functions
Numbers with Exponents
Modulo and Integer Quotients
Assignment
Rounding
Infinity and Things that Are Not a Number (NaN)
Missing Values (NA)
Operators
Creating a Vector
Named Elements within Vectors
Vector Functions
Summary Information from Vectors by Groups
Subscripts and Indices
Working with Vectors and Logical Subscripts
Addresses within Vectors
Trimming Vectors Using Negative Subscripts
Logical Arithmetic
Repeats
Generate Factor Levels
Generating Regular Sequences of Numbers
Matrices
Character Strings
Writing Functions in R
Arithmetic Mean of a Single Sample
Median of a Single Sample
Loops and Repeats
The ifelse Function
Evaluating Functions with apply
Testing for Equality
Testing and Coercing in R
Dates and Times in R
Calculations with Dates and Times
Understanding the Structure of an R Object Using str
Reference
Further Reading
Index
End User License Agreement
List of Tables
Table A.1
Table A.2
Table A.3
Table A.4
Guide
Cover
Table of Contents
Preface
Chapter 1
Pages
iii
iv
xi
xii
xiii
xiv
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