discovr package will contain tutorials associated with my textbook
Discovering Statistics using R and RStudio, due out in early 2021. It will include all datasets, but most important it will contain a series of interactive tutorials that teach
alongside the chapters of the book. The tutorials are written using a package called
learnr. Once a tutorial is running it’s a bit like reading excerpts of the book but with places where you can practice the R code that you have just been taught. The
discovr package is free (as are all things
-related) and offered to support tutors and students using my textbook.
If you’re using a textbook about then you probably already know what it is. If not, R is a free software environment for statistical analysis and graphics. RStudio is a user interface through which to use . RStudio adds functionality that make working with easier, more efficient, and generally more pleasant than working in alone.
The tutorials are named to correspond (roughly) to the relevant chapter of the book. For example, discovr_04 would be a good tutorial to run alongside teaching related to chapter 4, and so on. Some longer chapters have several tutorials that break the content into more manageable chunks. Given the current global situation and the fact that lots of instructors are needing to teach remotely I’m making what I have available before the book is finished and will update as and when new tutorials are written.
afexpackage. This tutorial builds on previous ones to show how models can be fit with two categorical predictors to look at the interaction between them. We look at fitting the models, setting contrasts for the two categorical predictors, obtaining estimated marginal means, interaction plots, simple effects analysis, diagnostic plots, partial eta-squared and partial omega-squared, robust models and Bayes factors.
afexpackage. This tutorial builds on previous ones to show how models can be fit with one or two categorical predictors when these variables have been manipulated within the same entities. We look at fitting the models, setting contrasts for the categorical predictors, obtaining estimated marginal means, interaction plots, simple effects analysis, diagnostic plots, robust models and Bayes factors.
afexpackage. This tutorial builds on previous ones to show how models can be fit with one or two categorical predictors when at least one of these variables has been manipulated within the same entities and at least one other has been manipulated using different entities. We look at fitting the models, setting contrasts for the categorical predictors, obtaining estimated marginal means, interaction plots, simple effects analysis, diagnostic plots, robust models and Bayes factors.
psychpackage. This tutorial uses a fictitious questionnaire (the Anxiety Scale, RAQ) with 23 items to show how EFA can be used to identify clusters of items that may, or may not, represent constructs associated with anxiety about using . We look at inspecting the correlation matrix, obtaining the Bartlett test and KMO statistics, using parallel analysis to determine the number of factors to extract, extracting factors, rotating the solution nd interpretation of the factors. We also learn to obtain Cronbach’s alpha on each of the subscales.
discovr you first need to install
and RStudio. To learn how to do this and to get oriented with
and RStudio complete my interactive tutorial,
getting started with R and RStudio.
You can get the development version of the package from github.com/profandyfield/discovr.
In RStudio Version 1.3 onwards there is a tutorial pane. Having executed
A list of tutorials appears in this pane. Scroll through them and click on the button to run the tutorial:
Alternatively, to run a particular tutorial from the console execute:
library(discovr) learnr::run_tutorial("name_of_tutorial", package = "discovr")
and replace “name of tutorial” with the name of the tutorial you want to run. For example, to run tutorial 3 (for Chapter 3) execute:
learnr::run_tutorial("discovr_03", package = "discovr")
The name of each tutorial is in bold in the list above. Once the command to run the tutorial is executed it will spring to life in the tutorial pane.
The tutorials are self-contained (you practice code in code boxes) so you don’t need to use RStudio at the same time. However, to get the most from them I would recommend that you create an RStudio project and within that open (and save) a new RMarkdown file each time to work through a tutorial. Within that Markdown file, replicate parts of the code from the tutorial (in code chunks) and use Markdown to write notes about what you have done, and to reflect on things that you have struggled with, or note useful tips to help you remember things. Basically, write a learning journal. This workflow has the advantage of not just teaching you the code that you need to do certain things, but also provides practice in using RStudio itself.
Here’s a video explaining how I suggest using the tutorials.