2024-01-31

<!

Simple linear regression is utilized to analyze correlation between two variables. Analyzing the affect one variable has on another is especially important when comparing multiple variables. Seeing which variables have the most affect on one variable, can be used to determine the most important relations. Overall, using simple linear regression to examine data provides valuable insight into the interrelation between variables.

Numeracy, Maths and statistics - academic skills kit. (n.d.). https://www.ncl.ac.uk/webtemplate/ask-assets/external/maths-resources/statistics/regression-and-correlation/simple-linear-regression.html

Our data is derived from IMBD. The database consists of movies from the years 1903 to 2005. Information on movies is comprised of: title, year, length(in minutes), budget, rating, audience scores(r1-r10), MPAA rating, and genre(Action, Animation, Comedy, Documentary, Romance, and/or Short). In this exploration, we will specifically analyze the interrelation between budget, year, and rating. Here is a snippet sample of these variables in the dataset:

title budget rating year
‘G’ Men 4.5e+05 7.2 1935
‘Manos’ the Hands of Fate 1.9e+04 1.6 1966
’Til There Was You 2.3e+07 4.8 1997
.com for Murder 5.0e+06 3.7 2002
10 Things I Hate About You 1.6e+07 6.7 1999
100 Mile Rule 1.1e+06 5.6 2002

A best fit line can be calculated through the equation for least squares regression line: y = ax + b.

  • a : the slope; the average amount y changes due to corresponding x value.

  • b : the y-intercept; value of y when x = 0.

To find these values, the below formulas are utilized for this calculation:

\(y=\hat{a}+\hat{b}x\)

\(\hat{b}=\frac{{\Delta y}}{{\Delta x}}\)

By isolating each column of interest, taking the average differences between values, we can find a and b values. This done in R by using the following code:

y_set <- movie$rating
delta_y <- y_set - lag(y_set)
delta_y <- na.omit(delta_y)
average_delta_y <- sum(delta_y)/length(delta_y)
x_set <- movie$year
delta_x <- x_set - lag(x_set)
delta_x <- na.omit(delta_x)
average_delta_x <- sum(delta_x)/length(delta_x)
b_hat_xy <- (average_delta_y/average_delta_x)
y_point <- y_set[1]
x_point <- x_set[1]
a_hat_xy <- y_point - (b_hat_xy * x_point)

Thus we get (where y = rating, x = year):

\(y=98.42+0.047x\)

An analysis of how movies across the years are rated on IMBD, provides an insight of audience preferences.

Analysis

Since the b-hat value is 0.047, the influence of the variables, year and rating, on each other is minimal. The rating is not strongly influenced by the year in which the movie was made.

Now we visualize the relationship between rating(y) and budget(x).

\(y=21221+3.812x\)

Analysis

The b-hat value is 3.812, which means there is a stronger positive affect on rating caused by a movie’s budget rather than by a movie’s year made.

This graph includes yet another relationship, year and budget. In the graph, x = year, y = rating, and z = budget

\(x=3.812+8.087z\)

Conclusion

The b-hat value in the last relation (year and budget) was 8.087. This means that as the year’s increased, the budget for movies increased greatly as well. Overall this was the strongest variable interrelationship in the dataset.