介绍一本关于S-plus的书籍。
Andreas Krause
Melvin Olson
The Basics of S-PLUS
Fourth Edition
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
1 Introduction 1
1.1 The History of S and S-Plus . . . . . . . . . . . . . . . 2
1.2 S-Plus on Different Operating Systems . . . . . . . . . 4
1.3 Notational Conventions . . . . . . . . . . . . . . . . . . . 6
2 Graphical User Interface 9
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 SystemOverview . . . . . . . . . . . . . . . . . . . . . . 10
2.2.1 Using aMouse . . . . . . . . . . . . . . . . . . . . 11
2.2.2 Object Explorer . . . . . . . . . . . . . . . . . . . 11
2.2.3 CommandsWindow . . . . . . . . . . . . . . . . 11
2.2.4 Toolbars . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.5 Graph Sheets . . . . . . . . . . . . . . . . . . . . 12
2.2.6 ScriptWindow . . . . . . . . . . . . . . . . . . . 12
2.3 Getting Started with the Interface . . . . . . . . . . . . . 13
2.3.1 Importing Data . . . . . . . . . . . . . . . . . . . 13
2.3.2 Graphs . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.3 Data and Statistics . . . . . . . . . . . . . . . . . 15
2.3.4 Customizing the Toolbars . . . . . . . . . . . . . 15
2.3.5 Chapters . . . . . . . . . . . . . . . . . . . . . . . 16
2.4 Detailed Use of the GUI Interface . . . . . . . . . . . . . 18
2.5 Object Explorer . . . . . . . . . . . . . . . . . . . . . . . 18
2.6 Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.7 Data Export . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.8 Working Directory . . . . . . . . . . . . . . . . . . . . . 23
2.9 Data Import . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.10 Data Summaries . . . . . . . . . . . . . . . . . . . . . . . 27
2.11 Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.12 Trellis Graphs . . . . . . . . . . . . . . . . . . . . . . . . 36
2.13 Linear Regression . . . . . . . . . . . . . . . . . . . . . . 38
2.14 PowerPoint (Windows Only) . . . . . . . . . . . . . . . . 42
2.15 Excel (Windows Only) . . . . . . . . . . . . . . . . . . . 44
2.16 ScriptWindow. . . . . . . . . . . . . . . . . . . . . . . . 45
2.17 UNIX/Linux GUI . . . . . . . . . . . . . . . . . . . . . . 47
2.18 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
2.19 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
2.20 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3 A First Session 73
3.1 General Information . . . . . . . . . . . . . . . . . . . . . 73
3.1.1 Starting and Quitting . . . . . . . . . . . . . . . . 74
3.1.2 The Help System . . . . . . . . . . . . . . . . . . 75
3.1.3 Before Beginning . . . . . . . . . . . . . . . . . . 75
3.2 Simple Structures . . . . . . . . . . . . . . . . . . . . . . 76
3.2.1 Arithmetic Operators . . . . . . . . . . . . . . . . 76
3.2.2 Assignments . . . . . . . . . . . . . . . . . . . . . 77
3.2.3 The Concatenate Command: c . . . . . . . . . . . 79
3.2.4 The Sequence Command: seq . . . . . . . . . . . 80
3.2.5 The Replicate Command: rep . . . . . . . . . . . 81
3.3 Mathematical Operations . . . . . . . . . . . . . . . . . 82
3.4 Use of Brackets . . . . . . . . . . . . . . . . . . . . . . . 84
3.5 Logical Values . . . . . . . . . . . . . . . . . . . . . . . . 85
3.6 Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
3.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
3.8 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
4 A Second Session 95
4.1 Constructing and Manipulating Data . . . . . . . . . . . 95
4.1.1 Matrices . . . . . . . . . . . . . . . . . . . . . . . 96
4.1.2 Arrays . . . . . . . . . . . . . . . . . . . . . . . . 101
4.1.3 Data Frames . . . . . . . . . . . . . . . . . . . . . 104
4.1.4 Lists . . . . . . . . . . . . . . . . . . . . . . . . . 107
4.2 Introduction to Functions . . . . . . . . . . . . . . . . . 108
4.3 Introduction toMissing Values . . . . . . . . . . . . . . . 109
4.4 Merging Data . . . . . . . . . . . . . . . . . . . . . . . . 110
4.5 Putting It All Together . . . . . . . . . . . . . . . . . . . 111
4.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
4.7 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
5 Graphics 125
5.1 Basic Graphics Commands . . . . . . . . . . . . . . . . . 125
5.2 Graphics Devices . . . . . . . . . . . . . . . . . . . . . . 126
5.2.1 Working withMultiple Graphics Devices . . . . . 128
5.3 Plotting Data . . . . . . . . . . . . . . . . . . . . . . . . 128
5.3.1 The plot Command . . . . . . . . . . . . . . . . 129
5.3.2 Modifying the Data Display . . . . . . . . . . . . 130
5.3.3 Modifying Figure Elements . . . . . . . . . . . . . 131
5.4 Adding Elements to Existing Plots . . . . . . . . . . . . 133
5.4.1 Functions to Add Elements to Graphs . . . . . . 133
5.4.2 More About abline . . . . . . . . . . . . . . . . 135
5.4.3 More on Adding Axes . . . . . . . . . . . . . . . 135
5.4.4 Adding Text to Graphs . . . . . . . . . . . . . . . 137
5.5 Setting Options . . . . . . . . . . . . . . . . . . . . . . . 138
5.6 Figure Layouts . . . . . . . . . . . . . . . . . . . . . . . 140
5.6.1 Layouts Using Trellis Graphs . . . . . . . . . . . 140
5.6.2 Matrices of Graphs . . . . . . . . . . . . . . . . . 140
5.6.3 Multiple-Screen Graphs . . . . . . . . . . . . . . . 141
5.6.4 Figures of Specified Size . . . . . . . . . . . . . . 142
5.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.8 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
6 Trellis Graphics 153
6.1 An Example . . . . . . . . . . . . . . . . . . . . . . . . . 154
6.2 Trellis Basics . . . . . . . . . . . . . . . . . . . . . . . . . 156
6.2.1 Trellis Syntax . . . . . . . . . . . . . . . . . . . . 156
6.2.2 Trellis Functions . . . . . . . . . . . . . . . . . . 157
6.2.3 Displaying and Storing Graphs . . . . . . . . . . 157
6.3 Output Devices . . . . . . . . . . . . . . . . . . . . . . . 158
6.4 Customizing Trellis Graphs . . . . . . . . . . . . . . . . . 160
6.4.1 Setting Options . . . . . . . . . . . . . . . . . . . 160
6.4.2 Arranging the Layout of a Trellis Graph . . . . . 161
6.4.3 Ordering of Graphs . . . . . . . . . . . . . . . . . 163
6.4.4 Axis Customization . . . . . . . . . . . . . . . . . 164
6.4.5 Modifying Panel Strips . . . . . . . . . . . . . . . 165
6.4.6 Arranging Several Graphs on a Single Page . . . 165
6.4.7 Updating Existing Trellis Graphs . . . . . . . . . 167
6.4.8 Writing Panel Functions . . . . . . . . . . . . . . 168
6.5 Further Trellis Hints . . . . . . . . . . . . . . . . . . . . 171
6.5.1 Useful General Trellis Settings . . . . . . . . . . . 172
6.5.2 Graphing Individual Profiles . . . . . . . . . . . . 173
6.5.3 Preparing Data to Use for Trellis . . . . . . . . . 174
6.5.5 Adding a Key . . . . . . . . . . . . . . . . . . . . 175
6.5.6 The subscripts Option in Panel Functions . . . . 177
6.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
6.7 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
7 Exploring Data 193
7.1 Descriptive Data Exploration . . . . . . . . . . . . . . . 193
7.2 Graphical Exploration . . . . . . . . . . . . . . . . . . . 204
7.2.1 Interactive Dynamic Graphics . . . . . . . . . . . 219
7.2.2 Old-Style Graphics . . . . . . . . . . . . . . . . . 219
7.3 Distributions and Related Functions . . . . . . . . . . . 220
7.4 Confirmatory Statistics and Hypothesis Testing . . . . . 225
7.5 Missing and Infinite Values . . . . . . . . . . . . . . . . . 231
7.5.1 Testing forMissing Values . . . . . . . . . . . . . 232
7.5.2 Supplying Data with Missing Values to Functions 232
7.5.3 Missing Values in Graphs . . . . . . . . . . . . . 233
7.5.4 Infinite Values . . . . . . . . . . . . . . . . . . . . 233
7.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
7.7 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
8 Statistical Modeling 251
8.1 Introductory Examples . . . . . . . . . . . . . . . . . . . 251
8.1.1 Regression . . . . . . . . . . . . . . . . . . . . . . 251
8.1.2 Regression Diagnostics . . . . . . . . . . . . . . . 253
8.2 Statistical Models . . . . . . . . . . . . . . . . . . . . . . 255
8.3 Model Syntax . . . . . . . . . . . . . . . . . . . . . . . . 256
8.4 Regression . . . . . . . . . . . . . . . . . . . . . . . . . . 257
8.4.1 Linear Regression and Modeling Techniques . . . 258
8.4.2 ANOVA . . . . . . . . . . . . . . . . . . . . . . . 261
8.4.3 Logistic Regression . . . . . . . . . . . . . . . . . 263
8.4.4 Survival Data Analysis . . . . . . . . . . . . . . . 265
8.4.5 Endnote . . . . . . . . . . . . . . . . . . . . . . . 267
8.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
8.6 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . 271


雷达卡




京公网安备 11010802022788号







