Skip to Content
R 语言经典实例(原书第 2 版)
book

R 语言经典实例(原书第 2 版)

by J.D. Long, Paul Teetor
June 2020
Beginner to intermediate
522 pages
9h 6m
Chinese
China Machine Press
Content preview from R 语言经典实例(原书第 2 版)
线性回归和方差分析
319
中变量的数量,因此能对其有效性进行更实际的评估。在多元回归的情况下,我们
将使用 0.8815,而不是 0.8851
F
统计量
# F-statistic: 246.6 on 3 and 96 DF, p-value: < 2.2e-16
F
统计量告诉你模型是否显著。如果有任何回归系数非零(即,对于某些
i
,如果
β
i
0 ),则该模型是显著的。如果所有系数都为零(
β
1
=
β
2
= =
β
n
= 0),模型就
是不显著的。
通常,
p
值小于 0.05 表示该模型可能是显著的(一个或多个
β
i
是非零的),然而
p
值超过 0.05 表明该模型可能不显著。在这里,模型不显著的概率仅为 2.2
×
10
-
16
所以这个模型的结果很理想。
大多数人首先看
R
2
统计量。统计学家明智地先看
F
统计量,因为如果模型不显著,
那么其他的都不重要。
11.4.3 另请参阅
有关从模型对象中提取统计量和相关信息,请参阅 11.3 节。
11.5 运行无截距项的线性回归
11.5.1 问题
需要执行一个线性回归,但是你想设定截距为零。
11.5.2 解决方案
在回归公式的右侧添加 "+ 0"。这将使得 lm 以截距为 0 来拟合模型:
lm(y ~ x + 0)
相应的回归方程是:
y
i
=
βx
i
+
ε
i
11.5.3 讨论
线性回归通常包括截距项,因此这是 R 中的默认设置。但是,在极少数情况下,你可能
希望在假设截距为零时拟合数据。在这种情况下,你做出一个模型假设:当
x
为零时,
y
应为零。
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

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

Aurélien Géron
大规模数据分析和建模:基于 Spark 与 R

大规模数据分析和建模:基于 Spark 与 R

Javier Luraschi, Kevin Kuo, Edgar Ruiz
管理Kubernetes

管理Kubernetes

Brendan Burns, Craig Tracey

Publisher Resources

ISBN: 9787111656814