
i
i
“K23166” — 2015/1/28 — 9:35 — page 82 — #108
i
i
i
i
i
i
82 CHAPTER 6. LINEAR REGRESSION AND ANOVA
> library(mosaic)
> mplot(lm2, which=7, rows=-1)
[[1]]
95% confidence intervals
estimate
coefficient
age
subcocaine
subalcohol
0 102030
Figure 6.4: Regression coefficient plot
> library(dplyr)
> newds = mutate(newds, pred = fitted(lm1), resid = residuals(lm1))
> with(newds, quantile(resid))
0% 25% 50% 75% 100%
-31.92 -8.25 -4.18 3.58 49.88
One way to print the largest value is to select the observation that matches the largest
value. We use a series of “pipe” operations (A.5.3) to select a set of variables with the
select() function, create the standardized residuals