We are movie-goers, we have heavily relied on how many gold stars a movie gets before we decide whether we watch it or not. I have to admit that we miss good movies sometimes because some critics reviews are controversial, another time we regret after watching a movie because it was not what we expected.
When I was browsing Kaggle dataset, I came across an IMDB movie dataset which contains 5043 movies and 28 variables. Looking at the variables, I think I might be able to find something interesting.
Always start from the distribution of the data.
The distribution of the number of reviews is right skewed. Among these 5043 movies, the minimum number of review was 1 and the maximum number of reviews was 813. Majority of the movies received less than 200 reviews.
The score distribution is left skewed, with minimum score at 1.60 and maximum score at 9.50.
Most of the movies in the dataset were produced after 2000.
However, the movies with the highest scores were produced in the 1950s, and there have been significant amount of low score movies came out in the recent years.
Which countries produced the most movies and which countries have the highest scores?
The USA produced the most number of movies.
But that does not mean their movie are all good quality. Kyrgyzstan, Libya and United Arab Emirates might have the highest average scores.
Multiple Linear Regression - Variable Selection
Time to do some serious work, I intend to predict IMDB scores from the other variables using multiple linear regression model. Because regression can’t deal with missing values, I will eliminate all missing values by converting to mean or median.
Now I have got rid of all ‘NA’s. And I picked the following variables as potential candidates for the IMDB score predicators.
num_critic_for_reviews
duration
director_facebook_likes
actor_1_facebook_likes
gross
cast_total_facebook_likes
facenumber_in_poster
budget
movie_facebook_likes
Select a subset of numeric variables for regression modelling.
Construct the model
Split data into training and testing.
Fit the model
I will be using a stepwise selection of variables by backwards elimination. So I start with all candidate varibles and elimiate one at a time.
I am going to eliminate the variables that has little value, - gross and budget, one at a time, and fit it again.
This is the final summary:
From the fitted model, I find that the model is significant since the p-value is very small. The “cast_total_facebook_likes” and “facenumber_in_poster” has negative weight. This model has multiple R-squared score of 0.143, meaning that around 14.3% of the variability can be explained by this model.
Let me make a few plots of the model I arrived at.
If I consider IMDB scores of all movies in the dataset, it is a non-linear fit, it has a small degree of nonlinearity.
This charts shows how all of the examples of residuals compare against theoretical distances from the model. I can see I have a bit problems here because some of the observations are not neatly fit the line.
This chart shows the distribution of residuals around the linear model in relation to the IMDB scores of all movies in my data. The higher the score, the less movies, and most movies are in the low or median score range.
This chart identifies all extrme values, but I don’t see any extrme value has huge impact on my model.
At this point, I think this model is as good as I can get. Let’s evaluate it.
The theoretical model performance is defined here as R-Squared
Check how good the model is on the training set.
The correlation between predicted score and actual score for the training set is 14.44%, which is very close to theoretical R-Squared for the model, this is good news. However, on average, on the set of the observations I have previously seen, I am going to make 1 score difference when estimating.
Check how good the model is on the test set.
This result is not bad, the results of the test set are not far from the results of the training set.
Conclusion
The most important factor that affect movie score is the duration, the longer the movie, the higher the sore will be.
The number of critic reviews is important, the more reviews a movie receives, the higher the score will be.
The face number in poster has a negative effect to the movie score. The more faces in a movie poster, the lower the score will be.
The End
I hope movie will be the same after I learn how to analyze movie data. Apprécier le film!
Source code that created this post can be found here. I am happy to hear any feedback and questions.