library(rio)
p1=import("p1.xlsx")
## New names:
## • `` -> `...4`
p1=p1[-1,]
p1=na.omit(p1)
h1=formula(p1$safe~p1$mili)
r1=lm(h1,data=p1)
summary(r1)
##
## Call:
## lm(formula = h1, data = p1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.30327 -0.42834 0.04095 0.39354 1.52883
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.4761 0.2200 6.709 3.17e-10 ***
## p1$mili 0.5006 0.1149 4.357 2.34e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.598 on 161 degrees of freedom
## Multiple R-squared: 0.1055, Adjusted R-squared: 0.09991
## F-statistic: 18.98 on 1 and 161 DF, p-value: 2.342e-05
h2=formula(p1$mili~p1$co)
r2=lm(h2,data=p1)
summary(r2)
##
## Call:
## lm(formula = h2, data = p1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.67914 -0.21127 -0.07671 0.13529 1.84647
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.36901 0.08372 16.351 < 2e-16 ***
## p1$co 0.27573 0.04319 6.385 1.75e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3664 on 161 degrees of freedom
## Multiple R-squared: 0.2021, Adjusted R-squared: 0.1971
## F-statistic: 40.77 on 1 and 161 DF, p-value: 1.755e-09
anova(r1,r2)
## Warning in anova.lmlist(object, ...): models with response '"p1$mili"' removed
## because response differs from model 1
## Analysis of Variance Table
##
## Response: p1$safe
## Df Sum Sq Mean Sq F value Pr(>F)
## p1$mili 1 6.787 6.7874 18.982 2.342e-05 ***
## Residuals 161 57.570 0.3576
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1