-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path03_ModelValidation_challenge_markdown.Rmd
78 lines (46 loc) · 1.77 KB
/
03_ModelValidation_challenge_markdown.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
title: 'PPAS Challenge: Practical data concerns'
output:
html_document:
toc: True
pdf_document:
toc: True
---
## Background
In this challenge we use a [Kaggle dataset](https://www.kaggle.com/mazharkarimi/heart-disease-and-stroke-prevention/metadata) with data on the prevalence of cardiovascular disease and risk factors. We have created a synthetic, derivative dataset for the purposes of this challenge. The synthetic dataset contains 5 years of seriatim data on heart attack rates by state, year, sex, age, and race.
## Data license
The database license and content license that govern the original dataset can be found in a document in the PPAS GitHub repository.
## Goals
Prepare data for modeling and validation.
## Load data and packages
```{r Load, warning = F, message = F}
library(dplyr)
library(ggplot2)
library(ROCR)
# Import data and model (from challenge 2) ####
# Only if needed! Feel free to use your own objects from challenge #2.
heartattack <- readRDS("handson_challenges/02_heartdiseasedataset.RDS")
logistic.model <- readRDS("handson_challenges/02_SampleLogisticModel.RDS")
```
## Challenges
### 1) Use the predict() function to create a column of probability predictions in the dataset.
```{r 1_AppendPredictions}
# YOUR CODE HERE ####
```
### 2) Create A/E plots using the holdout subset.
#### a) Across a numeric variable like "Year" (i.e. Year on the x-axis)
```{r 2a_AoverEByYear}
# YOUR CODE HERE ####
```
##### b) Across a categorical variable like "Race" (i.e. Race on the x-axis)
```{r 2b_AoverEByRace}
# YOUR CODE HERE ####
```
### 3) Calculate the AUC on the holdout data.
```{r 3_AUC}
# YOUR CODE HERE ####
```
### 4) Extra: Create a second model and construct a two-way lift chart.
```{r TwoWayLift}
# YOUR CODE HERE ####
```