The bootstrap. Patrick Breheny. December 6. The empirical distribution function The bootstrap

Similar documents
Bootstrap, Jackknife and other resampling methods

Bootstrap Confidence Intervals

Bootstrap tests. Patrick Breheny. October 11. Bootstrap vs. permutation tests Testing for equality of location

The Nonparametric Bootstrap

STAT440/840: Statistical Computing

Permutation tests. Patrick Breheny. September 25. Conditioning Nonparametric null hypotheses Permutation testing

STAT Section 2.1: Basic Inference. Basic Definitions

Statistics - Lecture One. Outline. Charlotte Wickham 1. Basic ideas about estimation

Bootstrapping, Randomization, 2B-PLS

4 Resampling Methods: The Bootstrap

Advanced Statistics II: Non Parametric Tests

Fin285a:Computer Simulations and Risk Assessment Section 2.3.2:Hypothesis testing, and Confidence Intervals

The exact bootstrap method shown on the example of the mean and variance estimation

Better Bootstrap Confidence Intervals

Conditioning Nonparametric null hypotheses Permutation testing. Permutation tests. Patrick Breheny. October 5. STA 621: Nonparametric Statistics

One-Sample Numerical Data

Appendix D INTRODUCTION TO BOOTSTRAP ESTIMATION D.1 INTRODUCTION

Example. Populations and samples

The Central Limit Theorem

Confidence Intervals in Ridge Regression using Jackknife and Bootstrap Methods

Opening Theme: Flexibility vs. Stability

STAT 135 Lab 5 Bootstrapping and Hypothesis Testing

Resampling and the Bootstrap

ST745: Survival Analysis: Nonparametric methods

This produces (edited) ORDINARY NONPARAMETRIC BOOTSTRAP Call: boot(data = aircondit, statistic = function(x, i) { 1/mean(x[i, ]) }, R = B)

36. Multisample U-statistics and jointly distributed U-statistics Lehmann 6.1

Bootstrap Confidence Intervals for the Correlation Coefficient

STAT 830 Non-parametric Inference Basics

Chapter 2: Resampling Maarten Jansen

Empirical Likelihood

The Bootstrap: Theory and Applications. Biing-Shen Kuo National Chengchi University

Kernel density estimation

Sampling distribution of GLM regression coefficients

Resampling and the Bootstrap

1 Glivenko-Cantelli type theorems

Section 8.1: Interval Estimation

Permutation Tests. Noa Haas Statistics M.Sc. Seminar, Spring 2017 Bootstrap and Resampling Methods

Political Science 236 Hypothesis Testing: Review and Bootstrapping

IEOR E4703: Monte-Carlo Simulation

Chapter 6. Estimation of Confidence Intervals for Nodal Maximum Power Consumption per Customer

Lecture 1: Random number generation, permutation test, and the bootstrap. August 25, 2016

1 The Glivenko-Cantelli Theorem

Semester , Example Exam 1

Random Numbers and Simulation

Least Absolute Value vs. Least Squares Estimation and Inference Procedures in Regression Models with Asymmetric Error Distributions

11. Bootstrap Methods

The assumptions are needed to give us... valid standard errors valid confidence intervals valid hypothesis tests and p-values

Diagnostics. Gad Kimmel

MA 575 Linear Models: Cedric E. Ginestet, Boston University Non-parametric Inference, Polynomial Regression Week 9, Lecture 2

12 - Nonparametric Density Estimation

A Classroom Approach to Illustrate Transformation and Bootstrap Confidence Interval Techniques Using the Poisson Distribution

Nonparametric Methods II

Bootstrap (Part 3) Christof Seiler. Stanford University, Spring 2016, Stats 205

MA 575 Linear Models: Cedric E. Ginestet, Boston University Bootstrap for Regression Week 9, Lecture 1

Simulating Uniform- and Triangular- Based Double Power Method Distributions

Robustness. James H. Steiger. Department of Psychology and Human Development Vanderbilt University. James H. Steiger (Vanderbilt University) 1 / 37

