Load the Dataset

tmdb_data <- read.csv("TMDB.csv")

# Display the first few rows of the dataset to understand its structure
head(tmdb_data)
##                         Names                  Orig_title           Orig_lang
## 1                   Creed III                   Creed III             English
## 2    Avatar: The Way of Water    Avatar: The Way of Water             English
## 3 The Super Mario Bros. Movie The Super Mario Bros. Movie             English
## 4                     Mummies                      Momias  Spanish, Castilian
## 5                   Supercell                   Supercell             English
## 6                Cocaine Bear                Cocaine Bear             English
##                                           Genre Release_Date Score Budget
## 1                                 Drama, Action   02-03-2023    73   75.0
## 2            Science Fiction, Adventure, Action   15-12-2022    78  460.0
## 3 Animation, Adventure, Family, Fantasy, Comedy   05-04-2023    76  100.0
## 4 Animation, Comedy, Family, Adventure, Fantasy   05-01-2023    70   12.3
## 5                                        Action   17-03-2023    61   77.0
## 6                       Thriller, Comedy, Crime   23-02-2023    66   35.0
##     Revenue    Status Country
## 1  271.6167  Released      AU
## 2 2316.7949  Released      AU
## 3  724.4590  Released      AU
## 4   34.2000  Released      AU
## 5  340.9420  Released      US
## 6   80.0000  Released      AU
##                                                                                                                                                                                                                                                                                                              Crew
## 1          Michael B. Jordan, Adonis Creed, Tessa Thompson, Bianca Taylor, Jonathan Majors, Damien Anderson, Wood Harris, Tony 'Little Duke' Evers, Phylicia Rashād, Mary Anne Creed, Mila Davis-Kent, Amara Creed, Florian Munteanu, Viktor Drago, José Benavidez Jr., Felix Chavez, Selenis Leyva, Laura Chavez
## 2                                    Sam Worthington, Jake Sully, Zoe Saldaña, Neytiri, Sigourney Weaver, Kiri / Dr. Grace Augustine, Stephen Lang, Colonel Miles Quaritch, Kate Winslet, Ronal, Cliff Curtis, Tonowari, Joel David Moore, Norm Spellman, CCH Pounder, Mo'at, Edie Falco, General Frances Ardmore
## 3 Chris Pratt, Mario (voice), Anya Taylor-Joy, Princess Peach (voice), Charlie Day, Luigi (voice), Jack Black, Bowser (voice), Keegan-Michael Key, Toad (voice), Seth Rogen, Donkey Kong (voice), Fred Armisen, Cranky Kong (voice), Kevin Michael Richardson, Kamek (voice), Sebastian Maniscalco, Spike (voice)
## 4    Óscar Barberán, Thut (voice), Ana Esther Alborg, Nefer (voice), Luis Pérez Reina, Carnaby (voice), María Luisa Solá, Madre (voice), Jaume Solà, Sekhem (voice), José Luis Mediavilla, Ed (voice), José Javier Serrano Rodríguez, Danny (voice), Aleix Estadella, Dennis (voice), María Moscardó, Usi (voice)
## 5                                                                Skeet Ulrich, Roy Cameron, Anne Heche, Dr Quinn Brody, Daniel Diemer, William Brody, Jordan Kristine Seamón, Harper Hunter, Alec Baldwin, Zane Rogers, Richard Gunn, Bill Brody, Praya Lundberg, Amy, Johnny Wactor, Martin, Anjul Nigam, Ramesh
## 6                                                                      Keri Russell, Sari, Alden Ehrenreich, Eddie, O'Shea Jackson Jr., Daveed, Ray Liotta, Syd, Kristofer Hivju, Olaf (Kristoffer), Margo Martindale, Ranger Liz, Christian Convery, Henry, Isiah Whitlock Jr., Bob, Jesse Tyler Ferguson, Peter
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Overview
## 1 After dominating the boxing world, Adonis Creed has been thriving in both his career and family life. When a childhood friend and former boxing prodigy, Damien Anderson, resurfaces after serving a long sentence in prison, he is eager to prove that he deserves his shot in the ring. The face-off between former friends is more than just a fight. To settle the score, Adonis must put his future on the line to battle Damien — a fighter who has nothing to lose.
## 2                                                                                                                                                                                           Set more than a decade after the events of the first film, learn the story of the Sully family (Jake, Neytiri, and their kids), the trouble that follows them, the lengths they go to keep each other safe, the battles they fight to stay alive, and the tragedies they endure.
## 3                                                                                                                                                                                                               While working underground to fix a water main, Brooklyn plumbers—and brothers—Mario and Luigi are transported down a mysterious pipe and wander into a magical new world. But when the brothers are separated, Mario embarks on an epic quest to find Luigi.
## 4                                                                                                                                                                                                                                     Through a series of unfortunate events, three mummies end up in present-day London and embark on a wacky and hilarious journey in search of an old ring belonging to the Royal Family, stolen by ambitious archaeologist Lord Carnaby.
## 5                                                        Good-hearted teenager William always lived in hope of following in his late father’s footsteps and becoming a storm chaser. His father’s legacy has now been turned into a storm-chasing tourist business, managed by the greedy and reckless Zane Rogers, who is now using William as the main attraction to lead a group of unsuspecting adventurers deep into the eye of the most dangerous supercell ever seen.
## 6                                                                                                                                                                                                                                                           Inspired by a true story, an oddball group of cops, criminals, tourists and teens converge in a Georgia forest where a 500-pound black bear goes on a murderous rampage after unintentionally ingesting cocaine.

Build a Linear Model

We’ll use “Revenue” as the response variable and “Score” and “Budget” as the explanatory variables.

linear_model <- lm(Revenue ~ Score + Budget, data = tmdb_data)
summary(linear_model)
## 
## Call:
## lm(formula = Revenue ~ Score + Budget, data = tmdb_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -888.54 -107.02  -32.33   75.67 1983.49 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -331.77862   10.12173  -32.78   <2e-16 ***
## Score          5.54427    0.14457   38.35   <2e-16 ***
## Budget         3.58918    0.03429  104.68   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 191.9 on 10175 degrees of freedom
## Multiple R-squared:  0.523,  Adjusted R-squared:  0.5229 
## F-statistic:  5578 on 2 and 10175 DF,  p-value: < 2.2e-16

Diagnose the Model

Let’s use diagnostic plots to understand if there are any issues with the model.

# Plotting diagnostic plots
par(mfrow=c(2,2))
plot(linear_model)

Interpret Coefficients

From the model summary, we can interpret the coefficients: