# Statistical Computing with R, Second Edition

## Preview

## Book Description

Praise for the First Edition:

*". . . the book serves as an excellent tutorial on the R language, providing examples that illustrate programming concepts in the context of practical computational problems. The book will be of great interest for all specialists working on computational statistics and Monte Carlo methods for modeling and simulation." *– Tzvetan Semerdjiev, *Zentralblatt Math*

Computational statistics and statistical computing are two areas within statistics that may be broadly described as computational, graphical, and numerical approaches to solving statistical problems. Like its bestselling predecessor, ** Statistical Computing with R, Second Edition** covers the traditional core material of these areas with an emphasis on using the R language via an examples-based approach. The new edition is up-to-date with the many advances that have been made in recent years.

Features

- Provides an overview of computational statistics and an introduction to the R computing environment.
- Focuses on implementation rather than theory.
- Explores key topics in statistical computing including Monte Carlo methods in inference, bootstrap and jackknife, permutation tests, Markov chain Monte Carlo (MCMC) methods, and density estimation.
- Includes new sections, exercises and applications as well as new chapters on resampling methods and programming topics.
- Includes coverage of recent advances including R Studio, the tidyverse, knitr and ggplot2
- Accompanied by online supplements available on GitHub including R code for all the exercises as well as tutorials and extended examples on selected topics.

Suitable for an introductory course in computational statistics or for self-study, *Statistical Computing with R**, Second Edition provides a balanced, accessible introduction to computational statistics and statistical computing.*

About the Author

Maria Rizzo is Professor in the Department of Mathematics and Statistics at Bowling Green State University in Bowling Green, Ohio, where she teaches statistics, actuarial science, computational statistics, statistical programming and data science. Prior to joining the faculty at BGSU in 2006, she was Assistant Professor in the Department of Mathematics at Ohio University in Athens, Ohio. Her main research area is energy statistics and distance correlation. She is the software developer and maintainer of the energy package for R. She also enjoys writing books including a forthcoming joint research monograph on energy statistics.

## Table of Contents

**1. Introduction **Statistical Computing

The R Environment

Getting Started with R and RStudio

Basic Syntax

Using the R Online Help System

Distributions and Statistical Tests

Functions

Arrays, Data Frames, and Lists

Formula Specifications

Graphics Introduction to ggplot

Workspace and Files

Using Scripts

Using Packages

Using R Markdown and knitr

Exercises

**2. Probability and Statistics Review**

Random Variables and Probability

Some Discrete Distributions

Some Continuous Distributions

Multivariate Normal Distribution

Limit Theorems

Statistics

Bayes’ Theorem and Bayesian Statistics

Markov Chains

**3. Methods for Generating Random Variables **Introduction

The Inverse Transform Method

The Acceptance-Rejection Method

Transformation Methods

Sums and Mixtures

Multivariate Distributions

Exercises

**4. Generating Random Processes**Stochastic Processes

Brownian Motions

Exercises

**5. Visualization of Multivariate Data**

Introduction

Panel Displays

Surface Plots and 3D Scatter Plots

Contour Plots

The Grammar of Graphics and ggplot2

Other 2D Representations of Data

Principal Components Analysis

Exercises

**6. Monte Carlo Integration and Variance Reduction**

Introduction

Monte Carlo Integration

Variance Reduction

Antithetic Variables

Control Variates

Importance Sampling

Stratified Sampling

Stratified Importance Sampling

Exercises

RCode

**7. Monte Carlo Methods in Inference **Introduction

Monte Carlo Methods for Estimation

Monte Carlo Methods for Hypothesis Tests

Application

Exercises

**8. Bootstrap and Jackknife**The Bootstrap

The Jackknife

Bootstrap Confidence Intervals

Better Bootstrap Confidence Intervals

Application

Exercises

**9. Resampling Applications**Jackknife-after-Bootstrap

Resampling for Regression Models

Influence

Exercises

**10. Permutation Tests **Introduction

Tests for Equal Distributions

Multivariate Tests for Equal Distributions

Application

Exercises

**11. Markov Chain Monte Carlo Methods**

Introduction

The Metropolis-Hastings Algorithm

The Gibbs Sampler

Monitoring Convergence

Application

Exercises

R Code

**12. Probability Density Estimation **Univariate Density Estimation

Kernel Density Estimation

Bivariate and Multivariate Density Estimation

Other Methods of Density Estimation

Exercises

R Code

**13. Introduction to Numerical Methods in R**Introduction

Root-finding in One Dimension

Numerical Integration

Maximum Likelihood Problems

Application

Exercises

**14. Optimization 401**Introduction

One-dimensional Optimization

Maximum likelihood estimation with mle

Two-dimensional Optimization

The EM Algorithm

Linear Programming – The Simplex Method

Application

Exercises

**15. Programming Topics**Introduction

Benchmarking: Comparing the Execution Time of Code

Profiling

Object Size, Attributes, and Equality

Finding Source Code

Linking C/C++ Code using Rcpp

Application

Exercises

## Author(s)

### Biography

**Maria Rizzo** is Professor in the Department of Mathematics and Statistics at Bowling Green State University in Bowling Green, Ohio, where she teaches statistics, actuarial science, computational statistics, statistical programming and data science. Prior to joining the faculty at BGSU in 2006, she was Assistant Professor in the Department of Mathematics at Ohio University in Athens, Ohio. Her main research area is energy statistics and distance correlation. She is the software developer and maintainer of the energy package for R. She also enjoys writing books including a forthcoming joint research monograph on energy statistics.

## Reviews

Praise for the First Edition:"… an excellent tutorial on the R language, providing examples that illustrate programming concepts in the context of practical computational problems. The book will be of great interest for all specialists working on computational statistics and Monte Carlo methods for modeling and simulation."

—Tzvetan Semerdjiev,Zentralblatt Math, 2008, Vol. 1137"Statistical computing and computational statistics are two areas of statistics described as computational, graphical, and numerical approaches to solving statistical problems. Statistical Computing with R comprises, thorough and examples-based approach, the conventional core material of computational statistics with an emphasis on R... This book includes standard statistical computing topics using the R language... All examples in the text are realised in R. Software is actively maintained, it has good connectivity to various types of data and other systems, and it is versatile. In addition, R is very stable and reliable... The book also includes exercises and applications in all chapters, as well as coverage of recent advances including R Studio. Many examples are included, fully implemented in the R statistical

computing environment, and the R code for the examples can be downloaded from the author’s website. Most examples and exercises apply datasets accessible in the R distribution or simulated data. The author, Maria L. Rizzo, is a Full Professor at the Department of Mathematics and Statistics of Bowling Green State University (US) and is an expert on Applied Statistics, Statistical Computing, and Energy Statistics... After finishing the book, I feel that it is a well-written text useful for biostatisticians and graduate teachers, principally because it is written by a leading expert who is engaged in statistical modelling and methodological developments and applications in the real world. In my opinion, the book is a must-have for the interested biostatistician audience."

-Luca Bertolaccini, ISCB December 2019