Random variables, distributions and limit theorems

Similar documents
Class 26: review for final exam 18.05, Spring 2014

Central Limit Theorem and the Law of Large Numbers Class 6, Jeremy Orloff and Jonathan Bloom

Plotting data is one method for selecting a probability distribution. The following

Probability Distributions Columns (a) through (d)

Chapter 3 Single Random Variables and Probability Distributions (Part 1)

Introduction to Probability Theory for Graduate Economics Fall 2008

14.30 Introduction to Statistical Methods in Economics Spring 2009

System Simulation Part II: Mathematical and Statistical Models Chapter 5: Statistical Models

Random variable X is a mapping that maps each outcome s in the sample space to a unique real number x, x. X s. Real Line

CS 5014: Research Methods in Computer Science. Bernoulli Distribution. Binomial Distribution. Poisson Distribution. Clifford A. Shaffer.

Chapter 5. Statistical Models in Simulations 5.1. Prof. Dr. Mesut Güneş Ch. 5 Statistical Models in Simulations

Chapter 2: The Random Variable

Statistical Inference: Estimation and Confidence Intervals Hypothesis Testing

n px p x (1 p) n x. p x n(n 1)... (n x + 1) x!

Random variables. DS GA 1002 Probability and Statistics for Data Science.

EE/CpE 345. Modeling and Simulation. Fall Class 5 September 30, 2002

Lecture Notes 2 Random Variables. Discrete Random Variables: Probability mass function (pmf)

Probability Distribution

18.05 Practice Final Exam

Probability Distributions.

Statistical distributions: Synopsis

Lecture Notes 2 Random Variables. Random Variable

Computer Science, Informatik 4 Communication and Distributed Systems. Simulation. Discrete-Event System Simulation. Dr.

STATS 200: Introduction to Statistical Inference. Lecture 29: Course review

Math 180A. Lecture 16 Friday May 7 th. Expectation. Recall the three main probability density functions so far (1) Uniform (2) Exponential.

Lecture 8 Sampling Theory

Stochastic Processes. Review of Elementary Probability Lecture I. Hamid R. Rabiee Ali Jalali

18.05 Final Exam. Good luck! Name. No calculators. Number of problems 16 concept questions, 16 problems, 21 pages

ECON 5350 Class Notes Review of Probability and Distribution Theory

Part 3: Parametric Models

STAT2201. Analysis of Engineering & Scientific Data. Unit 3

Lecture 21: October 19

Estimation of Quantiles

Institute of Actuaries of India

Math 494: Mathematical Statistics

Confidence Intervals. Confidence interval for sample mean. Confidence interval for sample mean. Confidence interval for sample mean

Practice Problems Section Problems

Statistical Methods in Particle Physics

Part IA Probability. Definitions. Based on lectures by R. Weber Notes taken by Dexter Chua. Lent 2015

Chapter 2. Random Variable. Define single random variables in terms of their PDF and CDF, and calculate moments such as the mean and variance.

Brief Review of Probability

Review for the previous lecture

Foundations of Probability and Statistics

Definition of Statistics Statistics Branches of Statistics Descriptive statistics Inferential statistics

Math489/889 Stochastic Processes and Advanced Mathematical Finance Solutions for Homework 7

Overview. Confidence Intervals Sampling and Opinion Polls Error Correcting Codes Number of Pet Unicorns in Ireland

Probability and Estimation. Alan Moses

Introduction and Overview STAT 421, SP Course Instructor

Probability and Distributions

AP Statistics Cumulative AP Exam Study Guide

Non-parametric Inference and Resampling

Foundations of Statistical Inference

Statistical Intervals (One sample) (Chs )

CS 361: Probability & Statistics

2. A Basic Statistical Toolbox

Advanced Herd Management Probabilities and distributions

Chapter 2. Discrete Distributions

Distribution Fitting (Censored Data)

One-Sample Numerical Data

