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 版)
线性回归和方差分析
309
示例数据
在本章的许多示例中,我们首先使用 R 的伪随机数生成功能创建示例数据。因此,在每
个方法的开头,你可能会看到如下内容:
set.seed(42)
x <- rnorm(100)
e <- rnorm(100, mean=0, sd=5)
y <- 5 + 15 * x + e
我们使用 set.seed 来设置随机数生成种子,这样如果你在计算机上运行示例代码,你
将得到相同的答案。在前面的例子中,x 是来自标准正态分布(均值为 0,标准差为 1
100 次抽样得到的向量。然后我们从正态分布中创建一个称为 e 的随机噪声,其均值
0 且标准差为 5。然后将计算 y=5+15*x+e。创建示例数据而不是使用“真实世界”
数据背后的想法是,通过模拟数据,你可以更改系数和参数,并查看这些改变如何影响最
终的模型。例如,你可以增加示例数据中 e 的标准偏差,并查看它对模型的
R
2
有何影响。
另请参阅
有许多关于线性回归的书籍。我们最喜欢的之一是
Applied Linear Regression Models
(第
4 )( McGraw-Hill/Irwin), Michael KutnerChristopher Nachtsheim John Neter
写。我们在本章中遵循他们的术语和惯例。
我们也喜欢 Julian Faraway 的著作
Linear Models with R
Chapman & Hall/CRC),因为它使
R 来说明回归并且非常易读。早期版本也可以在线免费获得( ...
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