- Simple Linear Regression is a method in which we are able to see the direct relationship between an independent and dependent variable.
- The relationship between x and y is modeled by fitting a linear equation to the observed data.
2024-06-03
## x y ## 1 -0.56047565 0.5718916 ## 2 -0.23017749 1.2809208 ## 3 1.55870831 6.6332545 ## 4 0.07050839 3.5801275 ## 5 0.12928774 2.1620922 ## 6 1.71506499 8.6616656
## ## Call: ## lm(formula = y ~ x, data = data) ## ## Residuals: ## Min 1Q Median 3Q Max ## -2.46443 -0.48623 -0.02705 0.49405 2.02559 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 2.1476 0.1294 16.60 <2e-16 *** ## x 2.9649 0.1411 21.02 <2e-16 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 0.9142 on 48 degrees of freedom ## Multiple R-squared: 0.902, Adjusted R-squared: 0.9 ## F-statistic: 441.8 on 1 and 48 DF, p-value: < 2.2e-16
## `geom_smooth()` using formula = 'y ~ x'
## ## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2': ## ## last_plot
## The following object is masked from 'package:stats': ## ## filter
## The following object is masked from 'package:graphics': ## ## layout
## ## Call: ## lm(formula = y ~ x) ## ## Residuals: ## Min 1Q Median 3Q Max ## -2.46443 -0.48623 -0.02705 0.49405 2.02559 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 2.1476 0.1294 16.60 <2e-16 *** ## x 2.9649 0.1411 21.02 <2e-16 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 0.9142 on 48 degrees of freedom ## Multiple R-squared: 0.902, Adjusted R-squared: 0.9 ## F-statistic: 441.8 on 1 and 48 DF, p-value: < 2.2e-16