This workshop is designed to work with RStudio Cloud. Go to https://rstudio.cloud/ (Monash users can log in with their Monash google account) and create a new project. The workshop can also be done using R locally on your laptop (if doing this, we also recommend you create a new project to contain the files).

Running the R code below will download files and install packages used in this workshop.

```
# Download data
download.file(
"https://monashdatafluency.github.io/r-linear/r-linear-files.zip",
destfile="r-linear-files.zip")
unzip("r-linear-files.zip")
# Install some CRAN packages:
install.packages(c("tidyverse", "multcomp", "emmeans", "BiocManager"))
# Install some Bioconductor packages:
BiocManager::install(c("limma","edgeR","topconfects"))
```

Now load the file `linear_models.R`

in the `r-linear-files`

folder.

- r-linear-files.zip - Files used in this workshop.

Built-in to R:

```
lm, anova, model.matrix, coef, sigma, df.residual, predict, confint, summary
I, poly
```

`splines`

– curve fitting:

`ns, bs`

`multcomp`

– linear hypothesis tests and multiple comparisons:

`glht, mcp, confint, summary`

`limma`

and `edgeR`

– fitting many models to gene expression data:

```
DGEList, calcNormFactors, cpm,
lmFit, contrasts.fit, eBayes, plotSA, topTable
```

- Monash Data Fluency
- Monash Bioinformatics Platform
- More workshop material from Monash Bioinformatics Platform

- Course notes for PH525x (initial chapters of this edX course cover similar material to this workshop)
- James, Witten, Hastie and Tibshirani (2013) “An Introduction to Statistical Learning”
- Dance of the CIs app (to give intuition about Confidence Intervals)
- The Art of Linear Algebra (to give intuition about matrices and vectors – sections 1-3 are relevant to this workshop)
- Testing for differential gene expression often uses linear models. The folks at WEHI have written good introductions to this topic:
- Mixed effects models are a popular next step beyond the fixed effects models covered in this workshop.