## 10.41 Risk Variable

20180723 With some knowledge of the data we observe risk_mm captures the amount of rain recorded tomorrow. We refer to this as a risk variable, being a measure of the impact or risk of the target we are predicting (rain tomorrow). The risk is an output variable and should not be used as an input to the modelling—it is not an independent variable. In other circumstances it might actually be treated as the target variable.

# Note the risk variable - measures the severity of the outcome.

risk <- "risk_mm"

For this risk variable note that we expect it to have a value of 0 for all observations when the target variable has the value No.

# Review the distribution of the risk variable for non-targets.

ds %>%
filter(rain_tomorrow == "No") %>%
select(risk_mm) %>%
summary()
##     risk_mm
##  Min.   :0.00000
##  1st Qu.:0.00000
##  Median :0.00000
##  Mean   :0.07302
##  3rd Qu.:0.00000
##  Max.   :1.00000

Interestingly, even a little rain (defined as 1mm or less) is regarded as no rain. That is useful to keep in mind and is a discovery of the data that we might not have expected. As data scientists we should be expecting to find the unexpected.

A similar analysis for the target observations is more in line with expectations.

# Review the distribution of the risk variable for targets.

ds %>%
filter(rain_tomorrow == "Yes") %>%
select(risk_mm) %>%
summary()
##     risk_mm
##  Min.   :  1.10
##  1st Qu.:  2.40
##  Median :  5.20
##  Mean   : 10.16
##  3rd Qu.: 11.60
##  Max.   :474.00

Your donation will support ongoing development and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984.