Preliminaries The bootstrap Bias reduction Hypothesis tests Regression Confidence intervals Time series Final remark. Bootstrap inference

Semiparametric Regression

Supplement to Quantile-Based Nonparametric Inference for First-Price Auctions

Preliminaries The bootstrap Bias reduction Hypothesis tests Regression Confidence intervals Time series Final remark. Bootstrap inference

Bayesian Inference and the Parametric Bootstrap. Bradley Efron Stanford University

Homework # , Spring Due 14 May Convergence of the empirical CDF, uniform samples

Regression Estimation - Least Squares and Maximum Likelihood. Dr. Frank Wood

Fall 2017 STAT 532 Homework Peter Hoff. 1. Let P be a probability measure on a collection of sets A.

Sampling Distributions of Statistics Corresponds to Chapter 5 of Tamhane and Dunlop

Business Statistics. Lecture 10: Course Review

Bootstrap. Director of Center for Astrostatistics. G. Jogesh Babu. Penn State University babu.

Bootstrap confidence levels for phylogenetic trees B. Efron, E. Halloran, and S. Holmes, 1996

Robustness and Distribution Assumptions

Point and Interval Estimation II Bios 662

Simulation. Where real stuff starts

One-parameter models

Outline. Confidence intervals More parametric tests More bootstrap and randomization tests. Cohen Empirical Methods CS650

The Analysis of Uncertainty of Climate Change by Means of SDSM Model Case Study: Kermanshah

Supporting Information for Estimating restricted mean. treatment effects with stacked survival models

Analytical Bootstrap Methods for Censored Data

Two-sample inference: Continuous data

A Simulation Comparison Study for Estimating the Process Capability Index C pm with Asymmetric Tolerances

A Bias Correction for the Minimum Error Rate in Cross-validation

Bias evaluation and reduction for sample-path optimization

4.1 Non-parametric computational estimation

Interval estimation. October 3, Basic ideas CLT and CI CI for a population mean CI for a population proportion CI for a Normal mean

GEOS 36501/EVOL January 2012 Page 1 of 23

S The Over-Reliance on the Central Limit Theorem

Hypothesis Testing with the Bootstrap. Noa Haas Statistics M.Sc. Seminar, Spring 2017 Bootstrap and Resampling Methods

Another Look at Resampling: Replenishing Small Samples with Virtual Data through S-SMART

STAT 285: Fall Semester Final Examination Solutions

Nonparametric Estimation of Distributions in a Large-p, Small-n Setting

Economics 583: Econometric Theory I A Primer on Asymptotics

Math 494: Mathematical Statistics

MCMC Methods: Gibbs and Metropolis

The automatic construction of bootstrap confidence intervals

Review. December 4 th, Review

Package Rsurrogate. October 20, 2016

401 Review. 6. Power analysis for one/two-sample hypothesis tests and for correlation analysis.

STAT 135 Lab 3 Asymptotic MLE and the Method of Moments

Reliable Inference in Conditions of Extreme Events. Adriana Cornea

SYSM 6303: Quantitative Introduction to Risk and Uncertainty in Business Lecture 4: Fitting Data to Distributions

Introduction to Simple Linear Regression

Extensions to LDA and multinomial regression

Transcription:

Patrick Breheny December 6 Patrick Breheny BST 764: Applied Statistical Modeling 1/21

The empirical distribution function Suppose X F, where F (x) = Pr(X x) is a distribution function, and we wish to estimate some aspect of F (for example, E{X} or Pr{X > 1}) The parametric approach is to assume that F has some specific form, then estimate its parameters The nonparametric alternative is the empirical distribution function, ˆF, the CDF that puts mass 1/n at each data point x i : ˆF (x) = 1 n n I(x i x) i=1 where I is the indicator function Patrick Breheny BST 764: Applied Statistical Modeling 2/21

Empirical CDF: Cancer volume From prostate study: F^(x) 0.0 0.2 0.4 0.6 0.8 1.0 0 10 20 30 40 50 Cancer volume Patrick Breheny BST 764: Applied Statistical Modeling 3/21

