# Introduction & prerequisites

This part introduces practical data analysis in R and the core frequentist toolkit used throughout the book.

## Introduction

This MQB section builds on the computing component, introducing you to basic data science including visualization and statistical analyses of data.

You will learn basic to somewhat advanced [*frequentist*](https://en.wikipedia.org/wiki/Frequentist_inference) statistical methods and inference in a hands-on way, interspersed with lectures on underlying concepts.

```{note}
The chapters in this Part assume that you have already worked through at least the basic sections of the [R chapter](notebooks/r) of this book.
```

It is important that you work through the problems in each chapter, particularly as some of the questions ask you to find out about commands and functions not introduced in the chapter text itself, but which will be relied on in later chapters.

## Learning goals

By the end of this part, you will be able to:

- Import, clean, and explore biological datasets in R with confidence
- Design experiments with proper replication, randomisation, and controls
- Apply and interpret classical frequentist tests (t-tests, F-tests, ANOVA)
- Build, diagnose, and communicate linear regression models
- Fit models with multiple predictors and interactions
- Simplify complex models systematically using nested tests and AIC

## Prerequisites

- **Essential**: Functional R programming skills — variables, vectors, data frames, basic plotting (covered in [R chapter](notebooks/r))
- **Helpful**: Basic understanding of mean, variance, and probability concepts
- **If rusty**: Review [R chapter](notebooks/r) before starting

## Recommended pre-work

- If you have not completed the [Computing](part-computing) part, do that first (terminal + git basics help a lot).
- If you want a gentle stats refresher before starting: skim the lecture notes for this part and do the first few exercises in [Data wrangling in R](notebooks/data-r).

## Do this first

Start with [Data wrangling in R](notebooks/data-r).

## Suggested route

A typical sequence is:
- [Experimental design](notebooks/exp-design) → [t-tests](notebooks/t-f-tests) → [Regression](notebooks/regress)
- Then [ANOVA](notebooks/anova) and the multiple explanatory variable chapters.

## Readings & resources

Look up the `readings/` directory on [MulQuaBio](https://github.com/MulQuaBio/MQB).

- Bolker, B. M.: *Ecological Models and Data in R* (eBook and hardcover available).
- Beckerman, A. P. & Petchey, O. L. (2012) *Getting started with R: an introduction for biologists*. Oxford, Oxford University Press.
- Crawley, M. J. (2013) *The R Book*. 2nd edition. Chichester, Wiley. Excellent but enormous reference book, with code and data [available online](http://www.bio.ic.ac.uk/research/mjcraw/therbook/index.htm)
