Skip to Content
面向数据科学家的实用统计学
book

面向数据科学家的实用统计学

by Peter Bruce, Andrew Bruce
October 2018
Beginner to intermediate
238 pages
6h 32m
Chinese
Posts & Telecom Press
Content preview from 面向数据科学家的实用统计学
126
|
第
4
章
散点图平滑
回归就是建模响应变量和预测变量之间的关系。在评估一个回归模型时,使
用
散点图平滑
以可视化方式明确两个变量之间的关系是有用的。
以图
4-7
为例,对绝对残差和预测值之间关系的平滑,显示了残差的方差依
赖于残差的值。在平滑中,使用了
loess
函数。
loess
函数重复地对邻近子
集拟合出一系列本地回归,进而实现平滑。尽管
loess
函数可能是最广为使
用的一种平滑函数,但是
R
中还提供了其他一些散点图平滑函数,例如超平
滑(
supsmu
)和核平滑(
ksmooth
)。如果想要评估一个回归模型,通常并不
需要关心这些散点图平滑的工作细节。
4.6.4
 偏残差图和非线性
偏残差图
以可视化方式展示了估计的拟合值是否很好地反映了预测变量和输出之间的关
系。偏残差图和离群值检测是数据科学家最重要的诊断手段。偏残差图的基本理念是,将
预测变量与响应变量间的关系独立出来,
并考虑所有其他的预测变量
。偏残差可以看成一
种“合成的输出值”,其中组合了基于单个预测变量的预测值,以及来自完全回归方程的
实际残差。预测变量
X
i
的偏残差是普通残差加上与
X
i
关联的回归项。
偏残差
=
残差
+
其中,
是估计的回归系数。
R
中的
predict 函数提供了返回单个回归项
的选项。
terms <- predict(lm_98105, type='terms')
partial_resid <- resid(lm_98105) + terms
偏残差图在
x
轴上显示
X
i
,在
y
轴上显示偏残差。使用 ggplot2,很容易实现在已有绘图 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

精通機器學習

精通機器學習

Aurélien Géron
基于Python的智能文本分析

基于Python的智能文本分析

Benjamin Bengfort, Rebecca Bilbro, Tony Ojeda
Python数据处理

Python数据处理

Jacqueline Kazil, Katharine Jarmul

Publisher Resources

ISBN: 9787115493668