CSE 103 Homework 8: Solutions November 30, var(x) = np(1 p) = P r( X ) 0.95 P r( X ) 0.

1 Introduction. P (n = 1 red ball drawn) =

Post-exam 2 practice questions 18.05, Spring 2014

Test Code: STA/STB (Short Answer Type) 2013 Junior Research Fellowship for Research Course in Statistics

Lecture 2: CDF and EDF

Chapter 5. Bayesian Statistics

Chapter 3 Common Families of Distributions

(Re)introduction to Statistics Dan Lizotte

System Identification

CS 361: Probability & Statistics

Statistics 100A Homework 5 Solutions

Course: ESO-209 Home Work: 1 Instructor: Debasis Kundu

Statistics notes. A clear statistical framework formulates the logic of what we are doing and why. It allows us to make precise statements.

Example continued. Math 425 Intro to Probability Lecture 37. Example continued. Example

15 Discrete Distributions

Hypothesis Testing. 1 Definitions of test statistics. CB: chapter 8; section 10.3

2 Random Variable Generation

This does not cover everything on the final. Look at the posted practice problems for other topics.

Discrete distribution. Fitting probability models to frequency data. Hypotheses for! 2 test. ! 2 Goodness-of-fit test

Chapter 6: Large Random Samples Sections

Confidence Intervals, Testing and ANOVA Summary

Practical Statistics

