II.) Summary
Call:
lm(formula = length ~ Xray, data = senic)
Residuals:
Min 1Q Median 3Q Max
-2.9226 -1.0810 -0.2708 0.8200 8.7008
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.566373 0.726094 9.043 0.00000000000000567 ***
Xray 0.037756 0.008657 4.361 0.00002905559455877 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.774 on 111 degrees of freedom
Multiple R-squared: 0.1463, Adjusted R-squared: 0.1386
F-statistic: 19.02 on 1 and 111 DF, p-value: 0.00002906
[1] 9.964413
Call:
lm(formula = length ~ facility, data = senic)
Residuals:
Min 1Q Median 3Q Max
-3.2712 -1.0716 -0.2816 0.7584 9.5433
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7.71877 0.51020 15.129 < 0.0000000000000002 ***
facility 0.04471 0.01116 4.008 0.000111 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.795 on 111 degrees of freedom
Multiple R-squared: 0.1264, Adjusted R-squared: 0.1185
F-statistic: 16.06 on 1 and 111 DF, p-value: 0.0001113
[1] 8.61297
Call:
lm(formula = length ~ infection, data = senic)
Residuals:
Min 1Q Median 3Q Max
-3.0587 -0.7776 -0.1487 0.7159 8.2805
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.3368 0.5213 12.156 < 0.0000000000000002 ***
infection 0.7604 0.1144 6.645 0.00000000118 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.624 on 111 degrees of freedom
Multiple R-squared: 0.2846, Adjusted R-squared: 0.2781
F-statistic: 44.15 on 1 and 111 DF, p-value: 0.000000001177
[1] 9.15028
fit lwr upr
1 9.150344 5.914575 12.38611
fit lwr upr
1 8.612921 5.004609 12.22123
fit lwr upr
1 9.964398 6.430556 13.49824
knitr::opts_chunk$set(echo = FALSE, comment = NA, message = FALSE)
options(scipen = 999) #Remove the scientific notation
senic = read.csv("SENIC.csv")
length = senic$length
infection = senic$infection
facility = senic$facility
Xray = senic$Xray
xray.model <- lm(formula = length ~ Xray, data = senic)
summary(xray.model)
0.037756*90 + 6.566373
facility.model <- lm(length ~ facility, data = senic)
summary(facility.model)
0.04471*20+7.71877
infection.model <- lm(length ~ infection, data = senic)
summary(infection.model)
0.7604*3.7 + 6.3368
predict(infection.model, newdata = data.frame(infection = 3.7), interval = "predict", level = 0.95)
predict(facility.model, newdata = data.frame(facility = 20), interval = "predict", level = 0.95)
predict(xray.model, newdata = data.frame(Xray = 90), interval = "predict", level = 0.95)