←
PDF 406 / 520 That tells us something interesting about our data. If we believe our model, then the large diam
→
English · PDF 406
Original PDF page 406
中文 · PDF 406

这告诉了我们一些关于数据的有趣现象。如果我们相信我们的模型,那么大钻石比预期便宜得多。这可能是因为该数据集中没有钻石的价格超过 $19,000。

现在我们可以查看残差,这验证了我们已成功去除了强烈的线性模式:

diamonds2 <- diamonds2 %>% add_residuals(mod_diamond, "lresid") ggplot(diamonds2, aes(lcarat, lresid)) + geom_hex(bins = 50)

重要的是,我们现在可以使用这些残差而不是价格来重做之前的启发性图表:

ggplot(diamonds2, aes(cut, lresid)) + geom_boxplot() ggplot(diamonds2, aes(color, lresid)) + geom_boxplot() ggplot(diamonds2, aes(clarity, lresid)) + geom_boxplot()