2026-09-16

Introduction Slide

Hello! My name is Shreya. Throughout this presentation, I will explain the basics of linear regression (statistical concept). I will show some examples of plots using Plotly and ggplot2.

What is Linear Regression?

Linear Regression is a statistical method used to predict the value of a dependent value (y-variable) based on an separate variable (x-variable). The equation for the line of best fit is below:

\[ y = ax + b \]

Plotly Slide: Linear Regression Plotly using Iris Dataset

Here is the same graph but in ggplot2

library(ggplot2)
gg_graph = ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width)) + geom_point() + geom_smooth(method="lm")
gg_graph
## `geom_smooth()` using formula = 'y ~ x'

More information about linear regression

Linear regression is often calculated to get the least amount of distance between real data and the predictions.

Another ggplot with mtcars dataset

# plot(pressure)
library(ggplot2)
gg_graph = ggplot(mtcars, aes(x=cyl, y=mpg)) + geom_point() + geom_smooth(method="lm")
gg_graph
## `geom_smooth()` using formula = 'y ~ x'

Conclusion

Thank you for reading through this presentation!