- Linear regression is to see if two things are related
- It draws a line through the data that shows which way it trends
- Example: Does budget affect the rating of a movie?
2026-11-01
\[\hat{y} = \beta_0 + \beta_1 x\]
\[\sum_{i=1}^{n} (y_i - \hat{y}_i)^2\]
We will be using the data from IMDB (ggplot2movies package)
Does the budget affect the rating of a movie?
We’ve only kept movies that have a budget
This leaves us with 5183 movies
graph <- lm(rating ~ log10(budget), data = budgetOfMovie)
form <- coef(graph)
names(form) <- c("Intercept", "Slope")
form
## Intercept Slope ## 6.7657534 -0.1008903