---
title: "HW 03 - Missing Data"
author: "YOUR NAME"
date: today
format: html
execute: 
    warning: false
    message: false
---

# Setup
Import data & load libraries. 

```{r}
library(VIM)
library(tidyverse)
library(ggpubr)
load(here::here("data/mi_example.Rdata")) # download this from Canvas
```

# Part I. Exploring Imputation Techniques

### 1. Missingness on the entire data set. 

### 2. Identify the amount of missing in the PB and BSI scales. 

### 3. Explore and describe bivariate missing patterns. 

### 4. Single impute `parent_overprotection` using hot deck 


#### 5. Multiply impute `parent_overprotection` using a non-mice based imputation


#### 5b. Calculate the point estimate $Q$ and the variance $U$ from each imputation. 

#### 5c. Pool estimates


### 6. Comparison of estimates 


----

# Part II: Multiple Imputation using Chained Equations

Build an imputation model for `parental_overprotection`. Do this by imputing the `pb01-pb25`, then recreate the scale post-imputation. "Talk me" through your process. 
### 1. Explore missing data patterns in other variables before you build your model. 



### 2. Multiply impute this data set between $m=5$ and $m=10$ times using MICE.


### 3. Update the summary plot and compare how your new model did. 



### 4. After controlling for other measures, what is the effect of gender on the odds a student will skip school? 

  
#### 4a. Fit this model on the complete cases (no imputation).



#### 4b. Fit this model on the multiply imputed data sets. 



#### 4c. Interpret the effect of gender on playing hookey. Did it change from the complete case model? 



### 4d. Create a plot to compare the results for all coefficients in the model. 



### 4e. What are the biggest differences you notice? 