Properties of ˆF At any fixed value of x, E{ ˆF (x)} = F (x) Var{ ˆF (x)} = 1 F (x)(1 F (x)) n Note that these two facts imply that ˆF (x) P F (x) An even stronger proof of convergence is given by the Glivenko-Cantelli Theorem: sup ˆF (x) F (x) a.s. 0 x Patrick Breheny BST 764: Applied Statistical Modeling 4/21

Introduction The empirical distribution function The empirical CDF is interesting in its own right, but also as the fundamental component of a statistical approach called the bootstrap is an extremely important idea in modern nonparametric statistics; indeed, Casella & Berger call it perhaps the single most important development in statistical methodology in recent times Patrick Breheny BST 764: Applied Statistical Modeling 5/21

Derivation of bootstrap Suppose we are interested in assessing the variance of an estimate ˆθ = θ(x) Its actual variance is given by Var(ˆθ) = {θ(x 1,..., x n ) E(ˆθ)} 2 df (x 1 ) df (x n ) where E(ˆθ) = θ(x 1,..., x n )df (x 1 ) df (x n ) There are two problems with evaluating this expression directly Patrick Breheny BST 764: Applied Statistical Modeling 6/21

The ideal bootstrap The first is that we do not know F The natural solution is to plug in the empirical cdf, ˆF : Var(ˆθ) ˆ = {θ(x 1,..., x n ) Ê(ˆθ)} 2 d ˆF (x 1 ) d ˆF (x n ) For reasons that will become clear, we will call this the ideal bootstrap estimate Patrick Breheny BST 764: Applied Statistical Modeling 7/21

The ideal bootstrap (cont d) The second problem, however, is that this integral is difficult to evaluate Because ˆF is discrete, ˆ Var(ˆθ) = j 1 n n {θ(x j) Ê(ˆθ)} 2 where x j ranges over all n n possible combinations of the observed data points {x i } (not all of which are distinct) Unless n is small, this may take a long time to evaluate Patrick Breheny BST 764: Applied Statistical Modeling 8/21

Monte Carlo approach However, we can approximate this answer instead using Monte Carlo integration the technique we have been using all semester long in our simulations Instead of actually evaluating the integral, we approximate it numerically by drawing random samples of size n from ˆF and finding the sample average of the integrand This approach gives us the bootstrap an approximation to the ideal bootstrap By the law of large numbers, this approximation will converge to the ideal bootstrap as the number of random samples that we draw goes to infinity Patrick Breheny BST 764: Applied Statistical Modeling 9/21

Bootstrap estimate of variance The procedure for finding the bootstrap estimate of the variance (or bootstrapping the variance ) is as follows: (1) Draw x 1,..., x B from ˆF, where each bootstrap sample x b is a random sample of n data points drawn iid from ˆF (2) Calculate ˆθ b, where ˆθ b = θ(x b); these are called the bootstrap replications (3) Let v boot = 1 B B {ˆθ b θ } 2, b=1 where θ = B 1 b ˆθ b Patrick Breheny BST 764: Applied Statistical Modeling 10/21

Resampling The empirical distribution function What does a random sample drawn from ˆF look like? Because ˆF places equal mass at every observed value x i, drawing a random sample from ˆF is equivalent to drawing n values, with replacement, from {x i } In practice, this is how the x b s from step 1 on the previous page are generated This somewhat curious phenomenon in which we draw new samples by sampling our original sample is called resampling Patrick Breheny BST 764: Applied Statistical Modeling 11/21

Bootstrapping statistical models The same approach can be applied to multivariate data and statistical models, provided that the observations are still independent and identically distributed In this case, we resample elements of {x i, y i } n i=1 (i.e., rows of our data set) and apply the model to {X b, y b } It should be noted, however, that this approach treats X as random In certain cases where X is fixed, this approach does not make sense; it is still possible to use the bootstrap for these situations, but this involves bootstrapping the residuals of the model and is somewhat more complicated Patrick Breheny BST 764: Applied Statistical Modeling 12/21

