```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## Overview

The questions and exercises below all include examples using the `mtcars` dataset from the `car` package. This dataset contains information about various cars, e.g., horsepower, engine type, etc. Alternatively, use another dataset of your choosing with a continuous Y variable and a categorical X variable (with two levels).

In this exercise, you will run models in which a car's average miles per gallon (mpg) is predicted by its weight (wt) and/or the type of transmission (am), i.e., automatic vs. manual.

## 0. Load the car package (install if necessary) and `mtcars` dataset. Create a new dataframe with the `mtcars` data  (Also load the tidyverse package.)

Then, view the first 10 rows of the `mtcars` dataset.

```{r}


```

## 1. First we need to prep our variables. Start by centering the weight variable (wt).

Bonus: Double check that your code worked by looking at the mean of this new centered variable.

```{r}


```

## 2. Now, let's take a look at the transmission type (`am`) variable. We went over two ways of coding categorical variables: dummy coding & effect coding. Which one does the dataframe use by default?

Hint: You can get more information about the variables in the `mtcars` dataset by running ?mtcars.

Now, make a new column where you recode `am` in a *different* way. 

```{r}


```


# 3. Now, fit a linear model predicting average miles per gallon as a function of weight, transmission type (dummy coded), and their interaction. Print the model output and describe the intercept, main effects, and interaction terms. 

```{r}


```

# 4. Fit the same linear model, but this time use the effect coded version of transmission type. Print the model output and describe the intercept, main effects, and interaction term. 

```{r}


```

#5. Compare the two models. Which terms are the same and which are different? Why? How does this effect the interpretation of the model? Does the significance change?

#6. Plot the model output. You can plot either the dummy coded or the effect coded model--it's up to you!

```{r}


```

# Bonus

Plot the model output for the other model. Does anything change?

Run a model with just a main effect (either of the `am` variables or `wt.c`). Interpret the output and plot the model. 

