这本书对学习R,和统计应用,很有帮助,有500多页,详细介绍了如下:
Preface v
Typographical Conventions xi
1 Introduction 1
1.1 A Quick Overview of S . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Using S . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3 An Introductory Session . . . . . . . . . . . . . . . . . . . . . . 6
1.4 WhatNext? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2 DataManipulation 13
2.1 Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2 Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.3 DataManipulation . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.4 Tables andCross-Classification . . . . . . . . . . . . . . . . . . . 37
3 TheS Language 41
3.1 Language Layout . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.2 More on SObjects . . . . . . . . . . . . . . . . . . . . . . . . . 44
3.3 ArithmeticalExpressions . . . . . . . . . . . . . . . . . . . . . . 47
3.4 CharacterVectorOperations . . . . . . . . . . . . . . . . . . . . 51
3.5 Formatting and Printing . . . . . . . . . . . . . . . . . . . . . . . 54
3.6 Calling Conventions for Functions . . . . . . . . . . . . . . . . . 55
3.7 ModelFormulae . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.8 ControlStructures . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3.9 ArrayandMatrixOperations . . . . . . . . . . . . . . . . . . . . 60
3.10 Introduction to Classes and Methods . . . . . . . . . . . . . . . . 66
4 Graphics 69
4.1 GraphicsDevices . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.2 Basic Plotting Functions . . . . . . . . . . . . . . . . . . . . . . 72
vii
viii Contents
4.3 EnhancingPlots . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
4.4 FineControlofGraphics . . . . . . . . . . . . . . . . . . . . . . 82
4.5 Trellis Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5 Univariate Statistics 107
5.1 Probability Distributions . . . . . . . . . . . . . . . . . . . . . . 107
5.2 Generating Random Data . . . . . . . . . . . . . . . . . . . . . . 110
5.3 DataSummaries . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
5.4 ClassicalUnivariateStatistics . . . . . . . . . . . . . . . . . . . . 115
5.5 RobustSummaries . . . . . . . . . . . . . . . . . . . . . . . . . 119
5.6 DensityEstimation . . . . . . . . . . . . . . . . . . . . . . . . . 126
5.7 Bootstrap and Permutation Methods . . . . . . . . . . . . . . . . 133
6 Linear Statistical Models 139
6.1 AnAnalysisofCovarianceExample . . . . . . . . . . . . . . . . 139
6.2 ModelFormulaeandModelMatrices . . . . . . . . . . . . . . . 144
6.3 Regression Diagnostics . . . . . . . . . . . . . . . . . . . . . . . 151
6.4 SafePrediction . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
6.5 Robust andResistantRegression . . . . . . . . . . . . . . . . . . 156
6.6 BootstrappingLinearModels . . . . . . . . . . . . . . . . . . . . 163
6.7 FactorialDesigns andDesignedExperiments . . . . . . . . . . . 165
6.8 An Unbalanced Four-Way Layout . . . . . . . . . . . . . . . . . 169
6.9 PredictingComputerPerformance . . . . . . . . . . . . . . . . . 177
6.10 Multiple Comparisons . . . . . . . . . . . . . . . . . . . . . . . 178
7 Generalized Linear Models 183
7.1 Functions for Generalized Linear Modelling . . . . . . . . . . . . 187
7.2 BinomialData . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
7.3 PoissonandMultinomialModels . . . . . . . . . . . . . . . . . . 199
7.4 ANegativeBinomialFamily . . . . . . . . . . . . . . . . . . . . 206
7.5 Over-DispersioninBinomial andPoissonGLMs . . . . . . . . . 208
8 Non-Linear and Smooth Regression 211
8.1 An Introductory Example . . . . . . . . . . . . . . . . . . . . . . 211
8.2 Fitting Non-Linear Regression Models . . . . . . . . . . . . . . . 212
8.3 Non-Linear Fitted Model Objects and Method Functions . . . . . 217
8.4 ConfidenceIntervals forParameters . . . . . . . . . . . . . . . . 220
8.5 Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Contents ix
8.6 ConstrainedNon-LinearRegression . . . . . . . . . . . . . . . . 227
8.7 One-Dimensional Curve-Fitting . . . . . . . . . . . . . . . . . . 228
8.8 AdditiveModels . . . . . . . . . . . . . . . . . . . . . . . . . . 232
8.9 Projection-PursuitRegression . . . . . . . . . . . . . . . . . . . 238
8.10 NeuralNetworks . . . . . . . . . . . . . . . . . . . . . . . . . . 243
8.11 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
9 Tree-Based Methods 251
9.1 Partitioning Methods . . . . . . . . . . . . . . . . . . . . . . . . 253
9.2 Implementation in rpart . . . . . . . . . . . . . . . . . . . . . . 258
9.3 Implementation in tree . . . . . . . . . . . . . . . . . . . . . . 266
10 Random and Mixed Effects 271
10.1 LinearModels . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
10.2 ClassicNestedDesigns . . . . . . . . . . . . . . . . . . . . . . . 279
10.3 Non-LinearMixedEffectsModels . . . . . . . . . . . . . . . . . 286
10.4 GeneralizedLinearMixedModels . . . . . . . . . . . . . . . . . 292
10.5 GEEModels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
11 ExploratoryMultivariate Analysis 301
11.1 Visualization Methods . . . . . . . . . . . . . . . . . . . . . . . 302
11.2 ClusterAnalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
11.3 FactorAnalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
11.4 DiscreteMultivariateAnalysis . . . . . . . . . . . . . . . . . . . 325
12 Classification 331
12.1 DiscriminantAnalysis . . . . . . . . . . . . . . . . . . . . . . . 331
12.2 ClassificationTheory . . . . . . . . . . . . . . . . . . . . . . . . 338
12.3 Non-ParametricRules . . . . . . . . . . . . . . . . . . . . . . . . 341
12.4 NeuralNetworks . . . . . . . . . . . . . . . . . . . . . . . . . . 342
12.5 Support Vector Machines . . . . . . . . . . . . . . . . . . . . . . 344
12.6 ForensicGlassExample . . . . . . . . . . . . . . . . . . . . . . 346
12.7 CalibrationPlots . . . . . . . . . . . . . . . . . . . . . . . . . . 349
13 Survival Analysis 353
13.1 EstimatorsofSurvivorCurves . . . . . . . . . . . . . . . . . . . 355
13.2 ParametricModels . . . . . . . . . . . . . . . . . . . . . . . . . 359
13.3 Cox Proportional Hazards Model . . . . . . . . . . . . . . . . . . 365
x Contents
13.4 FurtherExamples . . . . . . . . . . . . . . . . . . . . . . . . . . 371
14 Time Series Analysis 387
14.1 Second-Order Summaries . . . . . . . . . . . . . . . . . . . . . . 389
14.2 ARIMAModels . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
14.3 Seasonality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
14.4 Nottingham Temperature Data . . . . . . . . . . . . . . . . . . . 406
14.5 RegressionwithAutocorrelatedErrors . . . . . . . . . . . . . . . 411
14.6 Models forFinancialSeries . . . . . . . . . . . . . . . . . . . . . 414
15 Spatial Statistics 419
15.1 Spatial InterpolationandSmoothing . . . . . . . . . . . . . . . . 419
15.2 Kriging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
15.3 PointProcessAnalysis . . . . . . . . . . . . . . . . . . . . . . . 430
16 Optimization 435
16.1 UnivariateFunctions . . . . . . . . . . . . . . . . . . . . . . . . 435
16.2 Special-PurposeOptimizationFunctions . . . . . . . . . . . . . . 436
16.3 GeneralOptimization . . . . . . . . . . . . . . . . . . . . . . . . 436
Appendices
A Implementation-Specific Details 447
A.1 Using S-PLUS under Unix / Linux . . . . . . . . . . . . . . . . . 447
A.2 Using S-PLUS underWindows . . . . . . . . . . . . . . . . . . . 450
A.3 Using R under Unix / Linux . . . . . . . . . . . . . . . . . . . . 453
A.4 Using R underWindows . . . . . . . . . . . . . . . . . . . . . . 454
A.5 ForEmacsUsers . . . . . . . . . . . . . . . . . . . . . . . . . . 455
B TheS-PLUS GUI 457
C Datasets, Software and Libraries 461
C.1 OurSoftware . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
C.2 UsingLibraries . . . . . . . . . . . . . . . . . . . . . . . . . . . 462