Lab 3

BSTA 512/612

Due: March 3, 2024 at 11pm
Author

Your name here!!

Published

March 3, 2024

Modified

February 23, 2024

# PLEASE DO NOT REMOVE THIS CODE CHUNK!!!
### ADD YOUR LIBRARIES HERE!!! ####

library(tidyverse)
library(gtsummary)
library(here)

1 Directions

You can download the .qmd file for this lab here.

This is your editing file. Please do not remove anything from this editing file!! You will only add your code and work to this file.

1.1 Grading

This lab is graded out of 12 points. Nicky will use the following rubric to assign grades.

1.1.1 Rubric

4 points 3 points 2 points 1 point 0 points
Formatting Lab submitted on Sakai with .html file. Answers are written in complete sentences with no major grammatical nor spelling errors. With little editing, the answer can be incorporated into the project report. Lab submitted on Sakai with .html file. Answers are written in complete sentences with grammatical or spelling errors. With editing, the answer can be incorporated into the project report. Lab submitted on Sakai with .html file. Answers are written in complete sentences with major grammatical or spelling errors. With major editing, the answer can be incorporated into the project report. Lab submitted on Sakai with .html file. Answers are bulletted or do not use complete sentences. Lab not submitted on Sakai with .html file.
Code/Work All tasks are directly followed or answered. This includes all the needed code, in code chunks, with the requested output. All tasks are directly followed or answered. This includes all the needed code, in code chunks, with the requested output. In a few tasks, the code syntax or output is not quite right. Most tasks are directly followed or answered. This includes all the needed code, in code chunks, with the requested output. Some tasks are directly followed or answered.This includes all the needed code, in code chunks, with the requested output. In a few tasks, the code syntax or output is not quite right. More than a quarter of the tasks are not completed properly.
Reasoning* Answers demonstrate understanding of research context and investigation of the data. Answers are thoughtful and can be easily integrated into the final report. Answers demonstrate understanding of research context and investigation of the data. Answers are thoughtful, but lack the clarity needed to easily integrate into the final report. Answers demonstrate some understanding of research context and investigation of the data. Answers are fairly thoughtful, but lack connection to the research. Answers demonstrate some understanding of research context and investigation of the data. Answers seem rushed and with minimal thought. Answers lack understanding of research context and investigation of the data. Answers seem rushed and without thought.

*Applies to questions with reasoning (like Section 2.4 and explanations in Section 2.5)

2 Lab activities

Before starting this lab, you should go back to Lab 2, save a new .rda file that contains all the new variables from that Lab. Then you can load it here!

2.1 Restate your research question

Task

Please restate your research question below using the provided format. It’s repetitive, but it helps me contextualize my feedback as I look through your lab.

2.2 Quality Control

Tasks
  1. Filter out observations with a value of -999 in the race variable.
  2. Glimpse at the observations that may indicate a respondent who has not properly completed the survey portion. This will require filtering for specific answer choices. Please see examples of filter() on it’s documentation page.

2.3 Working with multi-selection variables

Task

If you are using genderIdentity or raceombmulti, create indicator variables for each possible selection.

2.4 Thinking about potential confounders and effect modifiers

Task

For each variable, consider how each could alter the relationship between IAT score and your variable of interest (from your research question). For each covariate, explain how it might or might not change the relationship.

2.5 Continuing data exploration

2.5.1 Bivariate exploration

Task

For each variable outside of your research question, create the appropriate plot to visualize the relationship between IAT score and the variable. Comment if there is an obvious trend or not.

2.5.2 Multivariate exploration

Task

For at least 3 variables outside of your research question, create the appropriate plot to visualize the relationship between IAT score, your main variable (in research question), and the variable outside your research question. Comment whether you can determine anything from the plot or not. If you can, is there any indication that the variable is a confounder or effect modifier?

2.6 Fit a simple linear regression

Task

Run a simple linear regression model for the relationship in your primary research question. Print the regression table. Interpret the results and comment on the initial trend you see.

Bonus Task

This is not required in Lab 3. However, if you want to run a multiple linear regression model with one other variable that you plotted in Multivariate Exploration, then you should try it! Do the results align with your ideas in Section 2.4 and/or the visualization you saw in Section 2.5?