Hypothesis

My hypothesis for this data set is that certain genres of movies will perform better or worse depending on when they release. For example, I would expect a horror movie to perform better if it releases in October compared to releasing in any other month.

Importing Necessary Libraries

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(lubridate)

Importing CSV

MoviesData <- read.csv("C:\\Users\\nikom\\Advanced_Data_Project\\top_1000_popular_movies_tmdb.csv", header=TRUE, stringsAsFactors = FALSE)

Histogram for Average Movie Scores

hist(
  MoviesData$vote_average,
  main = "Frequency of Average Movie Scores",
  xlab = "Scores",
  xlim = c(0,10),
  col = "darkmagenta",
  freq = TRUE,
  breaks = 10
)

This histogram shows of the frequency of movie scores, showing a normal distribution, with some outliers that have a score of 0, as they have yet to be scored by anyone.

Scatter Plot for Average Score and Number of Votes

plot(MoviesData$vote_count, MoviesData$vote_average, main = "", xlab = "Vote Count", ylab = "Vote Average")

This Scatter Plot is used to assess if there is any correlation between the number of votes a movie has and it’s average score.

Average and Standard Deviation for Average Scores

score_average <- mean(MoviesData$vote_average, na.rm = TRUE)
score_deviation <- sd(MoviesData$vote_average, na.rm = TRUE)
MoviesData$month <- month(ymd(MoviesData$release_date))
## Warning: 1 failed to parse.

Average movie score and standard deviation which can be used to assess how well a movie performs relative to all other movies.

Adding month column to make splitting the dataset easier

MoviesData$month <- month(ymd(MoviesData$release_date))
## Warning: 1 failed to parse.

Splitting data set

horror_oct <- MoviesData %>% filter(grepl('Horror', MoviesData$genres, fixed=TRUE) & MoviesData$month == 10)
horror_other <- MoviesData %>% filter(grepl('Horror', MoviesData$genres, fixed=TRUE) & MoviesData$month != 10)

This is used to split the data into horror movies that released in October and horror movies that released at any other point in the year. I’m doing this to see if there is any significant difference between their scores, as you may expect horror movies released in October to score better.

T-test

ttest_result <- t.test(horror_oct$vote_average,y = horror_other$vote_average)
ttest_result
## 
##  Welch Two Sample t-test
## 
## data:  horror_oct$vote_average and horror_other$vote_average
## t = 1.1454, df = 351.97, p-value = 0.2528
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.06094799  0.23092732
## sample estimates:
## mean of x mean of y 
##   6.04958   5.96459

T-test used to assess if their is any significant differences in movie scores between split data sets. The p-value = 0.2528 at a 95 confidence interval, which leads me to believe there is no significant difference between the scores of horror movies released in October compared to the rest of the year.