Assignment 8
RULES
You must use a RNotebook for this assignment:
- Sections should have appropriate headers
- All code must be contained within a code chunk. You are allowed to split up your code into many code chunks, or just have one large chunk per section. That is up to you. However, I do not want to see code located outside of a chunk (unless you’re making a quick note or telling us what you’re doing – but the code outside of a chunk shouldn’t be evaluated).
- Any explanations I ask for should be outside of a code chunk (aka formatted text). I personally would put this directly underneath the header, but it can come after the code chunk ends, as well. Whatever you prefer. However, I do not want to see any sentences as comments within a code chunk (e.g.,
#a long sentence like this). Comments within the code is fine in terms of describing what the code is doing. But when I ask for your opinion or an explanation of something, that needs to be formatted text.
You must use the ggplot2 package and syntax for all plotting. No plots in base R.
Interactions on Interactions
You are about to run 3 different regression models that all include interactions. You will need a continuous outcome (DV), 2 continuous predictors, and 2 categorical predictors. I very strongly suggest that for your categorical predictors you only include 2 or 3 levels. If your data has a column that is categorical with a TON of levels, feel free to filter and only keep 2 or 3 of the levels. Make sure that there is more than 1 observation in each of those levels. For example, those of you using the superhero dataset, you might want to use the publisher variable. However, there are like 20 different publishers. I would pick 2 that have a lot of observations. This will make your interpretation much, much easier.
Here’s your to-do list:
- Run a regression model with both of your continuous variables as your predictors. Make sure to include an interaction term!
- Interpret the intercept and all regression coefficients
- Interpret the omnibus test and \(R^2\)
- Visualize this model in any way you find appropriate
- Run a regression model with one continuous variable and one categorical variable as your predictors. Make sure to include an interaction term!
- Interpret the intercept and all regression coefficients
- Interpret the omnibus test and \(R^2\)
- Visualize this model in any way you find appropriate
- Run a regression model with both of your categorical variables as your predictors. Make sure to include an interaction term!
- Interpret the intercept and all regression coefficients
- Interpret the omnibus test and \(R^2\)
- Visualize this model in any way you find appropriate
Done-zo!
Go ahead and submit your .Rmd and .html file to Canvas. If you used an outside dataset, please also submit that, too.