Simple Linear Regression is a statistical method used to model the relationship between two variables:
- Independent variable (X)
- Dependent variable (Y)
It assumes a linear relationship between X and Y.
Simple Linear Regression is a statistical method used to model the relationship between two variables:
It assumes a linear relationship between X and Y.
The simple linear regression model is represented by:
\[Y = \beta_0 + \beta_1X + \epsilon\]
Where: - \(\beta_0\) is the y-intercept - \(\beta_1\) is the slope - \(\epsilon\) is the error term
Let’s use a dataset of height (X) and weight (Y) to demonstrate simple linear regression.
set.seed(123) height <- runif(100, 150, 200) weight <- 0.5 * height + rnorm(100, 0, 5) data <- data.frame(height, weight)
## `geom_smooth()` using formula = 'y ~ x'
summary(model)
## ## Call: ## lm(formula = weight ~ height, data = data) ## ## Residuals: ## Min 1Q Median 3Q Max ## -11.1899 -3.0661 -0.0987 2.9817 11.0861 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 1.30267 5.99902 0.217 0.829 ## height 0.49102 0.03418 14.365 <2e-16 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 4.846 on 98 degrees of freedom ## Multiple R-squared: 0.678, Adjusted R-squared: 0.6747 ## F-statistic: 206.3 on 1 and 98 DF, p-value: < 2.2e-16
The estimated regression equation:
\[\hat{Y} = \hat{\beta_0} + \hat{\beta_1}X\]
Where: - \(\hat{\beta_0} = -31.62\) (estimated y-intercept) - \(\hat{\beta_1} = 0.51\) (estimated slope)
Therefore, our regression equation is:
\[\hat{Y} = -31.62 + 0.51X\]
Interpretation: - For every 1 cm increase in height, we expect an average increase of 0.51 kg in weight. - The expected weight for a person with 0 cm height would be -31.62 kg (not meaningful in this context).