Welcome

Hello, and welcome to Statistical Computing and Non-Parametric Inference Using R.

This site contains the detailed lecture notes and resources for the course, structured around its five core units. These notes elaborate on the syllabus concepts and provide progressive, worked examples utilizing different datasets so that you can see how R programming and non-parametric methods are implemented in diverse analytical contexts.

How this book is organized

Chapter Unit What you’ll learn
1 Unit 1 The R/RStudio environment and every core data structure
2 Unit 2 Descriptive statistics and programming fundamentals
3 Unit 3 Confidence intervals and bootstrap resampling
4 Unit 4 Contingency tables, agreement, and compact reporting
5 Unit 5 Non-parametric hypothesis tests
Appendix Every dataset used in this book, documented in one place

How to use this book

  • Read actively, don’t just scroll. Every code chunk in this book actually runs — the output you see (numbers, tables, plots) is real, produced by the exact code shown above it. Copy the code into your own R session and run it yourself; don’t just read it.
  • Look for the colored boxes. They mean specific things:
    • Key Concept: A core idea you should understand before moving on.
    • Dataset Used Here: Tells you which dataset a section uses and why, so you can look it up in the Appendix if you forget its structure.
    • Try It Yourself: A short exercise for you to attempt before reading on. Don’t skip these; they’re where the real learning happens.
    • Common Mistake: A specific error students often make, flagged so you can avoid it.
    • Key Takeaways: A short recap at the end of every major section.
  • Multiple datasets, on purpose. This book deliberately uses several different datasets across chapters — some built into R itself (mtcars, iris, PlantGrowth, ToothGrowth, airquality, chickwts, InsectSprays), and some created specifically for this course (student_scores, course_dataset, survey_income, exam_pairs). Seeing the same statistical method applied to different kinds of data is one of the fastest ways to really understand it, rather than just pattern-matching to one example.

Setting up your R environment

Before you start, install the packages this book uses:

install.packages(c(
  "boot",       # bootstrap resampling (Chapter 3)
  "psych",      # descriptive stats & kappa agreement (Chapters 2, 4)
  "coin",       # linear-by-linear trend test (Chapter 4)
  "readxl",     # reading Excel files (Chapter 1)
  "tidyr",      # reshaping data (Chapter 5)
  "dplyr",      # data manipulation (used throughout)
  "ggplot2",    # plotting (used throughout)
  "tableone",   # baseline tables (Chapter 4)
  "gtsummary",  # publication tables (Chapter 4)
  "BSDA",       # sign test (Chapter 5) - optional, we also show a manual version
  "PMCMRplus"   # post-hoc tests (Chapter 5) - optional
))

All datasets used in this book are provided in the data/ folder alongside this site. If you’re missing them, see the Appendix for a script that regenerates every one of them exactly.

Let’s get started with Chapter 1.