Bootstrap estimation of the CDF of ˆθ is not limited to the variance we can use it to estimate any aspect of the sampling distribution of ˆθ In particular, we can calculate the 2.5th and 97.5th percentiles of ˆθ, thereby obtaining a 95% confidence interval for ˆθ that, unlike ˆθ ± 1.96 SE, can be asymmetric and thereby reflect the skewness of an estimate This confidence interval is called the bootstrap percentile interval The percentile approach is not the only way of creating bootstrap confidence intervals; actually, a considerable body of research has been devoted to this problem, although it is very simple, has nice properties, and is widely used. Patrick Breheny BST 764: Applied Statistical Modeling 13/21

in R and SAS Although it is not difficult to write your own for loop to conduct bootstrapping (easier in R than SAS), both platforms provide tools to do most of the work for you In both platforms, bootstrapping is fairly simple, although you must write your own function to analyze the data and return ˆθ Patrick Breheny BST 764: Applied Statistical Modeling 14/21

R The empirical distribution function Bootstrapping in R can be accomplished via the boot package (by default, installed but not loaded) The function you write to calculate ˆθ must be a function of two arguments: the first is the original data and the second is a vector of indices specific to the bootstrap sample Thus, in order to use the bootstrap to, say, estimate the standard error of the variance, you will need to define a function like the following: var.boot <- function(x,ind){var(x[ind])} Patrick Breheny BST 764: Applied Statistical Modeling 15/21

boot example The empirical distribution function Once you have defined such a function, its usage is straightforward: > boot(cavol,var.boot,1000)... Bootstrap Statistics : original bias std. error t1* 62.17922-0.951639 17.24447 We can obtain bootstrap confidence intervals via: > out <- boot(cavol,var.boot,1000) > boot.ci(out,type="perc")... Level Percentile 95% (32.55, 98.88 ) Patrick Breheny BST 764: Applied Statistical Modeling 16/21

How big should B be? What is a good value for B? On the one hand, computing time increases linearly with B, so we would like to get by with a small B This desire is particularly acute if θ is complicated and time-consuming to calculate On the other hand, the lower the value of B, the less accurate and more variable our estimated standard error is Patrick Breheny BST 764: Applied Statistical Modeling 17/21

How big should B be? (cont d) How much accuracy do we lose by stopping at B bootstrap samples instead of going to? This can be assessed by standard statistical methods: {ˆθ b } are iid and our SE estimate is a standard deviation Generally speaking, published articles in recent years tend to use 1000 bootstrap replications; however, for highly computer intensive statistics, 100 or even 50 may be acceptable However, each application is different bootstrap data, just like real data, often deserves a closer look: in the words of Brad Efron, it is almost never a waste of time to display a histogram of the bootstrap replications Patrick Breheny BST 764: Applied Statistical Modeling 18/21

Histogram of bootstrap replications Histogram of out$t out <- boot(cavol,var.boot,1000) hist(out$t) 95% CI for bootstrap SE: (16.8,18.4) Frequency 0 50 100 200 20 40 60 80 100 140 θ^* Patrick Breheny BST 764: Applied Statistical Modeling 19/21

SAS implementation In SAS, your function that calculates ˆθ must be a macro called %analyze which takes two arguments: data and out So, in order to use the bootstrap to study the sampling distribution of the variance, we could write: %macro analyze(data,out); proc means noprint data=&data; output out=&out(drop=_freq type_) var=var_cavol; var cavol; run; %mend; Patrick Breheny BST 764: Applied Statistical Modeling 20/21

SAS implementation (cont d) To use the %boot and %bootci macros, you also need to download the macro definitions (available on support.sas.com or the course website) and source them: %inc "jackboot.sas.txt"; You can then obtain bootstrap summaries and bootstrap confidence intervals via: %BOOT(data=prostate); %BOOTCI(percentile); Patrick Breheny BST 764: Applied Statistical Modeling 21/21