lab9 - SoMi Choi Lab9 STAT 35000 A 1 >...

This preview shows page 1 - 4 out of 8 pages.

SoMi Choi Lab9 STAT 35000 A. 1. > BB=read.table(file="ex10-23bac.txt", header=T) > Beers=BB$Beers > BAC=BB$BAC > plot(Beers, BAC, xlab="Beers", ylab="BAC") > line = lm(BAC~Beers) > abline(line) > BB.lm=lm(BAC~Beers) > BB.resid=resid(BB.lm) > plot(Beers, BB.resid, main="Residual plot", ylab="Residual") > abline(h=0)
SoMi Choi Lab9 STAT 35000 It looks linear with a positive correlation. However there could be problem with high value of Beers. 2. > summary(BB.lm) Call: lm(formula = BAC ~ Beers) Residuals: Min 1Q Median 3Q Max -0.027118 -0.017350 0.001773 0.008623 0.041027 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.012701 0.012638 -1.005 0.332 Beers 0.017964 0.002402 7.480 2.97e-06 *** ---
SoMi Choi Lab9 STAT 35000 Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.02044 on 14 degrees of freedom Multiple R-squared: 0.7998, Adjusted R-squared: 0.7855 F-statistic: 55.94 on 1 and 14 DF, p-value: 2.969e-06 > confint(BB.lm, level=0.95) 2.5 % 97.5 % (Intercept) -0.03980535 0.01440414 Beers 0.01281262 0.02311490 BAC = -0.012701 + 0.017964Beers R^2 = 0.7998 3. Since the assumptions are met, we can use inference in this situation. The R-squared is high enough too.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture