9. Expanding on binary logistic regression

Amy Atkinson

Lab

Today I’ll provide you with two research questions which will require you to complete the statistical tests covered in the lecture. You can work in groups or individually.

You can write your script as a .R or Rmd file. Use the lab preparation video and script, lecture slides, and previous content covered in the statistics modules to help you.

The presentation given at the start of the lab can be downloaded here.

Datasets

The datasets for this lab can be downloaded here.

Research Question 1

You are interested in factors that predict academic achievement in mathematics. Children’s academic achievement can be rated as below expected, at expected or above expected.

The predictors you are interested in are:

  • Number if hours spent revising (continuous)
  • Likes school (Yes/no)
  • Favourite subject (Maths, English or Science)

For the categorical predictors:

-Set the reference category for Likes school as “No” and the reference category for Favourite subject as “Maths”

Tip

See last week’s content for how to set the reference category. Or better yet, revisit your own script to see how you did it last time!

Research Question 2

You work in a nursery. In the nursery, there has been an outbreak of measles. You are interested in factors that predict whether a child in your nursery will have measles (yes/no).

The predictors you are interested in are:

  • Number of hours spent at nursery weekly (continuous)
  • Has siblings (Yes/no)
  • Vaccinated against measles (Yes/no)

For the categorical predictors:

  • Set the reference category for Siblings as “No”
  • Set the reference category for Vaccinated as “No”

For the outcome (measles – yes/no):

  • Set No as 0, and Yes as 1
Tip

See last week’s content for how to set the reference category. Or better yet, revisit your own script to see how you did it last time!

Hints and tips

Your script should aim to answer and interpret the research question above.

Start a new session on the server, load in the required libraries in the following order (car, DescTools, tidyverse, MASS, brant), and then the dataset.

Here are the steps you’ll need to follow:

  1. Prepare our data for analysis
  2. Explore our data
  3. Run the model
  4. Evaluate the model
  5. Evaluate the individual predictors
  6. Predicted probabilities
  7. Assumption checks
  8. Interpret the output
Back to top