---
title: "Visualization 2<br>Numerical vs. Categorical Data"
author: "Keith VanderLinden<br>Calvin University"
output:
  xaringan::moon_reader:
    nature:
      titleSlideClass: ["left", "top"]
      highlightLines: true
      ratio: "16:9"
---


# Characteristics of Data Visualizations

Data visualizations vary according to the:

- Number of variables being plotted:
    - Univariate
    - Bivariate
    - Multivariate
    
- Type of variables being plotted:
    - Numerical:
        - Continuous
        - Discrete
    - Categorical:
        - Ordinal
        - Non-ordinal

???
Variable Number
- *Univariate* data analysis - distribution of single variable
- *Bivariate* data analysis - relationship between two variables
- *Multivariate* data analysis - relationship between many variables at once, usually focusing on bivariate relationships while conditioning for others

Variable Type
- Numerical variables can be classified as:
  - *Continuous*: infinite number of values
  - *Discrete*: only non-negative whole numbers
- If the variable is categorical, we can determine if it is *ordinal* based on whether or not the levels have a natural ordering.

---
# Canonical Plot Types

Response Variable (y) &nbsp; | Explanatory Variable (x) &nbsp; | Plot Type &nbsp; |
:-------------|:-------------|:-------------------|
              | Numerical &nbsp; | density, histogram|
              | Categorical  | bar, column        |
Numerical     | Numerical    | scatter            |
Numerical     | Categorical  | box                |
Categorical   | Categorical  | segmented&nbsp;bar, mosaic      |

We now demo a variety of these plot types.

.footnote[Cf. MDSR Section 3.2.2, Table 3.3, https://mdsr-book.github.io/mdsr2e/ch-vizII.html#multivariate-displays]

???
Notes:
- The first two rows show *variation*; the last three show *co-variation*.
- We'll demo each of these rows, with some variations.

References:
- [Ken's Loans examples](https://cs.calvin.edu/courses/data/202/21fa/slides/w03/w03-viz-numerical.html?panelset=binwidth-%253D-1000&panelset1=plot&panelset2=plot2&panelset3=plot3&panelset4=adjust-%253D-0.5&panelset5=plot4&panelset6=plot5&panelset7=plot6&panelset8=plot7&panelset9=plot8&panelset10=counting#1)
