L e a r n i n g S t a t i s t i c s w i t h R D a n i e l N a v a r r o ID:13570633 5 800090 850531 www.lulu.com Learning statistics with R: A tutorial for psychology students and other beginners (Version 0.3) Daniel Navarro University of Adelaide [email protected] Online: ua.edu.au/ccs/teaching/lsr www.lulu.com/content/13570633 1. Copyright notice (a) (cid:13)c 2013 Daniel Joseph Navarro, All rights reserved. (b) Thismaterialissubjecttocopyright. Thecopyrightofthismaterial,including,butnotlimited to,thetext,photographs,images,software(‘theMaterial’)isownedbyDanielJosephNavarro (‘the Author’). (c) Except as specifically prescribed by the Copyright Act 1968, no part of the Material may in any form or by any means (electronic, mechanical, microcopying, photocopying, recording or otherwise) be reproduced, stored in a retrieval system or transmitted without the Author’s prior written permission. (d) To avoid any doubt – except as noted in paragraph 4(a) – the Material must not be, with- out limitation, edited, changed, transformed, published, republished, sold, distributed, redis- tributed, broadcast, posted on the internet, compiled, shown or played in public (in any form or media) without the Author’s prior written permission. (e) The Author asserts his Moral Rights (as defined by the Copyright Act 1968) in the Material. 2. Intellectual property rights (a) ‘Intellectual Property’ for the purposes of paragraph 2(b), means “all copyright and all rights in relation to inventions, registered and unregistered trademarks (including service marks), registeredandunregistereddesigns,confidentialinformationandcircuitlayouts,andanyother rightsresultingfromintellectualactivityintheindustrial, scientific, literaryandartisticfields recognised in domestic law and anywhere in the world” (b) All Intellectual Property rights in the Material are owned by the Author. No licence or any other rights are granted to any other person in respect of the Intellectual Property contained in the Materials in Australia or anywhere else in the world. 3. No warranty (a) The Author makes no warranty or representation that the Materials are correct, accurate, current, reliable, complete, or fit for any particular purpose at all and the Author expressly disclaims any other warranties, express or implied either in fact or at law, to the extent permitted by law. (b) TheuseracceptssoleresponsibilityandriskassociatedwiththeuseoftheMaterial. Innoevent will the Author be liable for any loss or damage including special, indirect or consequential damage, suffered by any person, resulting from or in connection with the Author’s provision of the Material. 4. Preservation of GPL rights for R code (a) Notermsinthisnoticeshallbeconstruedasimplyingalimitationonthesoftwaredistribution rights granted by the GPL licences under which R is licensed. (b) To avoid ambiguity, paragraph 4(a) means means that all R source code reproduced in the Materials but not written by the Author retains the original distribution rights. In addition, it is the intention of the Author that the “lsr” R package with which this book is associated be treated as a distinct work from these Materials. The lsr package is freely available, and is distributed under the GPL. The Materials are not. ii This book was brought to you today by the letter ‘R’. iii iv Table of Contents Preface ix I Background 1 1 Why do we learn statistics? 3 1.1 On the psychology of statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2 The cautionary tale of Simpson’s paradox . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.3 Statistics in psychology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4 Statistics in everyday life . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.5 There’s more to research methods than statistics . . . . . . . . . . . . . . . . . . . . . . 10 2 A brief introduction to research design 11 2.1 Introduction to psychological measurement . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.2 Scales of measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.3 Assessing the reliability of a measurement . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.4 The “role” of variables: predictors and outcomes . . . . . . . . . . . . . . . . . . . . . . 19 2.5 Experimental and non-experimental research . . . . . . . . . . . . . . . . . . . . . . . . 20 2.6 Assessing the validity of a study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.7 Confounds, artifacts and other threats to validity . . . . . . . . . . . . . . . . . . . . . . 24 2.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 II An introduction to R 33 3 Getting started with R 35 3.1 Installing R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 3.2 Typing commands at the R console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.3 Doing simple calculations with R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3.4 Storing a number as a variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 3.5 Using functions to do calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 3.6 Storing many numbers as a vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 3.7 Storing text data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 3.8 Storing “true or false” data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 3.9 Indexing vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 3.10 Quitting R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 3.11 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 4 Additional R concepts 67 4.1 Using comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 4.2 Installing and loading packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 4.3 Managing the workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 4.4 Navigating the file system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 4.5 Loading and saving data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 4.6 Useful things to know about variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 4.7 Factors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 4.8 Data frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 4.9 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 v 4.10 Formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 4.11 Generic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 4.12 Getting help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 4.13 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 III Working with data 103 5 Descriptive statistics 105 5.1 Measures of central tendency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 5.2 Measures of variability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 5.3 Skew and kurtosis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 5.4 Getting an overall summary of a variable . . . . . . . . . . . . . . . . . . . . . . . . . . 125 5.5 Descriptive statistics separately for each group . . . . . . . . . . . . . . . . . . . . . . . 128 5.6 Standard scores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 5.7 Correlations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 5.8 Handling missing values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 5.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 6 Drawing graphs 147 6.1 An overview of R graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 6.2 An introduction to plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 6.3 Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 6.4 Stem and leaf plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 6.5 Boxplots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 6.6 Scatterplots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 6.7 Bar graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 6.8 Saving image files using R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 6.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 7 Pragmatic matters 185 7.1 Tabulating and cross-tabulating data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 7.2 Transforming and recoding a variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 7.3 A few more mathematical functions and operations . . . . . . . . . . . . . . . . . . . . . 193 7.4 Extracting a subset of a vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 7.5 Extracting a subset of a data frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 7.6 Sorting, flipping and merging data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 7.7 Reshaping a data frame. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 7.8 Working with text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 7.9 Reading unusual data files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 7.10 Coercing data from one class to another . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 7.11 Other useful data structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 7.12 Miscellaneous topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 7.13 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 8 Basic programming 243 8.1 Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 8.2 Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 8.3 Conditional statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 8.4 Writing functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 8.5 Implicit loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 8.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 vi IV Statistical theory 259 9 Introduction to probability 261 9.1 Probability theory v. statistical inference . . . . . . . . . . . . . . . . . . . . . . . . . . 262 9.2 Basic probability theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 9.3 The binomial distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 9.4 The normal distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 9.5 Other useful distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 9.6 What does probability mean? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 9.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 10 Estimating population parameters from a sample 285 10.1 Samples, populations and sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 10.2 Estimating population means and standard deviations . . . . . . . . . . . . . . . . . . . 288 10.3 Sampling distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 10.4 The central limit theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 10.5 Estimating a confidence interval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 10.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 11 Hypothesis testing 303 11.1 A menagerie of hypotheses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 11.2 Two types of errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 11.3 Test statistics and sampling distributions . . . . . . . . . . . . . . . . . . . . . . . . . . 308 11.4 Making decisions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 11.5 The p value of a test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 11.6 Reporting the results of a hypothesis test . . . . . . . . . . . . . . . . . . . . . . . . . . 314 11.7 Running the hypothesis test in practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 11.8 Effect size, sample size and power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 11.9 Some issues to consider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 11.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 V Statistical tools 327 12 Categorical data analysis 329 12.1 The χ2 goodness-of-fit test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 12.2 The χ2 test of independence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 12.3 The continuity correction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 12.4 Effect size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 12.5 Assumptions of the test(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 12.6 The Fisher exact test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 12.7 The McNemar test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 12.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 13 Comparing two means 353 13.1 The one-sample z-test. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 13.2 The one-sample t-test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 13.3 The independent samples t-test (Student test) . . . . . . . . . . . . . . . . . . . . . . . . 365 13.4 The independent samples t-test (Welch test) . . . . . . . . . . . . . . . . . . . . . . . . . 375 13.5 The paired-samples t-test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 13.6 Effect size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 13.7 Checking the normality of a sample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 vii 13.8 Testing non-normal data with Wilcoxon tests . . . . . . . . . . . . . . . . . . . . . . . . 390 13.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 14 Comparing several means (one-way ANOVA) 395 14.1 An illustrative data set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 14.2 How ANOVA works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 14.3 Running an ANOVA in R. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408 14.4 Effect size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 14.5 Multiple comparisons and post hoc tests . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 14.6 Assumptions of one-way ANOVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416 14.7 Checking the homogeneity of variance assumption . . . . . . . . . . . . . . . . . . . . . 417 14.8 Removing the homogeneity of variance assumption . . . . . . . . . . . . . . . . . . . . . 419 14.9 Checking the normality assumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 14.10 Removing the normality assumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 14.11 On the relationship between ANOVA and the Student t test . . . . . . . . . . . . . . . . 423 14.12 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 15 Linear regression 427 15.1 What is a linear regression model? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427 15.2 Estimating a linear regression model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 15.3 Multiple linear regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 15.4 Quantifying the fit of the regression model . . . . . . . . . . . . . . . . . . . . . . . . . . 434 15.5 Hypothesis tests for regression models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 15.6 Regarding regression coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441 15.7 Assumptions of regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 15.8 Model checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 15.9 Model selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458 15.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464 16 Factorial ANOVA 465 16.1 Factorial ANOVA 1: balanced designs, no interactions . . . . . . . . . . . . . . . . . . . 465 16.2 Factorial ANOVA 2: balanced designs, interactions allowed . . . . . . . . . . . . . . . . . 474 16.3 Effect size, estimated means, and confidence intervals . . . . . . . . . . . . . . . . . . . . 481 16.4 Assumption checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485 16.5 The F test as a model comparison. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486 16.6 ANOVA as a linear model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 16.7 Different ways to specify contrasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 16.8 Post hoc tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505 16.9 The method of planned comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507 16.10 Factorial ANOVA 3: unbalanced designs . . . . . . . . . . . . . . . . . . . . . . . . . . . 508 16.11 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520 17 Epilogue 521 17.1 The undiscovered statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 17.2 Learning the basics, and learning them in R . . . . . . . . . . . . . . . . . . . . . . . . . 529 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 viii Preface There’s a part of me that really doesn’t want to publish this book. It’s not finished. AndwhenIsaythat,Imeanit. Thereferencingisspottyatbest,thechaptersummariesarejustlists of section titles, there’s no index, there are no exercises for the reader, the organisation is suboptimal, andthecoverageoftopicsisjustnotcomprehensiveenoughformyliking. Additionally,therearesections withcontentthatI’mnothappywith,figuresthatreallyneedtoberedrawn,andI’vehadalmostnotime to hunt down inconsistencies, typos, or errors. In other words, this book is not finished. If I didn’t have a looming teaching deadline and a baby due in a few weeks, I really wouldn’t be making this available at all. Whatthismeansisthatifyouareanacademiclookingforteachingmaterials,aPh.D.studentlooking tolearnR,orjustamemberofthegeneralpublicinterestedinstatistics,Iwouldadviseyoutobecautious. What you’re looking at is a first draft, and it may not serve your purposes. If we were living in the days when publishing was expensive and the internet wasn’t around, I would never consider releasing a book inthisform. Thethoughtofsomeongshellingout$80forthis(whichiswhatacommercialpublishertold me it would retail for when they offered to distribute it) makes me feel more than a little uncomfortable. However, it’s the 21st century, so I can post the pdf on my website for free, and I can distribute hard copies via a print-on-demand service for less than half what a textbook publisher would charge. And so my guilt is assuaged, and I’m willing to share! With that in mind, you can obtain free soft copies and cheap hard copies online, from the following webpages: Soft copy: ua.edu.au/ccs/teaching/lsr Hard copy: www.lulu.com/content/13570633 Even so, the warning still stands: what you are looking at is Version 0.3 of a work in progress. If and whenithitsVersion1.0, Iwouldbewillingtostandbehindtheworkandsay, yes, thisisatextbookthat I would encourage other people to use. At that point, I’ll probably start shamelessly flogging the thing on the internet and generally acting like a tool. But until that day comes, I’d like it to be made clear that I’m really ambivalent about the work as it stands. All of the above being said, there is one group of people that I can enthusiastically endorse this book to: the psychology students taking our undergraduate research methods classes (DRIP and DRIP:A) in 2013. For you, this book is ideal, because it was written to accompany your stats lectures. If a problem arises due to a shortcoming of these notes, I can and will adapt content on the fly to fix that problem. Effectively, you’ve got a textbook written specifically for your classes, distributed for free (electronic copy) or at near-cost prices (hard copy). Better yet, the notes have been tested: Version 0.1 of these notes was used in the 2011 class, Version 0.2 was used in the 2012 class, and now you’re looking at the new and improved Version 0.3. I’m not saying these notes are titanium plated awesomeness on a stick – thoughifyouwantedtosaysoonthestudentevaluationforms, thenyou’retotallywelcometo–because they’re not. But I am saying that they’ve been tried out in previous years and they seem to work okay. Besides, there’s a group of us around to troubleshoot if any problems come up, and you can guarantee that at least one of your lecturers has read the whole thing cover to cover! Okay, with all that out of the way, I should say something about what the book aims to be. At its core,itisanintroductorystatisticstextbookpitchedprimarilyatpsychologystudents. Assuch,itcovers the standard topics that you’d expect of such a book: study design, descriptive statistics, the theory of hypothesis testing, t-tests, χ2 tests, ANOVA and regression. However, there are also several chapters devotedtotheRstatisticalpackage,includingachapterondatamanipulationandanotheroneonscripts and programming. Moreover, when you look at the content presented in the book, you’ll notice a lot of topicsthataretraditionallysweptunderthecarpetwhenteachingstatisticstopsychologystudents. The Bayesian/frequentist divide is openly disussed in the probability chapter, and the disagreement between Neyman and Fisher about hypothesis testing makes an appearance. The difference between probability ix