# Probability and Statistics with R

## Preview

## Book Description

*Cohesively Incorporates Statistical Theory with R Implementation*

Since the publication of the popular first edition of this comprehensive textbook, the contributed R packages on CRAN have increased from around 1,000 to over 6,000. Designed for an intermediate undergraduate course, **Probability and Statistics with R, Second Edition** explores how some of these new packages make analysis easier and more intuitive as well as create more visually pleasing graphs.

*New to the Second Edition*

- Improvements to existing examples, problems, concepts, data, and functions
- New examples and exercises that use the most modern functions
- Coverage probability of a confidence interval and model validation
- Highlighted R code for calculations and graph creation

*Gets Students Up to Date on Practical Statistical Topics*

Keeping pace with today’s statistical landscape, this textbook expands your students’ knowledge of the practice of statistics. It effectively links statistical concepts with R procedures, empowering students to solve a vast array of real statistical problems with R.

*Web Resources*

A supplementary website offers solutions to odd exercises and templates for homework assignments while the data sets and R functions are available on CRAN.

## Table of Contents

**What Is R? **Introduction to R

Downloading and Installing R

Vectors

Mode and Class of an Object

Getting Help

External Editors

RStudio

Packages

R Data Structures

Reading and Saving Data in R

Working with Data

Using Logical Operators with Data Frames

Tables

Summarizing Functions

Probability Functions

Flow Control

Creating Functions

Simple Imputation

Using plot()

Coordinate Systems and Traditional Graphic’s States

**Exploring Data**What Is Statistics?

Data

Displaying Qualitative Data

Displaying Quantitative Data

Summary Measures of Location

Summary Measures of Spread

Bivariate Data

Complex Plot Arrangements

Multivariate Data

**General Probability and Random Variables **Introduction

Counting Techniques

Axiomatic Probability

Random Variables

Moment Generating Functions

**Univariate Probability Distributions **Introduction

Discrete Univariate Distributions

Continuous Univariate Distributions

**Multivariate Probability Distributions **Joint Distribution of Two Random Variables

Independent Random Variables

Several Random Variables

Conditional Distributions

Expected Values, Covariance, and Correlation

Multinomial Distribution

Bivariate Normal Distribution

**Sampling and Sampling Distributions**

Sampling

Parameters

Estimators

Sampling Distribution of the Sample Mean

Sampling Distribution for a Statistic from an Infinite Population

Sampling Distributions Associated with the Normal Distribution

**Point Estimation **Introduction

Properties of Point Estimators

Point Estimation Techniques

**Confidence Intervals **Introduction

Confidence Intervals for Population Means

Confidence Intervals for Population Variances

Confidence Intervals Based on Large Samples

**Hypothesis Testing **Introduction

Type I and Type II Errors

Power Function

Uniformly Most Powerful Test

*ρ*-Value or Critical Level

Tests of Significance

Hypothesis Tests for Population Means

Hypothesis Tests for Population Variances

Hypothesis Tests for Population Proportions

**Nonparametric Methods **Introduction

Sign Test

Wilcoxon Signed-Rank Test

The Wilcoxon Rank-Sum or the Mann-Whitney

*U*-Test

The Kruskal-Wallis Test

Friedman Test for Randomized Block Designs

Goodness-of-Fit Tests

Categorical Data Analysis

Nonparametric Bootstrapping

Permutation Tests

**Experimental Design **Introduction

Fixed Effects Model

Analysis of Variance (ANOVA) for the One-Way Fixed Effects Model

Power and the Non-Central

*F*Distribution

Checking Assumptions

Fixing Problems

Multiple Comparisons of Means

Other Comparisons among the Means

Summary of Comparisons of Means

Random Effects Model (Variance Components Model)

Randomized Complete Block Design

Two-Factor Factorial Design

**Regression **Introduction

Simple Linear Regression

Multiple Linear Regression

Ordinary Least Squares

Properties of the Fitted Regression Line

Using Matrix Notation with Ordinary Least Squares

The Method of Maximum Likelihood

The Sampling Distribution of

*β*

ANOVA Approach to Regression

General Linear Hypothesis

Model Building

Model Validation

Interpreting a Logarithmically Transformed Model

Qualitative Predictors

Estimation of the Mean Response for New Values X

_{h}Prediction and Sampling Distribution of New Observations Y

*(new)*

_{h}Simultaneous Confidence Intervals

Appendix A: R Commands

Appendix B: Quadratic Forms and Random Vectors and Matrices

Bibliography

Index

*Problems appear at the end of each chapter.*

## Author(s)

### Biography

**María Dolores Ugarte** is a professor of statistics in the Department of Statistics and Operations Research at the Public University of Navarre (UPNA). She is an associate editor of *Statistical Modelling, TEST*, and *Computational Statistics and Data Analysis* and an editorial board member of *Spatial and Spatio-temporal Epidemiology*. She received a rating of "Excellent Teacher" from UPNA in 2008 and the INNOLEC Lectureship Award from Masaryk University in 2007. She earned a PhD in statistics from UPNA and completed her postdoctoral training in the Department of Mathematics and Statistics at Simon Fraser University.

**Ana F. Militino** is a professor of statistics at the Public University of Navarre. She is co-editor in chief of *TEST*, official journal of the Spanish Society of Statistics and Operations Research. She received the John Griffiths teaching award in 2011 and was a visiting researcher at Oxford University and Simon Fraser University. She earned a PhD in statistics from the University of Extremadura.

**Alan T. Arnholt** is a professor in the Department of Mathematical Sciences at Appalachian State University, where he has taught undergraduate and graduate statistics since 1993. He earned a PhD in applied statistics from the University of Northern Colorado.

## Reviews

"The book is comprehensive and well written. The notation is clear and the mathematical derivations behind nontrivial equations and computational implementations are carefully explained. Rather than presenting a collection of R scripts together with a summary of relevant theoretical results, this book offers a well-balanced mix of theory, examples and R code."

Praise for the First Edition:"This book covers a wide range of topics in both theoretical and applied statistics … Detailed executable codes and codes to generate the figures in each chapter are available online … nicely blend[s] mathematical statistics, statistical inference, statistical methods, and computational statistics using S language ... . Students or self-learners can learn some basic techniques for using R in statistical analysis on their way to learning about various topics in probability and statistics. This book also could serve as a wonderful stand-alone textbook in probability and statistics if the computational statistics portions are skipped."

—Technometrics, May 2009

—The American Statistician, February 2009"… an impressive book … this is a good reference book with comprehensive coverage of the details of statistical analysis and application that the social researcher may need in their work. I would recommend it as a useful addition to the bookshelf."

—Significance, December 2008