




























































































Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Esta página não é visível na pré-visualização
Não perca as partes importantes!





























































































Wendy L. Martinez
Angel R. Martinez
Boca Raton London New York Washington, D.C.
To
Edward J. Wegman
Teacher, Mentor and Friend
Preface
1.1 What Is Computational Statistics? 1.2 An Overview of the Book Philosophy What Is Covered A Word About Notation 1.3 M ATLAB Code Computational Statistics Toolbox Internet Resources 1.4 Further Reading
2.1 Introduction 2.2 Probability Background Probability Axioms of Probability 2.3 Conditional Probability and Independence Conditional Probability Independence Bayes Theorem 2.4 Expectation Mean and Variance Skewness Kurtosis 2.5 Common Distributions Binomial Poisson Uniform Normal Exponential Gamma Chi-Square Weibull Beta
Table of Contents ix
4.5 M ATLAB Code 4.6 Further Reading Exercises
5.1 Introduction 5.2 Exploring Univariate Data Histograms Stem-and-Leaf Quantile-Based Plots - Continuous Distributions Q-Q Plot Quantile Plots Quantile Plots - Discrete Distributions Poissonness Plot Binomialness Plot Box Plots 5.3 Exploring Bivariate and Trivariate Data Scatterplots Surface Plots Contour Plots Bivariate Histogram 3-D Scatterplot 5.4 Exploring Multi-Dimensional Data Scatterplot Matrix Slices and Isosurfaces Star Plots Andrews Curves Parallel Coordinates Projection Pursuit Projection Pursuit Index Finding the Structure Structure Removal Grand Tour 5.5 M ATLAB Code 5.6 Further Reading Exercises
6.1 Introduction 6.2 Classical Inferential Statistics Hypothesis Testing Confidence Intervals 6.3 Monte Carlo Methods for Inferential Statistics
x Computational Statistics Handbook with M ATLAB
Basic Monte Carlo Procedure Monte Carlo Hypothesis Testing Monte Carlo Assessment of Hypothesis Testing 6.4 Bootstrap Methods General Bootstrap Methodology Bootstrap Estimate of Standard Error Bootstrap Estimate of Bias Bootstrap Confidence Intervals Bootstrap Standard Confidence Interval Bootstrap- t Confidence Interval Bootstrap Percentile Interval 6.5 M ATLAB Code 6.6 Further Reading Exercises
7.1 Introduction 7.2 Cross-Validation 7.3 Jackknife 7.4 Better Bootstrap Confidence Intervals 7.5 Jackknife-After-Bootstrap 7.6 M ATLAB Code 7.7 Further Reading Exercises
8.1 Introduction 8.2 Histograms 1-D Histograms Multivariate Histograms Frequency Polygons Averaged Shifted Histograms 8.3 Kernel Density Estimation Univariate Kernel Estimators Multivariate Kernel Estimators 8.4 Finite Mixtures Univariate Finite Mixtures Visualizing Finite Mixtures Multivariate Finite Mixtures EM Algorithm for Estimating the Parameters Adaptive Mixtures 8.5 Generating Random Variables 8.6 M ATLAB Code
xii Computational Statistics Handbook with M ATLAB
Exercises
11.1 Introduction 11.2 Background Bayesian Inference Monte Carlo Integration Markov Chains Analyzing the Output 11.3 Metropolis-Hastings Algorithms Metropolis-Hastings Sampler Metropolis Sampler Independence Sampler Autoregressive Generating Density 11.4 The Gibbs Sampler 11.5 Convergence Monitoring Gelman and Rubin Method Raftery and Lewis Method 11.6 M ATLAB Code 11.7 Further Reading Exercises
12.1 Introduction What Is Spatial Statistics? Types of Spatial Data Spatial Point Patterns Complete Spatial Randomness 12.2 Visualizing Spatial Point Processes 12.3 Exploring First-order and Second-order Properties Estimating the Intensity Estimating the Spatial Dependence Nearest Neighbor Distances - G and F Distributions K -Function 12.4 Modeling Spatial Point Processes Nearest Neighbor Distances K -Function 12.5 Simulating Spatial Point Processes Homogeneous Poisson Process Binomial Process Poisson Cluster Process Inhibition Process Strauss Process
Table of Contents xiii
12.6 M ATLAB Code 12.7 Further Reading Exercises
A.1 What Is M ATLAB? A.2 Getting Help in M ATLAB A.3 File and Workspace Management A.4 Punctuation in M ATLAB A.5 Arithmetic Operators A.6 Data Constructs in M ATLAB Basic Data Constructs Building Arrays Cell Arrays A.7 Script Files and Functions A.8 Control Flow For Loop While Loop If-Else Statements Switch Statement A.9 Simple Plotting A.10 Contact Information
C.1 Indexes Friedman-Tukey Index Entropy Index Moment Index Distances C.2 M ATLAB Source Code
D.1 Bootstrap Confidence Interval D.2 Adaptive Mixtures Density Estimation D.3 Classification Trees D.4 Regression Trees
Preface
Computational statistics is a fascinating and relatively new field within sta- tistics. While much of classical statistics relies on parameterized functions and related assumptions, the computational statistics approach is to let the data tell the story. The advent of computers with their number-crunching capability, as well as their power to show on the screen two- and three- dimensional structures, has made computational statistics available for any data analyst to use. Computational statistics has a lot to offer the researcher faced with a file full of numbers. The methods of computational statistics can provide assis- tance ranging from preliminary exploratory data analysis to sophisticated probability density estimation techniques, Monte Carlo methods, and pow- erful multi-dimensional visualization. All of this power and novel ways of looking at data are accessible to researchers in their daily data analysis tasks. One purpose of this book is to facilitate the exploration of these methods and approaches and to provide the tools to make of this, not just a theoretical exploration, but a practical one. The two main goals of this book are:
M AT L AB a nd H a n d le G r a p h ic s ® a re re g is t e re d t ra de m a r k s o f The MathWorks, Inc. There are wonderful books that cover many of the techniques in computa- tional statistics and, in the course of this book, references will be made to many of them. However, there are very few books that have endeavored to forgo the theoretical underpinnings to present the methods and techniques in a manner immediately usable to the practitioner. The approach we take in this book is to make computational statistics accessible to a wide range of users and to provide an understanding of statistics from a computational point of view via algorithms applied to real applications. This book is intended for researchers in engineering, statistics, psychology, biostatistics, data mining and any other discipline that must deal with the analysis of raw data. Students at the senior undergraduate level or beginning graduate level in statistics or engineering can use the book to supplement course material. Exercises are included with each chapter, making it suitable as a textbook for a course in computational statistics and data analysis. Scien-
xvi Computational Statistics Handbook with M ATLAB
tists who would like to know more about programming methods for analyz- ing data in MATLAB would also find it useful. We assume that the reader has the following background:
We list below some of the major features of the book.
Chapter 1
Introduction
Obviously, computational statistics relates to the traditional discipline of sta- tistics. So, before we define computational statistics proper, we need to get a handle on what we mean by the field of statistics. At a most basic level, sta- tistics is concerned with the transformation of raw data into knowledge [Wegman, 1988]. When faced with an application requiring the analysis of raw data, any sci- entist must address questions such as:
Statistics is concerned with the science of uncertainty and can help the scien- tist deal with these questions. Many classical methods (regression, hypothe- sis testing, parameter estimation, confidence intervals, etc.) of statistics developed over the last century are familiar to scientists and are widely used in many disciplines [Efron and Tibshirani, 1991]. Now, what do we mean by computational statistics? Here we again follow the definition given in Wegman [1988]. Wegman defines computational sta- tistics as a collection of techniques that have a strong “focus on the exploita- tion of computing in the creation of new statistical methodology.” Many of these methodologies became feasible after the development of inexpensive computing hardware since the 1980’s. This computing revolu- tion has enabled scientists and engineers to store and process massive amounts of data. However, these data are typically collected without a clear idea of what they will be used for in a study. For instance, in the practice of data analysis today, we often collect the data and then we design a study to
2 Computational Statistics Handbook with M ATLAB
gain some useful information from them. In contrast, the traditional approach has been to first design the study based on research questions and then collect the required data. Because the storage and collection is so cheap, the data sets that analysts must deal with today tend to be very large and high-dimensional. It is in sit- uations like these where many of the classical methods in statistics are inad- equate. As examples of computational statistics methods, Wegman [1988] includes parallel coordinates for high dimensional data representation, non- parametric functional inference, and data set mapping where the analysis techniques are considered fixed. Efron and Tibshirani [1991] refer to what we call computational statistics as computer-intensive statistical methods. They give the following as examples for these types of techniques: bootstrap methods, nonparametric regression, generalized additive models and classification and regression trees. They note that these methods differ from the classical methods in statistics because they substitute computer algorithms for the more traditional mathematical method of obtaining an answer. An important aspect of computational statis- tics is that the methods free the analyst from choosing methods mainly because of their mathematical tractability. Volume 9 of the Handbook of Statistics : Computational Statistics [Rao, 1993] covers topics that illustrate the “... trend in modern statistics of basic method- ology supported by the state-of-the-art computational and graphical facili- ties...” It includes chapters on computing, density estimation, Gibbs sampling, the bootstrap, the jackknife, nonparametric function estimation, statistical visualization, and others. We mention the topics that can be considered part of computational statis- tics to help the reader understand the difference between these and the more traditional methods of statistics. Table 1.1 [Wegman, 1988] gives an excellent comparison of the two areas.
PPPPhhhhiiilosiloslosolosooophphphphyyyy
The focus of this book is on methods of computational statistics and how to implement them. We leave out much of the theory, so the reader can concen- trate on how the techniques may be applied. In many texts and journal arti- cles, the theory obscures implementation issues, contributing to a loss of interest on the part of those needing to apply the theory. The reader should not misunderstand, though; the methods presented in this book are built on solid mathematical foundations. Therefore, at the end of each chapter, we
4 Computational Statistics Handbook with M ATLAB
will be used in later chapters of the book. Chapter 3 covers some of the basic ideas of statistics and sampling distributions. Since many of the methods in computational statistics are concerned with estimating distributions via sim- ulation, this chapter is fundamental to the rest of the book. For the same rea- son, we present some techniques for generating random variables in Chapter 4. Some of the methods in computational statistics enable the researcher to explore the data before other analyses are performed. These techniques are especially important with high dimensional data sets or when the questions to be answered using the data are not well focused. In Chapter 5, we present some graphical exploratory data analysis techniques that could fall into the category of traditional statistics (e.g., box plots, scatterplots). We include them in this text so statisticians can see how to implement them in MATLAB and to educate scientists and engineers as to their usage in exploratory data analysis. Other graphical methods in this chapter do fall into the category of computational statistics. Among these are isosurfaces, parallel coordinates, the grand tour and projection pursuit. In Chapters 6 and 7, we present methods that come under the general head- ing of resampling. We first cover some of the general concepts in hypothesis testing and confidence intervals to help the reader better understand what follows. We then provide procedures for hypothesis testing using simulation, including a discussion on evaluating the performance of hypothesis tests. This is followed by the bootstrap method, where the data set is used as an estimate of the population and subsequent sampling is done from the sam- ple. We show how to get bootstrap estimates of standard error, bias and con- fidence intervals. Chapter 7 continues with two closely related methods called jackknife and cross-validation. One of the important applications of computational statistics is the estima- tion of probability density functions. Chapter 8 covers this topic, with an emphasis on the nonparametric approach. We show how to obtain estimates using probability density histograms, frequency polygons, averaged shifted histograms, kernel density estimates, finite mixtures and adaptive mixtures. Chapter 9 uses some of the concepts from probability density estimation and cross-validation. In this chapter, we present some techniques for statisti- cal pattern recognition. As before, we start with an introduction of the classi- cal methods and then illustrate some of the techniques that can be considered part of computational statistics, such as classification trees and clustering. In Chapter 10 we describe some of the algorithms for nonparametric regression and smoothing. One nonparametric technique is a tree-based method called regression trees. Another uses the kernel densities of Chapter 8. Finally, we discuss smoothing using loess and its variants. An approach for simulating a distribution that has become widely used over the last several years is called Markov chain Monte Carlo. Chapter 11 covers this important topic and shows how it can be used to simulate a pos- terior distribution. Once we have the posterior distribution, we can use it to estimate statistics of interest (means, variances, etc.).
Chapter 1: Introduction 5
We conclude the book with a chapter on spatial statistics as a way of show- ing how some of the methods can be employed in the analysis of spatial data. We provide some background on the different types of spatial data analysis, but we concentrate on spatial point patterns only. We apply kernel density estimation, exploratory data analysis, and simulation-based hypothesis test- ing to the investigation of spatial point processes. We also include several appendices to aid the reader. Appendix A contains a brief introduction to MATLAB, which should help readers understand the code in the examples and exercises. Appendix B is an index to notation, with definitions and references to where it is used in the text. Appendices C and D include some further information about projection pursuit and MATLAB source code that is too lengthy for the body of the text. In Appendices E and F, we provide a list of the functions that are contained in the MATLAB Statis- tics Toolbox and the Computational Statistics Toolbox, respectively. Finally, in Appendix G, we include a brief description of the data sets that are men- tioned in the book.
AAAA WWWoWooorrrrddd About NdAbout NAbout NAbout Nooototttaaaattttionionionion
The explanation of the algorithms in computational statistics (and the under- standing of them!) depends a lot on notation. In most instances, we follow the notation that is used in the literature for the corresponding method. Rather than try to have unique symbols throughout the book, we think it is more important to be faithful to the convention to facilitate understanding of the theory and to make it easier for readers to make the connection between the theory and the text. Because of this, the same symbols might be used in sev- eral places. In general, we try to stay with the convention that random variables are capital letters, whereas small letters refer to realizations of random variables. For example, X is a random variable, and x is an observed value of that ran- dom variable. When we use the term log , we are referring to the natural log- arithm. A symbol that is in bold refers to an array. Arrays can be row vectors, col- umn vectors or matrices. Typically, a matrix is represented by a bold capital letter such as B , while a vector is denoted by a bold lowercase letter such as b. When we are using explicit matrix notation, then we specify the dimen- sions of the arrays. Otherwise, we do not hold to the convention that a vector always has to be in a column format. For example, we might represent a vec- tor of observed random variables as or a vector of parameters as .
( x 1 , x 2 , x 3 ) ( μ σ, )