v
Contents
Preface..............................................................................................................................................xv
Acknowledgments ........................................................................................................................... xix
Author .............................................................................................................................................xxi
PART I Introduction to Probability, Statistics, Time Series,
and Spatial Analysis
Chapter 1 Introduction ..................................................................................................................3
1.1 Brief History of Statistical and Probabilistic Analysis .....................................3
1.2 Computers ..........................................................................................................4
1.3 Applications .......................................................................................................4
1.4 Types of Variables .............................................................................................4
1.4.1 Discrete.................................................................................................5
1.4.2 Continuous............................................................................................5
1.4.3 Discretization .......................................................................................5
1.4.4 Independent vs. Dependent Variables ..................................................6
1.5 Probability Theory and Random Variables .......................................................6
1.6 Methodology ......................................................................................................6
1.7 Descriptive Statistics .........................................................................................7
1.8 Inferential Statistics ........................................................................................... 7
1.9 Predictors, Models, and Regression ..................................................................7
1.10 Time Series ........................................................................................................ 8
1.11 Spatial Data Analysis ........................................................................................8
1.12 Matrices and Multiple Dimensions ...................................................................8
1.13 Other Approaches: Process-Based Models .......................................................9
1.14 Baby Steps: Calculations and Graphs ................................................................9
1.14.1 Mean, Variance, and Standard Deviation of a Sample ........................9
1.14.2 Simple Graphs as Text: Stem-and-Leaf Plots ..................................... 10
1.14.3 Histograms ......................................................................................... 11
1.15 Exercises .......................................................................................................... 11
1.16 Computer Session: Introduction to R .............................................................. 11
1.16.1 Working Directory ............................................................................ 11
1.16.2 Installing R ........................................................................................ 11
1.16.3 Personalize the R GUI Shortcut ........................................................ 11
1.16.4 Running R..........................................................................................13
1.16.5 Basic R Skills .................................................................................... 13
1.16.6 R Console .......................................................................................... 15
1.16.7 Scripts ................................................................................................15
1.16.8 Graphics Device ................................................................................ 16
1.16.9 Downloading Data Files .................................................................... 17
1.16.10 Read a Simple Text Data File ............................................................ 17
1.16.11 Simple Statistics ................................................................................19
1.16.12 Simple Graphs as Text: Stem-and-Leaf Plots ....................................20
vi Contents
1.16.13 Simple Graphs to a Graphics Window ..............................................20
1.16.14 Addressing Entries of an Array ......................................................... 20
1.16.15 Example: Salinity ..............................................................................22
1.16.16 CSV Text Files ...................................................................................23
1.16.17 Store Your Data Files and Objects ....................................................24
1.16.18 Command History and Long Sequences of Commands ...................25
1.16.19 Editing Data in Objects .....................................................................25
1.16.20 Cleanup and Close R Session ............................................................26
1.16.21 Computer Exercises ........................................................................... 26
Supplementary Reading .............................................................................................27
Chapter 2 Probability Theory .....................................................................................................29
2.1 Events and Probabilities ..................................................................................29
2.2 Algebra of Events ............................................................................................29
2.3 Combinations ................................................................................................... 31
2.4 Probability Trees .............................................................................................32
2.5 Conditional Probability ................................................................................... 33
2.6 Testing Water Quality: False Negative and False Positive ..............................34
2.7 Bayes’ Theorem ...............................................................................................35
2.8 Generalization of Bayes’ Rule to Many Events ...............................................36
2.9 Bio-Sensing .....................................................................................................36
2.10 Decision Making .............................................................................................37
2.11 Exercises ..........................................................................................................39
2.12 Computer Session: Introduction to Rcmdr, Programming,
andMultiplePlots ............................................................................................40
2.12.1 R Commander....................................................................................40
2.12.2 Package Installation and Loading .....................................................40
2.12.3 R GUI SDI Option: Best for R Commander ...................................... 43
2.12.4 How to Import a Text Data File Using Rcmdr .................................. 43
2.12.5 Simple Graphs on a Text Window ..................................................... 45
2.12.6 Simple Graphs on a Graphics Window: Histograms .........................46
2.12.7 More than One Variable: Reading Files and Plot Variables ..............47
2.12.7.1 Using the R Console ...........................................................48
2.12.7.2 Using the R Commander .................................................... 51
2.12.8 Programming Loops .......................................................................... 53
2.12.9 Application: Bayes’ Theorem ............................................................ 54
2.12.10 Application: Decision Making ..........................................................55
2.12.11 More on Graphics Windows ..............................................................55
2.12.12 Editing Data in Objects .....................................................................56
2.12.13 Clean Up and Exit .............................................................................56
2.12.14 Additional GUIs to Use R .................................................................57
2.12.15 Modifying the R Commander ........................................................... 57
2.12.16 Other Packages to Be Used in the Book ............................................57
2.12.17 Computer Exercises ...........................................................................58
Supplementary Reading .............................................................................................58
Chapter 3 Random Variables, Distributions, Moments, and Statistics ....................................... 59
3.1 Random Variables ...........................................................................................59
3.2 Distributions ....................................................................................................59
viiContents
3.2.1 Probability Mass and Density Functions (pmf and pdf) ....................59
3.2.2 Cumulative Functions (cmf and cdf) ..................................................62
3.2.3 Histograms .........................................................................................62
3.3 Moments .......................................................................................................... 63
3.3.1 First Moment or Mean ........................................................................63
3.3.2 Second Central Moment or Variance .................................................64
3.3.3 Population and Sample ....................................................................... 66
3.3.4 Other Statistics and Ways of Characterizing a Sample ......................67
3.4 Some Important RV and Distributions ............................................................ 68
3.5 Application Examples: Species Diversity ........................................................72
3.6 Central Limit Theorem ....................................................................................72
3.7 Random Number Generation ...........................................................................73
3.8 Exercises .......................................................................................................... 74
3.9 Computer Session: Probability and Descriptive Statistics ..............................75
3.9.1 Descriptive Statistics: Categorical Data, Table, and Pie Chart .......... 75
3.9.2 Using a Previously Generated Object or a Dataset ............................78
3.9.3 Summary of Descriptive Statistics and Histogram ............................ 78
3.9.4 Density Approximation ...................................................................... 81
3.9.5 Theoretical Distribution: Example Binomial Distribution ................82
3.9.6 Application Example: Species Diversity ............................................ 86
3.9.7 Random Number Generation .............................................................86
3.9.8 Comparing Sample and Theoretical Distributions:
ExampleBinomial ..............................................................................89
3.9.9 Programming Application: Central Limit Theorem ..........................90
3.9.10 Sampling: Function Sample ...............................................................92
3.9.11 Cleanup and Close R Session ............................................................. 92
3.9.12 Computer Exercises ............................................................................93
Supplementary Reading .............................................................................................93
Chapter 4 Exploratory Analysis and Introduction to Inferential Statistics .................................95
4.1 Exploratory Data Analysis (EDA) ...................................................................95
4.1.1 Index Plot ...........................................................................................95
4.1.2 Boxplot ...............................................................................................95
4.1.3 Empirical Cumulative Distribution Function (ecdf) .......................... 96
4.1.4 QuantileQuantile (q – q) Plots ..........................................................98
4.1.5 Combining Plots for Exploratory Data Analysis (EDA) .................... 98
4.2 Relationships: Covariance and Correlation .....................................................98
4.2.1 Serial Data: Time Series and Autocorrelation ................................. 101
4.3 Statistical Inference ....................................................................................... 102
4.3.1 Hypothesis Testing ........................................................................... 103
4.3.2 p-Value .............................................................................................. 105
4.3.3 Power ................................................................................................ 105
4.3.4 Condence Intervals......................................................................... 107
4.4 Statistical Methods ........................................................................................ 109
4.5 Parametric Methods ...................................................................................... 110
4.5.1 Z Test or Standard Normal ............................................................... 110
4.5.2 The t-Test .......................................................................................... 110
4.5.3 The F Test ......................................................................................... 111
4.5.4 Correlation ........................................................................................ 112

Get Data Analysis and Statistics for Geography, Environmental Science, and Engineering now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.