Book Description
Computational statistics and statistical computing are two areas that employ computational, graphical, and numerical approaches to solve statistical problems, making the versatile R language an ideal computing environment for these fields. One of the first books on these topics to feature R, Statistical Computing with R covers the traditiona
Table of Contents
- Preliminaries
- Preface
- Acknowledgements
- Chapter 1 Introduction
- 1.1 Computational Statistics and Statistical Computing
- 1.2 The R Environment
- 1.3 Getting Started with R
- Syntax
- Syntax
- 1.4 Using the R Online Help System
- 1.5 Functions
- 1.6 Arrays, Data Frames, and Lists
- Data Frames
- Data Frames
- Arrays and Matrices
- Lists
- 1.7 Workspace and Files
- The Working Directory
- The Working Directory
- Reading Data from External Files
- 1.8 Using Scripts
- 1.9 Using Packages
- 1.10 Graphics
- Colors, plotting symbols, and line types
- Colors, plotting symbols, and line types
- Table 1.1
- Table 1.1
- Table 1.2
- Table 1.3
- Table 1.4
- Chapter 2 Probability and Statistics Review
- 2.1 Random Variables and Probability
- Distribution and Density Functions
- Distribution and Density Functions
- Expectation, Variance, and Moments
- Conditional Probability and Independence
- Independence
- Properties of Expected Value and Variance
- 2.2 Some Discrete Distributions
- Binomial and Multinomial Distribution
- Binomial and Multinomial Distribution
- Geometric Distribution
- Alternative formulation of Geometric distribution
- Negative Binomial Distribution
- Poisson Distribution
- Examples
- 2.3 Some Continuous Distributions
- Normal Distribution
- Normal Distribution
- Gamma and Exponential Distributions
- Chisquare and t
- Beta and Uniform Distributions
- Lognormal Distribution
- Examples
- 2.4 Multivariate Normal Distribution
- The bivariate normal distribution
- The bivariate normal distribution
- The multivariate normal distribution
- 2.5 Limit Theorems
- Laws of Large Numbers
- Laws of Large Numbers
- Central Limit Theorem
- 2.6 Statistics
- The empirical distribution function
- The empirical distribution function
- Bias and Mean Squared Error
- Method of Moments
- The Likelihood Function
- Maximum Likelihood Estimation
- 2.7 Bayes’ Theorem and Bayesian Statistics
- The Law of Total Probability
- The Law of Total Probability
- Bayes’ Theorem
- Bayesian Statistics
- 2.8 Markov Chains
- Chapter 3 Methods for Generating Random Variables
- 3.1 Introduction
- Random Generators of Common Probability Distributions in R
- Random Generators of Common Probability Distributions in R
- 3.2 The Inverse Transform Method
- 3.2.1 Inverse Transform Method, Continuous Case
- 3.2.2 Inverse Transform Method, Discrete Case
- 3.3 The Acceptance-Rejection Method
- The Acceptance-Rejection Method
- The Acceptance-Rejection Method
- 3.4 Transformation Methods
- 3.5 Sums and Mixtures
- Convolutions
- Convolutions
- Mixtures
- 3.6 Multivariate Distributions
- 3.6.1 Multivariate Normal Distribution
- Method for generating multivariate normal samples
- Spectral decomposition method for generating Nd(µ, ∑) samples
- SVD Method of generating Nd(µ, Σ) samples
- Choleski factorization method of generating Nd(µ, Σ) samples
- Comparing Performance of Generators
- 3.6.2 Mixtures of Multivariate Normals
- To generate a random sample from pNd(µ1, Σ1) + (1 − p)Nd(µ2, Σ2)
- 3.6.3 Wishart Distribution
- 3.6.4 Uniform Distribution on the d-Sphere
- Algorithm to generate uniform variates on the d-Sphere
- 3.7 Stochastic Processes
- Poisson Processes
- Poisson Processes
- Algorithm for simulating a homogeneous Poisson process on an interval [0, t0] by generating interarrival times.
- Nonhomogeneous Poisson Processes
- Algorithm for simulating a nonhomogeneous Poisson process on an interval [0, t0] by sampling from a homogeneous Poisson process.
- Renewal Processes
- Symmetric Random Walk
- Algorithm to simulate the state Sn of a symmetric random walk
- Packages and Further Reading
- Exercises
- Figure 3.1
- Figure 3.1
- Figure 3.2
- Figure 3.3
- Figure 3.4
- Figure 3.5
- Figure 3.6
- Figure 3.7
- Figure 3.8
- Figure 3.9
- Figure 3.10
- Figure 3.11
- Table 3.1
- Table 3.1
- Chapter 4 Visualization of Multivariate Data
- 4.1 Introduction
- 4.2 Panel Displays
- 4.3 Surface Plots and 3D Scatter Plots
- 4.3.1 Surface plots
- Adding elements to a perspective plot
- Other functions for graphing surfaces
- 4.3.2 Three-dimensional scatterplot
- 4.4 Contour Plots
- 4.5 Other 2D Representations of Data
- 4.5.1 Andrews Curves
- 4.5.2 Parallel Coordinate Plots
- 4.5.3 Segments, stars, and other representations
- 4.6 Other Approaches to Data Visualization
- Exercises
- Figure 4.1
- Figure 4.1
- Figure 4.2
- Figure 4.3
- Figure 4.4
- Figure 4.5
- Figure 4.6
- Figure 4.7
- Figure 4.8
- Figure 4.9
- Figure 4.10
- Table 4.1
- Table 4.1
- Chapter 5 Monte Carlo Integration and Variance Reduction
- 5.1 Introduction
- 5.2 Monte Carlo Integration
- 5.2.1 Simple Monte Carlo estimator
- The standard error of θ^ = 1m∑i=1mg(xi).
- 5.2.2 Variance and Efficiency
- Efficiency
- 5.3 Variance Reduction
- 5.4 Antithetic Variables
- 5.5 Control Variates
- 5.5.1 Antithetic variate as control variate.
- 5.5.2 Several control variates.
- 5.5.3 Control variates and regression.
- 5.6 Importance Sampling
- Variance in Importance Sampling
- Variance in Importance Sampling
- 5.7 Stratified Sampling
- 5.8 Stratified Importance Sampling
- Exercises
- R Code
- Figure 5.1
- Figure 5.1
- Chapter 6 Monte Carlo Methods in Inference
- 6.1 Introduction
- 6.2 Monte Carlo Methods for Estimation
- 6.2.1 Monte Carlo estimation and standard error
- Estimating the standard error of the mean
- 6.2.2 Estimation of MSE
- 6.2.3 Estimating a confidence level
- Monte Carlo experiment to estimate a confidence level
- 6.3 Monte Carlo Methods for Hypothesis Tests
- 6.3.1 Empirical Type I error rate
- 6.3.2 Power of a Test
- Monte Carlo experiment to estimate power of a test against a fixed alternative
- 6.3.3 Power comparisons
- 6.4 Application: “Count Five” Test for Equal Variance
- Exercises
- Projects
- Figure 6.1
- Figure 6.1
- Figure 6.2
- Figure 6.3
- Figure 6.4
- Table 6.1
- Table 6.1
- Table 6.2
- Chapter 7 Bootstrap and Jackknife
- 7.1 The Bootstrap
- 7.1.1 Bootstrap Estimation of Standard Error
- 7.1.2 Bootstrap Estimation of Bias
- 7.2 The Jackknife
- The Jackknife Estimate of Bias
- The Jackknife Estimate of Bias
- The jackknife estimate of standard error
- When the Jackknife Fails
- 7.3 Jackknife-after-Bootstrap
- Jackknife-after-bootstrap: Empirical influence values
- 7.4 Bootstrap Confidence Intervals
- 7.4.1 The Standard Normal Bootstrap Confidence Interval
- 7.4.2 The Basic Bootstrap Confidence Interval
- 7.4.3 The Percentile Bootstrap Confidence Interval
- 7.4.4 The Bootstrap t interval
- Bootstrap t interval (studentized bootstrap interval)
- 7.5 Better Bootstrap Confidence Intervals
- Properties of BCa intervals
- Properties of BCa intervals
- 7.6 Application: Cross Validation
- Procedure to estimate prediction error by n-fold (leave-one-out) cross validation
- Procedure to estimate prediction error by n-fold (leave-one-out) cross validation
- Exercises
- Projects
- Figure 7.1
- Figure 7.1
- Figure 7.2
- Figure 7.3
- Chapter 8 Permutation Tests
- 8.1 Introduction
- Permutation Distribution
- Permutation Distribution
- Approximate permutation test procedure
- 8.2 Tests for Equal Distributions
- Two-sample tests for univariate data
- Two-sample tests for univariate data
- 8.3 Multivariate Tests for Equal Distributions
- Nearest neighbor tests
- Nearest neighbor tests
- Energy test for equal distributions
- Comparison of nearest neighbor and energy tests
- 8.4 Application: Distance Correlation
- Distance Correlation
- Distance Correlation
- Permutation tests of independence
- Approximate permutation test procedure for independence
- Exercises
- Projects
- Figure 8.1
- Figure 8.1
- Figure 8.2
- Figure 8.3
- Figure 8.4
- Figure 8.5
- Table 8.1
- Table 8.1
- Table 8.2
- Chapter 9 Markov Chain Monte Carlo Methods
- 9.1 Introduction
- 9.1.1 Integration problems in Bayesian inference
- 9.1.2 Markov Chain Monte Carlo Integration
- 9.2 The Metropolis-Hastings Algorithm
- 9.2.1 Metropolis-Hastings Sampler
- 9.2.2 The Metropolis Sampler
- 9.2.3 Random Walk Metropolis
- 9.2.4 The Independence Sampler
- 9.3 The Gibbs Sampler
- 9.4 Monitoring Convergence
- 9.4.1 The Gelman-Rubin Method
- 9.5 Application: Change Point Analysis
- Exercises
- R Code
- Code for Figure 9.3 on page 255
- Code for Figure 9.3 on page 255
- Code for Figures 9.4(a) on page 259 and 9.4(b) on page 259
- Code for Figure 9.11 on page 276
- Code for Figure 9.12 on page 276
- Figure 9.1
- Figure 9.1
- Figure 9.2
- Figure 9.3
- Figure 9.4
- Figure 9.5
- Figure 9.6
- Figure 9.7
- Figure 9.8
- Figure 9.9
- Figure 9.10
- Figure 9.11
- Figure 9.12
- Table 9.1
- Table 9.1
- Chapter 10 Probability Density Estimation
- 10.1 Univariate Density Estimation
- 10.1.1 Histograms
- Sturges’ Rule
- Scott’s Normal Reference Rule
- Freedman-Diaconis Rule
- 10.1.2 Frequency Polygon Density Estimate
- 10.1.3 The Averaged Shifted Histogram
- 10.2 Kernel Density Estimation
- Boundary kernels
- Boundary kernels
- 10.3 Bivariate and Multivariate Density Estimation
- 10.3.1 Bivariate Frequency Polygon
- 3D Histogram
- 10.3.2 Bivariate ASH
- 10.3.3 Multidimensional kernel methods
- 10.4 Other Methods of Density Estimation
- Exercises
- R Code
- Code to generate data as shown in Table 10.1 on page 289.
- Code to generate data as shown in Table 10.1 on page 289.
- Code to plot the histograms in Figure 10.4 on page 294.
- Code to plot Figure 10.6 on page 298.
- Code to plot kernels in Figure 10.7 on page 299.
- Figure 10.1
- Figure 10.1
- Figure 10.2
- Figure 10.3
- Figure 10.4
- Figure 10.5
- Figure 10.6
- Figure 10.7
- Figure 10.8
- Figure 10.9
- Figure 10.10
- Figure 10.11
- Figure 10.12
- Figure 10.13
- Table 10.1
- Table 10.1
- Table 10.2
- Chapter 11 Numerical Methods in R
- 11.1 Introduction
- Computer representation of real numbers
- Computer representation of real numbers
- Evaluating Functions
- 11.2 Root-finding in One Dimension
- Bisection method
- Bisection method
- Brent’s method
- 11.3 Numerical Integration
- 11.4 Maximum Likelihood Problems
- 11.5 One-dimensional Optimization
- 11.6 Two-dimensional Optimization
- 11.7 The EM Algorithm
- 11.8 Linear Programming – The Simplex Method
- 11.9 Application: Game Theory
- Exercises
- Figure 11.1
- Figure 11.1
- Figure 11.2
- Figure 11.3
- Figure 11.4
- Table 11.1
- Table 11.1
- Appendix A Notation
- Appendix B Working with Data Frames and Arrays
- B.1 Resampling and Data Partitioning
- B.1.1 Using the boot function
- B.1.2 Sampling without replacement
- B.2 Subsetting and Reshaping Data
- B.2.1 Subsetting Data
- B.2.2 Stacking/Unstacking Data
- B.2.3 Merging Data Frames
- B.2.4 Reshaping Data
- B.3 Data Entry and Data Analysis
- B.3.1 Manual Data Entry
- B.3.2 Recoding Missing Values
- B.3.3 Reading and Converting Dates
- B.3.4 Importing/exporting .csv files
- B.3.5 Examples of data entry and analysis
- Stacked data entry
- Extracting statistics and estimates from fitted models
- Create data frame in stacked layout
- References