Goal: The goal of this analysis is to predict the average movie rating (vote_average) Click here for the data.
horror_movies <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2022/2022-11-01/horror_movies.csv')
data <- horror_movies %>%
# Remove unnecessary variables
select(-id, -title, -original_language, -overview, -tagline, -release_date, -poster_path, -budget, -revenue, -runtime, -status, -adult, -status, -backdrop_path, -genre_names, -collection, -collection_name) %>%
na.omit()
skimr:: skim(data)
| Name | data |
| Number of rows | 32540 |
| Number of columns | 4 |
| _______________________ | |
| Column type frequency: | |
| character | 1 |
| numeric | 3 |
| ________________________ | |
| Group variables | None |
Variable type: character
| skim_variable | n_missing | complete_rate | min | max | empty | n_unique | whitespace |
|---|---|---|---|---|---|---|---|
| original_title | 0 | 1 | 1 | 191 | 0 | 30296 | 0 |
Variable type: numeric
| skim_variable | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| popularity | 0 | 1 | 4.01 | 37.51 | 0 | 0.6 | 0.84 | 2.24 | 5088.58 | ▇▁▁▁▁ |
| vote_count | 0 | 1 | 62.69 | 420.89 | 0 | 0.0 | 2.00 | 11.00 | 16900.00 | ▇▁▁▁▁ |
| vote_average | 0 | 1 | 3.34 | 2.88 | 0 | 0.0 | 4.00 | 5.70 | 10.00 | ▇▂▆▃▁ |
data %>%
ggplot(aes(vote_count, vote_average)) +
geom_point()
data %>%
group_by(vote_count, vote_average) %>%
summarise(mean_group = mean(vote_average)) -> data2
data2 %>%
ggplot(aes(x= vote_count, y= mean_group,
color= vote_count, shape= vote_average,
group = vote_count,
label = round(mean_group, 2))) +
scale_shape_binned() +
geom_point()
# Prepare Data
data_binarized_tbl <- data %>%
select(-original_title, -popularity) %>%
binarize()
data_binarized_tbl %>% glimpse()
## Rows: 32,540
## Columns: 6
## $ `vote_count__-Inf_2` <dbl> 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
## $ vote_count__2_11 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
## $ vote_count__11_Inf <dbl> 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
## $ `vote_average__-Inf_4` <dbl> 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
## $ vote_average__4_5.7 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
## $ vote_average__5.7_Inf <dbl> 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#Correlate
data_corr_tbl <- data_binarized_tbl %>%
correlate( `vote_average__-Inf_4`)
data_corr_tbl
## # A tibble: 6 × 3
## feature bin correlation
## <fct> <chr> <dbl>
## 1 vote_average -Inf_4 1
## 2 vote_average 4_5.7 -0.588
## 3 vote_average 5.7_Inf -0.579
## 4 vote_count -Inf_2 0.575
## 5 vote_count 11_Inf -0.467
## 6 vote_count 2_11 -0.214
data_corr_tbl %>%
plot_correlation_funnel()