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.
2026-09-16
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.
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 \]
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'
Linear regression is often calculated to get the least amount of distance between real data and the predictions.
# 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'
Thank you for reading through this presentation!