2024-02-15

Latex

Let’s say we have 2 points, (3,0) and (2,8) To find the linear line we would put both of them into equations, like this \(0 = a(3)+b\)
\(8 = a(2)+b\)

Sloving equations

We then would solve those equations \(b=-3a\)
\(8=2a-3a\)
\(8=-a\)
\(a=-8\)

Finishing the equations

We then put the a value into one of the equations \(0=(-8)*(3)+b\)
\(b=24\)
So, our regression line is y=-8x+24.

Regression

Linear Regression is a similar concept, but the equation you get is not always accurate for all points. Instead, it finds the line that fits all of the points the closest. Let’s look at some examples.

Rating vs Year for Documentary

This slide shows the year the movie was released compared to the rating it recieved for documentaries.

## `geom_smooth()` using formula = 'y ~ x'

Percentile of 1 ratings vs 10 ratings

This slide compares the percentile of 1 ratings compared to the percentile of 10 ratings for each movie

 ggplot(movies, aes(x=r1, y=r10)) + geom_point(color = 'cornflowerblue') + 
  geom_smooth(method = "lm", color = "violet") 
## `geom_smooth()` using formula = 'y ~ x'

Graph for previous slide

The graph on the previous slide got cut off because of the code, so this is that graph.

## `geom_smooth()` using formula = 'y ~ x'

Length vs votes.

This slide compares the length of short movies to the number of votes it recieves.