= 1 2 x (x 1) + 1 {x} (1 {x}). [t] dt = 1 x (x 1) + O (1), [t] dt = 1 2 x2 + O (x), (where the error is not now zero when x is an integer.

Introduction to Statistical Data Analysis Lecture 7: The Chi-Square Distribution

Contents 1. Contents

Unit 3. Discrete Distributions

Stat 5101 Notes: Brand Name Distributions

Distributions of Functions of Random Variables. 5.1 Functions of One Random Variable

Continuous Random Variables. and Probability Distributions. Continuous Random Variables and Probability Distributions ( ) ( ) Chapter 4 4.

Lecture 4: Random Variables and Distributions

4.2 Continuous Models

Lecture 1: August 28

Exam 2 Practice Questions, 18.05, Spring 2014

Quiz 1. Name: Instructions: Closed book, notes, and no electronic devices.

Introduction to Statistical Inference

Week 1 Quantitative Analysis of Financial Markets Distributions A

Page Max. Possible Points Total 100

Computer Science, Informatik 4 Communication and Distributed Systems. Simulation. Discrete-Event System Simulation. Dr.

ECON 4130 Supplementary Exercises 1-4

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

Department of Mathematics

Transcription:

Questions to ask Random variables, distributions and limit theorems What is a random variable? What is a distribution? Where do commonly-used distributions come from? What distribution does my data come from? Gil McVean, Department of Statistics Wednesday th February 009 Do I have to specify a distribution to analyse my data? What is a random variable? A random variableis a number associated with the outcome of a stochastic process Waiting time for net bus Average number hours sunshine in May Age of current prime-minister In statistics, we want to take observations of random variables and use this to make statements about the underlying stochastic process Did this vaccine have any effect? Which genes contribute to disease susceptibility? Will it rain tomorrow? Parametric modelsprovide much power in the analysis of variation (parameter estimation, hypothesis testing, model choice, prediction) Statistical models of the random variables Models of the underlying stochastic process 3 What is a distribution? A distribution characterises the probability (mass) associated with each possible outcome of a stochastic process Distributions of discrete data characterised by probability mass functions P ( X = ) P( X = ) = Distributions of continuous data are characterised by probability density functions (pdf) f () 0 3 For RVs that map to the integers or the real numbers, the cumulative density function (cdf) is a useful alternative representation f ( ) d = 4

Some notation conventions Epectations and variances Instances of random variables (RVs) are usually written in uppercase Values associated with RVs are usually written in lowercase pdfsare often written as f() cdfsare often written as F() Parameters are often defined as θ Suppose we took a large sample from a particular distribution, we might want to summarise something about what observations look like on average and how much variability there is The epectationof a distribution is the average value of a random variable over a large number of samples E ( X ) = P( X = ) or f ( ) d Hence P( X i = n, θ ) Probability that the ith random variable takes value f ( θ ) given sample size n and parameter(s) θ The varianceof a distribution is the average squared difference between randomly sampled observations and the epected value ( E( ) ) P( X = ) or ( E( ) ) Var ( X ) = f ( ) d The probability density associated with outcome given some parameter(s) θ 5 6 iid Where do commonly-used distributions come from? In most cases, we assume that the random variables we observe are independent and identically distributed The iidassumption allows us to make all sorts of statements both aboutwhat we epect to see and how much variation to epect Suppose X, Yand Zare iidrandom variables and a and bare constants E ( X + Y + Z) = E( X ) + E( Y ) + E( Z) = 3E( X ) Var( X + Y + Z) = Var( X ) + Var( Y ) + Var( Z) = 3Var( X ) E ( ax + b) = ae( X ) + b At the core of much statistical theory and methodology lie a series of key distributions (e.g. Normal, Poisson, Eponential, etc.) These distributions are closely related to each other and can be derived as the limit of simple stochastic processes when the random variable can be counted or measured In many settings, more comple distributions are constructed from these simple distributions Ratios: E.g. Beta, Cauchy Compound: E.g. Geometric, Beta Miture models Var( ax + b) = a Var( X ) n X i = n Var( X ) 7 8 i Var

An aside on Chebyshev s inequality The simplest model Let X be a random variable with mean µand variance σ Chebyshev sinequality states that for any t> 0 σ P( X µ > t) t This allows us to make statements about any distribution with finite variance The probability that a value lies more than standard deviations from the mean is less than or equal to 0.5 Note that this is an upper bound. In reality, the distribution might be considerably tighter E.g. for the normal distribution the probability is 0.046, for the eponential distribution the probability is 0.05 Bernoulli trials Outcomes that can take only two values: (0 and ) with probabilities θand - θ respectively. E.g. coin flipping, indicator functions The likelihood function calculates the probability of the data P( θ ) θ What is the probability of observing the sequence (if θ= 0.5) 000000000? 000000000? Are they both equally probable? k n k = P( X = i θ ) = θ ( ) i 9 0 The binomial distribution The geometric distribution Often, we don t care about the eact order in which successes occurred. We might therefore want to ask about the probability of ksuccesses in ntrials. This is given by the binomial distribution For eample, the probability of eactly 3 heads in 4 coins tosses = P(HHHT)+P(HHTH)+P(HTHH)+P(THHH) Each order has the same Bernoulli probability = (/) 4 There are 4 choose 3 = 4 orders Generally, if the probability of success is θ, the probability of ksuccesses in ntrials n P( k n, θ k k n k n = 0 θ ) = θ ( ) θ = 0. Bernoulli trials have a memory-less property The probability of success (X = ) net time is independent of the number of successes in the preceding trials The number of trials between subsequent successes takes a geometric distribution The probability that the first success occurs at the k th trial P( k θ ) = θ ( θ ) You can epect to wait an average of /θtrials for a success, but the variance is θ Var( k) = θ k θ = 0.5 θ = 0.05 The epected number of successes is npand the variance is nθ(-θ) 0 0 00

The Poisson distribution Other distributions for discrete data The Poisson distribution is often used to model rare events It can be derived in two ways The limit of the Binomial distribution as θ 0and n (nθ = µ) The number of events observed in a given time for a Poisson process (more later) It is parameterised by the epected number of events = µ The probability of kevents is e P( k; µ ) = µ k µ k! red = Poisson(5) blue = bin(00,0.05) Negative binomial distribution The distribution of the number of Bernoulli trials until the kth success If the probability of success is θ, the probability of taking mtrials until the kthsuccess is m P( m k, θ ) θ θ k k m k = ( ) (like a binomial, but conditioning on the last event being a success) Hypergeometric distribution Arises when sampling without replacement Also arises from Hoppe Urn-model situations (population genetics) The epected number of events is µ, and the variance is also µ For large µ, the Poisson is well approimated by the normal distribution 3 4 Going continuous The Poisson process In many situations while the outcome space of random variables may really be discrete (or at least measurably discrete), it is convenient to allow the random variables to be continuously distributed For eample, the distribution of height in mm is actually discrete, but is well approimated by a continuous distribution (e.g. normal) Commonly-used continuous distributions arise as the limit of discrete processes Consider a process when in every unit of time some event might occur E.g. every generation there is some chance of a gene mutating (with probability of appro in 00,000 ) The probability of eactly one change in a sufficiently small interval h /nis P= vh v/n, where Pis the probability of one change and nis the number of trials. The probability of two or more changes in a sufficiently small interval his essentially 0 In the limit of the number of trials becoming large the total number of events (e.g. mutations) follows the Poisson distribution h h 5 Time 6

The eponential distribution The gamma distribution In the Poisson process, the time between successive events follows an eponentialdistribution This is the continuous analogue of the geometric distribution It is memory-less. i.e. f( + t X > t) = f() f() f λ ( λ) = λe E( ) = / λ Var( ) = / λ The gamma distribution arises naturally as the distribution of a series of iid random eponential variables α β α X ~ Ep( λ) S = X + X + K+ X S ~ Gamma( n, λ) 4.5 4 f ( α, β ) = 3.5 Γ( α) 3.5 α = β = 0.5 α = β =.5 α = β = 0 0.5 0 0 0.5.5.5 3 The gamma distribution has epectation α/βand variance α/β n e β More generally, αneed not be an integer (for eample, the Chi-square distribution with one degree of freedom is a Gamma(½, ½) distribution) 7 8 The beta distribution The normal distribution The beta distribution models random variables that take the value [0,] It arises naturally as the proportional ratio of two gamma distributed random variables Γ( α + β ) α f ( α, β ) = ( ) 0 Γ( α) Γ( β ) X ~ Gamma( α, θ ) 9 Y ~ Gamma( α, θ ) X ~ Beta( α, α ) X + Y The epectation is α/(α+ β) In Bayesian statistics, the beta distribution is the natural prior for binomial proportions (beta-binomial) The Dirichlet distribution generalises the beta to more than proportions 8 7 6 5 4 3 0 α = β = 0.5 α = β = α = β = 0 0 0. 0.4 0.6 0.8 β 9 As you will see in the net lecture, the normaldistribution is related to most distributions through the central limit theorem The normal distribution naturally describes variation of characters influenced by a large number of processes (height, weight) or the distribution of large numbers of events (e.g. limit of binomial with large npor Poisson with large µ) 0.045 0.04 0.035 0.03 0.05 0.0 0.05 0.0 0.005 blue red = Poiss(00) = N(00,0) 0 50 00 50 f ( ; µ, σ ) ( µ ) ep πσ σ = 0

The eponential family of distributions What distribution does my data come from? Many of the distributions covered (e.g. normal, binomial, Poisson, gamma) belong to the eponential family of probability distributions a k-parameter member of the family has a density or frequency function of the form k f ( ; θ ) = ep ci ( θ ) Ti ( ) + d( θ ) + S( ) i= E.g. the Bernoulli distribution (= 0 or ) is When faced with a series of measurements the first step in statistical analysis is to gain an understanding of the distribution of the data We would like to Assess what distribution might be appropriate to model to data Estimate parameters of the distribution Check to see whether the distribution really does fit We might refer to the distribution + parameters as being a modelfor the data P( X = ) = θ ( θ ) θ = ep ln + ln( θ ) θ Such distributions have the useful property that simple functions of the data, T(), contain all the information about model parameter E.g. in Bernoulli case T() = Which model? Method of moments Step : Plot the distribution of the random variables (e.g. a histogram) Step : Choose a candidate distribution Step 3: Estimate the parameters of the candidate distribution (e.g. by method of moments) We wish to compare observed data to a possible model We should choose the model parameters such that they match the data A simple approach is to match the sample moments to those of themodel Start with the lowest moments Step 4: Compare the empirical distribution to that observed (e.g. using a QQplot) Step 5: Test model fit Step 6: Refine, transform, repeat Model Parameters Matching Poisson µ sample mean = µ Binomial p sample successes = np Eponential λ waiting time = λ Gamma α, β sample mean = α/β, sample variance = α/β 3 4

Eample: world cup goals 930-006 Fitting a model Total number of goals scored by country over period The data are discrete perhaps a Poisson distribution is appropriate To fit a Poisson, we just estimate the parameter from the mean (8.0) Compare the distributions with histograms and QQplots QQplot Brazil Congo 5 6 A better model What do I do if I can t find a model that fits? The number of goals scored is over-dispersed relative to the Poisson We could try an eponential? This too is under-dispersed. Sometimes data needs to be transformed before it fits an appropriate distribution E.g. log transformations, power transformations We can generalise the eponential to the gamma distribution. Weestimate (by moments) the shape parameter to be 0.47 (approimately the Chi-squared distribution!) QQplot Female height in inches Concentration of HMF in honey Limpert et al (00). BioScience 5: 34 7 Also the removal of (a few!) outliers is a common (and justifiable) approach 8

Testing model fit Do I have to specify a distribution to analyse my data? A QQplotprovides a visual inspection of model fit. However, we might also wish to ask whether we can reject the hypothesis that the model is anaccurate description of the data Testing model fit is a special case of hypothesis testing Briefly, specify some statistic of the data that is sensitive tomodel fit and hasn t been used directly to estimate parameters (e.g. location of quantiles) and compare observed data to repeated simulations from distribution It is worth noting that a model may be wrong (all models are wrong) but still useful. For some situations in statistical inference it is possible to make inferences without specifying the distribution that data has been drawn from Such approaches are called nonparametric Some eamples of nonparametric approaches include Sign tests Rank-based tests Bootstrap techniques Bayesian nonparametrics They are typically more robust than parametric approaches, but have lower power It is important to stress that these methods are not parameter-free rather they are not tied to specific distributions 9 30 Questions What happens to our inferences as we collect more and more data? Limit theorems and their applications How can we make statements about our certainty (or uncertainty) in parameter estimates? What do the etreme values look like? Gil McVean, Department of Statistics Monday 3 rd November 008 3 3

Things can only get better -the law of large numbers Using the law of large numbers Suppose we have a series of iidsamples from a distribution that has a mean µ S = X + X + X +... + n 3 X n The weak law of large numbers states that as n and for any ε S Pr n µ > ε 0 n The result follows from application of Chebyshev sinequality to the variance of the sample mean Var S n σ µ = n n Monte Carlo integration is widely used in modern statistics where analytical epressions for quantities of interest cannot be obtained Suppose we wish to evaluate / I( f ) = e d 0 π We can estimate the integral by drawing Npseudorandom U[0,] numbers I( f ) π N N i= X i / More generally, the law of large numbers tells us that any distribution moment (or function of the distribution) can be estimated from the sample e 33 34 Convergence in distribution The Bootstrap method of resampling Suppose that F, F,...is a sequence of cumulative distribution functions corresponding to random variables X, X,...,and that Fis a distribution function corresponding to a random variable X X n converges in distribution to Xif (for every point at which Fis continuous) lim F n n ( ) = F( ) A simple eample is that the empirical CDF obtained from the sample converges in distribution to the distribution CDF This provides the justification for the nonparametric bootstrap (Efron) Suppose we have nobservations from a distribution we do not wish to attempt to parameterise. We wish to know the mean of the distribution We would like to know something about how good our estimate of some function, e.g. the mean, is from this sample We can estimate the sampling distribution of the function simply by repeatedly resampling n observations from our data set with replacement (This will tend to have slow convergence for heavy-tailed distributions) 35 36

Warning! The central limit theorem Note, the convergence of sample moments to distribution moments may be slow Suppose we have a series of iidsamples from a distribution that has a mean µand standard deviation σ S = X + X + X +... + n 3 X n The central limit theoremstates that as n, the scaled sample mean converges in distribution to the standard normal distribution http://www.ds.unifi.it/vl/vl_en/poisson/inde.html Sample mean Variance of the mean Distribution mean Sn / n µ Sn nµ = ~ N(0,) σ / n σ n Standard normal distribution This result holds for any distribution (with finite mean and variance) 37 38 A warning! Not all distributions have finite mean and variance For eample, neither the Cauchy distribution (the ratio of two standard normal random variables) nor the distribution of the ratio of two iideponentially distributed random variables have any moments! Cauchy f ( ) + = f ( ) = π ( ) + -0-5 0 5 0 0 3 4 For such distributions, the CLT does not hold 39 40

Consequences of the CLT Properties of the normal distribution When asking questions about the mean(s) of distributions from which we havea sample, we can use theory based on the normal distribution Is the mean different from zero? Are the means different from each other? Traits that are made up of the sum of many parts are likely to follow a normal distribution True even for miture distributions Distributions related to the normal distribution are widely relevant to statistical analyses χ distribution [Distribution of the sum of squared normal RVs] t-distribution [Sampling distribution of mean with unknown variance] F-distribution [Ratio of two chi-squared RVs] The sum of two normal random variables also follows a normal distribution X ~ N( µ, σ ) Y ~ N( λ, θ ) X + Y ~ N( µ + λ, σ + θ ) Linear transformations of normal random variables also result innormal random variables X ~ N( µ, σ ) Y = ax + b Y ~ N( aµ + b, a σ ) 4 4 Other functions of normal random variables Uses of the chi-squared distribution The distribution of the square of a standard normal random variable is the chisquared distribution Under the assumption that a model is a correct description of the data, the difference between observed and epected means is asymptoticallynormally distributed ~ Z N υ= X = Z X ~ (0, σ ) χ ν = The chi-squared distribution (χ ) with dfis a gamma distribution with α = ½ and β= ½ The sum of nindependent chi-squared ( df) random variables is the chi-squared distribution with n degrees of freedom A gamma distribution with α = n/and β = / υ= υ=5 43 The square of the difference between model epectation and observed value should take a chi-squared distribution Pearson s chi-squared statistic is a widely used measure of goodness-of-fit X ( O = i Ei E ) i i For eample, in a n mcontingency table analysis, the distribution of the test statistic under the null is asymptotically (as the sample size gets large) chi-squared distributed with (n-)(m-) degrees of freedom 44

Etreme value theory Eample: Gumbel distribution In many situations you may be particularly interested in the tails of a distribution P-values for rare events Distribution of ma of 000 samples from Ep() Remarkably, the distribution of certain rare events is largely independent of the distribution from which the data are drawn Specifically, the maimum of a series of iidobservations takes one of three limiting forms Gumbel distribution (Type I): e.g. Eponential, Normal Y Frechetdistribution (Type II): Heavy-tailed, e.g. Pareto X = e, Y ~ Ep( λ) Weibull distribution (Type III): Bounded distributions, e.g. Beta f ( ) = e + ln n e e + ln n These limiting forms can be epressed as special cases of a generalised etreme value distribution 45 46 More generally.. U = X f ( U ) = e b a ma n U e n e U Re-centeredby epected maimum Re-scaled by... F ( ) ( ) bn F n ne e.g. 000 samples from Normal(0,) 47