| itle: “Week 7: Apply it to your data 6” |
| uthor: “Anil Eser” |
| ate: “2024-06-21” |
| utput: html_document |
| ditor_options: |
| chunk_output_type: console |
Import Data
# Excel File
data <- read_excel("../00_data/myData.xlsx")
Introduction
Questions
Variation
Visualizing distributions
data %>%
ggplot(aes(x = stock_symbol)) +
geom_bar()

data %>%
ggplot(mapping = aes(x = low)) +
geom_histogram(binwidth = 30)

data %>%
ggplot(aes(x = adj_close, color = stock_symbol)) +
geom_freqpoly()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

data %>%
ggplot(aes(x = adj_close, color = "NVDA")) +
geom_freqpoly()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

data %>%
ggplot(aes(x = adj_close, color = "MSFT")) +
geom_freqpoly()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

data %>%
ggplot(aes(x = adj_close, color = "INTC")) +
geom_freqpoly()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Typical values
data %>%
filter(adj_close > 20) %>%
ggplot(aes(x = high)) +
geom_histogram(binwidth = 30)

Unusual values
data %>%
ggplot(aes(y = open)) +
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Two Continuous Variables
library(hexbin)
data %>%
ggplot(aes(x = open, y = close )) +
geom_hex()

A Categorical and Continuous Variable
data %>%
ggplot(aes(x = stock_symbol, y = adj_close)) +
geom_boxplot()

Covariation
A categorical and continuous variable
Two categorical variables
Two continous variables
Patterns and models