It is a statistical method that allows us to summarize and study relationships between two continuous variables. The variables have to be quantitative. The main objective of SLR is to find if there is any kind of relationship between the variables and forecast unobserved values.
There are two variables: 1) Predictor variable or Independent variable. 2) Outcome variable or dependent variable
Some of the examples for relationship modeling can be:
Income and spending: The more you earn the more you spend on different things.
Higher sugar intake higher aggressiveness: If you intake products with higher sugar level like soda, chocolate, alcohol, etc. there is a high chance that your behavior will change to aggressiveness.
More study hours result good grades: Student dedicating many hours in studies will result in getting good grades.
These are some of the examples that can be statistically calculated using different statistical tools and one of the tools is SLR.
We can show the relationship between these different variables and can get various analysis to prove these statements.
Below is one of the example where linear model is used by plotting it in a graph.
# load libraries
library(ggplot2)
library(cowplot)
##
## ********************************************************
## Note: As of version 1.0.0, cowplot does not change the
## default ggplot2 theme anymore. To recover the previous
## behavior, execute:
## theme_set(theme_cowplot())
## ********************************************************
# display the data frame, included in R
head(women)
## height weight
## 1 58 115
## 2 59 117
## 3 60 120
## 4 61 123
## 5 62 126
## 6 63 129
# plot height vs. weight
plot <- ggplot(women, aes(height, weight)) +
geom_point() +
geom_smooth(method = "lm")
plot
The above example shows the relationship, when the height increases the weight also increases and vice-versa.