找回密码
 立即注册
查看: 2178|回复: 0

Statistical Analysis with R Oct.2010.pdf 附带例子R语言代码

[复制链接]
发表于 2013-2-15 17:23:20 | 显示全部楼层 |阅读模式
Statistical Analysis with R Oct.2010.pdf 附带例子R语言代码
目录
Chapter 1: Uncovering the Strategist's Data Analysis Tool 7
What is R? 8
What are the benefits of using R? 8
Why should I use R? 9
Why should I read this book? 9
What topics are covered in this book? 9
Chapter 2—Preparing R for Battle 10
Chapter 3—Exploring the Mysterious Data Analysis Tool 11
Chapter 4—Collecting and Organizing Information 11
Chapter 5—Assessing the Situation 12
Chapter 6—Planning the Attack 12
Chapter 7—Organizing the Battle Plans 13
Chapter 8—Briefing the Emperor 14
Chapter 9—Briefing the Generals 15
Chapter 10—Becoming a Master Strategist 17
Summary 17
Chapter 2: Preparing R for Battle 19
Time for action – downloading and installing R 20
Example: R 2.11.1 Mac OS X 10.5+ installation wizard demonstration 24
Time for action – issuing your first R command 29
Time for action – setting your R working directory 30
Summary 32
Chapter 3: Exploring the Mysterious Data Analysis Tool 33
Deciphering Zhuge Liang's magic square 34
Time for action – solving the first 4x4 magic square 35
Lines 37
Comments 37
Table of Contents
[ ii ]
Calculations 38
Output 38
Visualizing the R console 39
Summary 41
Chapter 4: Collecting and Organizing Information 43
Time for action – importing external data 43
read.csv(file) 44
comma-separated values (csv) files 44
Time for action – creating and calling variables 45
Time for action – accessing data within variables 47
variable$column notation 49
attach(variable) function 49
variable[row, column] notation 50
Time for action – manipulating variable data 51
Performing a calculation on an entire dataset 53
Performing a calculation on a row, column, or cell 54
Using variable data in function arguments 54
Saving a variable calculation into a new variable 55
Time for action – managing the R workspace 57
Listing the contents of the R workspace 58
Saving the contents of the R workspace 59
Loading the contents of the R workspace 59
Quitting R 59
Distinguishing between the R console and workspace 59
Saving the R console 60
Summary 62
Chapter 5: Assessing the Situation 63
Time for action – making an initial inference from our data 63
Examining our data 65
Time for action – creating a subset from a large dataset 66
Multi-argument functions 67
Variable-argument functions 67
Equivalency operators 67
subset(data, ...) 67
Time for action – deriving summary statistics 69
Means 71
Standard deviations 71
Ranges 72
summary(object) 72
Why use summary statistics? 72
Table of Contents
[ iii ]
Time for action – quantifying categorical variables 73
as.numeric(data) 75
Overwriting variables 75
Time for action – correlating variables 77
Interpreting correlations 78
cor(x, y) 79
cor(data) 80
NA values 80
Regression 82
Time for action – modelling with simple linear regression 82
lm(formula, data) 84
Linear model output 84
Linear model summary 85
Interpreting a linear regression model 86
Time for action – modelling with multiple linear regression 88
Interpreting the summary output 90
Explaining model differences 91
Time for action – modelling interactions 92
Interpreting interaction variables 94
Time for action – comparing and choosing models 96
Interpreting the model summaries 98
Interpreting the ANOVA results 99
anova(object, ...) 100
Summary 101
Chapter 6: Planning the Attack 103
Review of models 103
Head to head 104
Surround 105
Ambush 106
Fire 107
Predicting outcomes using regression models 108
Rating 108
Successfully executed 108
Number of Wei soldiers 109
Duration of battle 110
A word about assumptions 110
Time for action – calculating outcomes from regression models 110
Time for action – creating custom functions 111
function() 113
Extended lines 114
Table of Contents
[ iv ]
Time for action – creating resource-focused custom functions 115
Logistical considerations 117
Gold 117
Provisions 117
Equipment 118
Soldiers 118
Resource and cost summary 118
Resource map 118
Time for action – incorporating resource constraints into predictions 119
Gold cost function explanation 120
Assessing viability 121
Time for action – assessing the viability of potential strategies 122
Remember your assumptions 122
Summary 124
Chapter 7: Organizing the Battle Plans 125
Retracing and refining a complete analysis 125
Time for action – first steps 126
Time for action – data setup 126
read.table(...) 128
Time for action – data exploration 129
Time for action – model development 132
glm(...) 138
AIC(object, ...) 138
Time for action – model deployment 139
coef(object) 143
Time for action – last steps 145
The common steps to all R analyses 145
Step 1: Set your working directory 145
Comment your work 146
Step 2: Import your data (or load an existing workspace) 146
Step 3: Explore your data 147
Step 4: Conduct your analysis 148
Step 5: Save your workspace and console files 148
Summary 150
Chapter 8: Briefing the Emperor 151
Charts, graphs, and plots in R 151
Time for action – creating a bar chart 152
barplot(...) 153
Vectors 154
Graphic window 154
Table of Contents
[ ]
Time for action – customizing graphics 156
Graphic customization arguments 159
main, xlab, and ylab 159
xlim and ylim 160
Col 161
legend(...) 162
Time for action – creating a scatterplot 164
Single scatterplot 167
Multiple scatterplots 167
Time for action – creating a line chart 168
type 170
Number-colon-number notation 170
Time for action – creating a box plot 172
boxplot(...) 174
Time for action – creating a histogram 175
hist(...) 176
Time for action – creating a pie chart 177
pie(...) 179
Time for action – exporting graphics 181
Summary 184
Chapter 9: Briefing the Generals 185
More charts, graphs, and plots in R 186
Time for action – customizing a bar chart 186
names 194
width and space 194
horiz 195
beside 196
density and angle 197
legend(...) with density, angle, and cex 198
Time for action – customizing a scatterplot 199
pch and cex 206
points(...) 207
legend(...) 209
abline(...) 209
Time for action – customizing a line chart 212
lwd 216
lines(...) 217
legend(...) 219
Time for action – customizing a box plot 220
range 223
axis(...) 223
Table of Contents
[ vi ]
Time for action – customizing a histogram 225
breaks 228
freq 228
Time for action – customizing a pie chart 230
Custom labels 231
legend(...) 233
Time for action – building a graphic 234
Time for action – building a graphic with multiple visuals 242
par(mfcol) 249
Graphics 249
Horizontal and vertical lines 250
Nested functions 250
Summary 252
Chapter 10: Becoming a Master Strategist 253
R's built-in resources 253
Time for action – using R's help function 254
help(...) 256
Time for action – expanding R with packages 257
Choose a CRAN mirror 260
Install a package 260
Load the package 260
Use the package 261
R's online resources 262
Websites 263
The R Project for Statistical Computing 263
Quick-R 263
R Programming wikibook 263
R Graph Gallery 263
Crantastic! 264
Blogs 264
R bloggers 264
R Tutorial Series 264
Online communities 264
R-help mailing list 264
Other mailing lists 265
Search engines 265
R Seek 265
Google 265
Summary 266
Table of Contents
[ vii ]
Appendix: Pop Quiz Answer Key 267
Chapter 2 267
Chapter 3 267
Chapter 4 267
Chapter 5 268
Chapter 6 269
Chapter 7 270
Chapter 8 270
Chapter 9 271
Chapter 10 273
Index 275



下载:
Statistical Analysis with R.zip (8.45 MB, 下载次数: 1, 售价: 5 )

备注:
很多人都有收集一堆资料而不看的习惯。为了有效利用资源,养成下载一本看一本的习惯,特设置了积分下载,请见谅。
多参加论坛的活动、多帮助别人,会很容易凑够积分的!
祝大家使用愉快!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|R语言中文网

GMT+8, 2024-11-24 22:45 , Processed in 0.037850 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表