Shivam Batra (19BPS1131) 21/01/2022: List
Shivam Batra (19BPS1131) 21/01/2022: List
Shivam Batra(19BPS1131)
21/01/2022
rm(list=ls()) #To clear the environment
##
## Attaching package: 'dplyr'
# install.packages("ggplot2")
library("ggplot2")
##
## Pearson's product-moment correlation
##
## data: data$wt and data$mpg
## t = -6.5009, df = 13, p-value = 2.001e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.9577274 -0.6562026
## sample estimates:
## cor
## -0.8745029
summary(slr)
##
## Call:
## lm(formula = mpg ~ wt, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.1466 -1.2260 -0.2581 1.6960 4.4584
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 32.4919 2.2672 14.331 2.42e-09 ***
## wt -3.9343 0.6052 -6.501 2.00e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.37 on 13 degrees of freedom
## Multiple R-squared: 0.7648, Adjusted R-squared: 0.7467
## F-statistic: 42.26 on 1 and 13 DF, p-value: 2.001e-05
summary(mlr)
##
## Call:
## lm(formula = mpg ~ wt + gear, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.4103 -1.4951 0.0219 1.4783 3.6583
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 24.1168 6.0198 4.006 0.001742 **
## wt -3.2910 0.7217 -4.560 0.000654 ***
## gear 1.7808 1.1941 1.491 0.161702
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.266 on 12 degrees of freedom
## Multiple R-squared: 0.8015, Adjusted R-squared: 0.7685
## F-statistic: 24.23 on 2 and 12 DF, p-value: 6.111e-05