Statistics with R

The purpose of this page is to provide an educational resource for researchers to support them in conducting basic quantitative analyses using R. It is also a resource to support students taking my quantitative research methods courses and as such there will be regular updates in line with these courses.

The reason R has been selected is because it is a free and open source tool (https://rstudio.com/products/rstudio/download/), and there is a large community of R users who are regularly developing new packages and creating additional educational resources.

The following subpages are developed by knitting RMarkdown documents as .html files and embedding them in this site.

Importantly, they have all been developed as educational material, so are not all comprehensive tutorials and the full utility of packages of functions.

Core analyses (introductory level):

  • Computing descriptive statistics

  • Visualisations of descriptive statistics

  • Testing the assumption of normality

  • Testing the assumption of equality of variances

  • Computing correlations

  • Adjusting for multiple comparisons and Type I errors

  • Comparing mean differences between two groups

    • Dependent and independent samples t-tests and non-parametric alternatives with effect sizes

  • Identifying and treating univariate outliers

  • Comparing mean differences between three or more groups

    • One-way ANOVA, Welch's one-way test and the Kruskal-Wallis rank sum test with effect sizes

  • Identifying and treating multivariate outliers

  • Multiple regression and the consolidation of the above tests as linear models

  • Controlling for variables

    • ANCOVA as a linear model

Data visualisation (introductory level, focus on ggplot):

  • Developing a visualisation

    • The basic code for creating a visualisation using ggplot, including adding multiple geoms, adding colour and fill, facets, and combining plots

  • Making adjustments to visualisations

    • Changing themes, adding labels (titles, etc.), selecting colour palettes, transparency, choosing different plot types

  • Building information rich plots

    • Adding appropriate geoms, including confidence intervals, including formulae, highlighting information and adding labels

  • Animating plots

Power analysis (introductory level, use of pwr R package):

  • Cohen's conventional effect sizes

  • Power analyses for tests of two means, correlations, balanced one-way ANOVA models, and general linear models.