Introduction to Statistics
Transcript
Welcome back. I'm Steve Brunton from the University of Washington and this is the second half of a new course on probability and statistics This is one of my absolute favorite topics in all of mathematics it is incredibly useful. It's up there with Calculus, Linear algebra and differential equations as one of the pillars of how we model the real world especially how we model systems that are too complex to handle with our classical deterministic methods. So this is the overview of the second half of the course on statistics. We spent a lot of time... by the time this video comes out you've probably seen that there's a whole series on probability -- I'm guessing about 10 hours of lectures on probability theory -- and now we're about to launch into the dual topic of Statistics. This is where the rubber hits the road. So probability is all about mathematical modeling, combinatorics, distributions
it's really elegant theory... so I'm actually going to write this down... this is all about modeling uncertainty in the real world, building models and statistics is all about data so this is really important for us in the modern machine learning era as data scientists. Statistics is all about taking data and saying something about the probability model. So in probability you assume you have the model, you assume you have the distribution that's known, and we don't know what the samples or the data are going to look like, but we want to say what is likely that's a probability problem. The dual of that, the flip side of that, is the statistics problem where now we have data, we assume that samples and data are known, and we want to infer something about the underlying probability model, the parameters of the system... something about the system... from data So these of course are kind of dual problems they're intimately related and so you need to know
these foundational probability concepts to do good statistics. but statistics is really where we start being able to make powerful predictions, decisions, estimations... and again the basis of modern machine learning is statistical data analysis. okay so um this is one of my passions I love this I learned this um you know over 20 years ago when I was uh at the University of North Texas from uh Dr John Quinton Nilla so I want to give mad shout out to Dr Q uh again I'm gonna base a lot of what I'm doing on you know what I learned from Dr Q's notes in uh the University of North Texas in fact I was going back through this the other day uh brushing up on some topic like random walks or marob chains and I actually found one of I think the first times I wrote down Igan Steve so I think that
this might have been I was sitting in this class uh back you know when I was 17 years old I think that might be where Ian Steve actually comes from so anyway way um you know I want to give a ton of credit to Dr John Quinton Nilla um who taught me essentially everything I know about probability and statistics um so anything interesting and correct I'm saying is probably him anything uh Incorrect and misleading is probably because this is 20 years later um but I'm going to specifically Take This Modern perspective that what we really want to do is start driving towards Big Data and really complicated or or nasty probability models that don't belong to the classes of easy classical probability models that we have been analyzing things like normal distributions exponential Plus on etc etc those are still super useful for tons of real world problems but there are
other real world problems where the probability densities don't have a nice analytic close form uh expression and you have to learn them from data using machine learning so this is all going to build towards that but we're going to start with foundational statistics okay good um so so I think I just want to tell you kind of the outline of this class again this was about 10 hours broken into two modules of intermediate and advanced statistics is going to be about the same there's going to be kind of a core 5 hours that you need to know that's kind of the intro intermediate and then there's going to be Advanced topics that are you know special topics and more um more technical so you can kind of pick and choose your own adventure of how much you want to learn okay but I really want to make this as targeted as possible so if you have 5 hours I want want you to get the best 5 hours of probability or the best five hours of Statistics that gets you as close to
being able to use this as possible and if you have another 5 hours go deeper and after this there will be a bunch of special topics things like stochastic differential equations marov chains Moni Carlo optimization for beijan methods machine learning there's an unlimited amount of cool stuff so I'm just going to keep adding for a long time hopefully okay let's get into it um so given data given data of a system some things we can do some things we can do this reminds me of a Deltron song things we can do uh and I'm just going to start going in order okay so the first thing we can do um and we're going to start here actually because this is where the statistics is the easiest just like in probability we started from the intro kind of baby steps and then we worked up very quickly to some pretty advanced concepts we're going to do the same thing here
so uh we're going to do something called survey sampling so uh we draw a small sample from a large population so if we draw so this is essentially another way of saying you know survey sampling so this is called survey sampling uh survey sampling or polling and um the IDE idea here is what can we say about the larger population from the small sample that we draw and how big is a big enough
sample to say things with statistical confidence about this larger population so some of the things we're going to do for example there is this notion of a sample mean if I have this sample I can take the average maybe I'm uh measuring you know um people's political preferences or the height of an American you know like which clearly follows a normal distribution and I might draw small sample of 100 people to try to say things about the larger population distribution so there's this notion of something called a sample mean it's a really cool idea um you literally take your small sample the the variable you're measuring and you take the average value it's just the mean of your sample sometimes we call this xbar and in the last set of lectures in probability this kind of culminated in something called the central limit theorem which showed that this sample mean from Act ual data tends to be distributed as a normal random variable where the
mean of this normal distribution is the mean mu of the population of the true population and the variance of this random variable is sigma^2 over n where n is the sample size sample size so this is the kind of thing you can do with Statistics this is kind of where we're going to start off we're going to take a small sample compute its mean and we're going to show with the central limit theorem that that's a normally distributed random variable where mu and sigma squar are the population mean and variance uh mean and variance and N is the sample size of the sample I took to compute this mean this is incredibly powerful and this allows me because I have this variance here it essentially says that this variable will converge to the true mean if I take the average of a sample it will tell me something about the average of my population and the variance tells me how close to the True Value I am how big of an end do I need for this variance to
be small how how much wiggle room do I have in this estimate of the true mean for a given n so this tells me a lot of useful things it tells me how I might design an experiment if I want a certain amount of accuracy or uncertainty in my estimate really really important and this is a simple place to start is survey sampling okay good um and this is true for any distribution of my data it doesn't have to be from you know normally distributed Heights I can I can take samples of um a large population that has some weird distribution and that sample mean will still be a normally distributed random variable by the central limit theorem That's The Power of probability are things like the central limit theorem which are extremely General powerful statements about arbitrary data and distributions so that's our starting point um two is going to get even more interesting okay okay so this is just kind of laying the foundation with
some easy math that ties back to probability ties data to probability now we're going to start doing hypothesis testing so testing um hypothesis hyp and this is literally called hypothesis testing um you know and the hypotheses there are so many of these you can write down I'm just going to give a few to give you a flavor of the kinds of things we're going to be able to do really really powerful things um does a drug work okay so let's say that there's some new super drug that is supposed to cure cancer or you know cause incredible weight loss uh does a drug work or not this is something we can test with Statistics we can um essentially have a control group and a treatment group and test if their means are different that would indicate that the drug did something that's a hypothesis we can test using these distributions using literally a normal distribution um did a mark marketing campaign work or not um so did a marketing
campaign uh did a marketing campaign increase web traffic this is just an example um this is what we call AB testing so this is um a testing um in like computer science where you have you know you do a modification you change something about your website and you see if people click on you know ads more that would be a AB testing a drug working or not this is a control uh versus treatment group okay this is kind of you'd have a control group
and a treatment group other things you can do um one of my absolute favorites actually um have been thinking about this a lot lately is are two distributions the same are two distributions the same uh and this is what is called the kai squar test um is going to tell us that the kai Square test and the kai square is a distribution from probability that allows us to test a hypothesis using data so that becomes statistics um really really important ideas
here about testing hypotheses with data based on probability models of how that data should behave you can test lots of cool hypotheses and this again generalizes to machine learning when those distributions are empirical distributions you can really think of machine learning as having empirical distributions from data okay so you get empirical probability models from a wealth of measurement data so testing hypothesis is going to be a big big deal here um and this
also allows you to quantify how significant your results are you don't just test these hypotheses you get like a confidence of How likely the drug is to work or not like am I 95% confident in this result am I 99% confident you get a notion of statistical significance uh so you can quantify how significant uh a result is a result is okay um and this leads very naturally into something called experimental design um super important if you are going to run a drug trial let's say that
you think you you have a new super drug or let's say that you have a new super composite it's going to make aircraft lighter and stronger you've got a new material or a new drug something new that's going to be amazing and you need to convince the world that it's safe and it works you need to design a statistical experiment a data collection protocol and a hypothesis to test so that you can convince people with some amount of significance of your result and that is all about designing a statistical experiment to be honest to be accurate and to be significant so that you can convince other people of the effect of some you know new drug or new material or new whatever it is okay so experimental design is super important and The Duel of experimental design the significance level
that we quantify in a hypothesis test is usually called the P value you've probably heard of the P value before a p of 0.05 is a statistically significant result meaning there's like a 95% chance that you know I get the correct answer um if I if I say something happened and so what that means is that a lot of people do bad statistics called packing where they do bad experimental design they they do either through fraudulence or ignorance they do a bad experimental design to get a P value that's significant even though their experiment was wrong okay so there's lots of ways of getting significant statistical results by doing bad statistics I'm going to tell you about those pitfalls we're going to code this up all of this you know we're going to have examples in Jupiter in Python we're going to actually you know code up because this is data and testing we're going to build code to do all of this and I'm going to show you in code what
packing looks like and what to look out for so that you can not fall into those traps of fraudulence and ignorance okay super important stuff um and now the other kind of big part of this that I want to talk about I think this is really really cool maybe I'll go over here so I have a little more space is this notion of fitting distributions and estimating parameters so um kind of the third big big topic we're going to talk about is fitting distributions and I'm putting it here under machine learning because this is really the intro to machine learning fitting distributions uh and estimating parameters and estimating uh parameters good um and so probability essentially involves so probability involves the this probability model this probability density probability of X my random variable given some parameters Theta so I'll just label these really quickly so this is my uh data given my parameters
these are the parameters of my probability distribution so in the gausian example this would be the mean and the standard deviation things like that statistics is the flip of this so statistics is all about finding the probability of my parameters given my data so it flips this on its head it's this notion that given data I want to find the best fit parameters the best distribution that fits that data that's the statistics problem here and this really is uh very much a basian uh perspective this is literally the beian inverse of this so we're going to use beian ideas a lot in statistics because we're trying to kind of flip the Paradigm where instead of estimating what the data should look like given a distribution with fixed parameters we have data and we're trying to estimate the parameters from that data okay so that's what we mean um and we're going to look at
a bunch of examples here of how to do this things like um the method of moments you've probably seen this before you might have method of moments very closely related to this sampling statistics here you literally estimate things about your population from things like the first moment the sample moment things like that um we're going to talk about maximum likelihood estimation Max likelihood uh estimation ml this is a big big big topic ml are a super powerful way of turning this
problem into an optimization problem which means we get all of the Power of modern optimization machine learning and data to solve this problem so maximum likelihood estimates is a big deal um and that's this also transitions very ni into the beian perspective we're also going to talk about things like goodness of fit and hypothesis testing how good is a fit so once I've fit these parameters how good uh is the fit goodness of fit and hypothesis testing um confidence intervals so once we get the estimate of these parameters we can also give confidence intervals of of of kind of like what's the range of theta we think so not just a fixed Theta but maybe I have a distribution of what I expect Theta to be that's kind of also the beian perspective um I might have confidence intervals here uh confidence intervals on Theta hat my estimate confidence intervals and hypothesis testing are really dual problems
related to this P value uh and then we're also going to talk about something super important I'm just going to actually put this in pink because it's so important um is this idea of bootstrapping uh and simulation bootstrapping and Moni Carlo simulation uh simulation is the key word here so often times there's things I want to know about my statistical distribution like I might want to know you know the variance of this parameter estimate Theta um and I can't compute it using pencil and paper analytics so I'll actually set up a big simulation a Monte Carlo simulation to get a bootstrap estimate of the distribution of my uncertain parameter and again this is the basis of a lot of modern beijan statistics and beian machine learning is doing Moni Carlo simulations and bootstrapping so this is kind of going to be an advanced topic that Segways us into how to do computational statistics with big data and nasty distributions pretty cool
stuff okay um then I guess we're going to keep going I'm almost done topic four uh is going to be you know all about beijan statistics um beian statistics and I'm going to have beijan statistics kind of woven out throughout these lectures so we're going to get you know an intro to B in this uh statistics module but realistically we're going to have a lot deeper dives into Baye later in my optimization boot camp in physics informed machine learning beian Frameworks allow you to
take prior knowledge maybe I know something about the distribution or I know something about Theta or I know something about the physical world it allows me to build in that prior knowledge to these these statistical estimates that's a huge Topic in optimization machine learning physics and for machine learning so this is also going to be something we cover a lot more later um a good way to think about this is probability tells me a model of how I think a Fair coin or a biased coin will behave as a bernui random variable we have a model for this and if I flip this coin 10 times then the number of heads is going to be a binomially binomially distributed random variable and if I flip it a 100 times that binomial starts to look like a normal distribution by the central limit theorem things like that the statistic view is a little bit different let's say I have this
coin and I flip it 10 times let's say it comes up 10 heads in a row the Statistics question is do I think this this coin is fair what do I think the probability is of getting heads versus Tails can I estimate those quantities and those uncertainties Bean statistics is a really important way if I flip a coin and it is heads three times in a row some of these statistics methods kind of will fail and incorrectly assume that the parameter Theta of How likely it is to flip ah heads is equal to one it's always going to flip heads and that's bad Bean statistics allows me to bake in prior knowledge if I just see a coin if I feel a coin my prior pretty strong prior is that it's a fair coin so even if I flip three heads in a row that's not going to shake my foundational belief in this coin
being fair it's going to take a lot more evidence for me to update my prior and say oh maybe if I get 15 heads in a row [ __ ] this is probably not a Fair coin okay so Bean statistics allows me to build in a lot of prior knowledge to robustify and improve statistics when I have that prior knowledge now this relies on you having good prior knowledge bad priors cause bad statistics and then you know dot dot dot there's going to be a lot more this is going to be more and more and more so we're going to talk about tons of interesting Advanced topics that I find interesting things like benford's law I love benford's law it's incredible uh marov chains uh are ways of kind of merging differential equations and probabilities we'll talk about random walks um we'll talk about you know gausian processes for again stochastic differential equations and and much much more and
Eventually, what we're really getting towards is modern statistics and data analysis which we call machine learning: fitting empirical distributions from data. I'm super excited to walk you through this... this should be about 10 hours of intermediate and advanced topics. This is going to give you a set of tools like calculus, like linear algebra, like differential equation to really model the real world and its complexity and its uncertainty from data I'm excited to share this with you I hope you're excited. Stay tuned for more, thanks!

Ask anything
We've read this whole study set, so questions about it get the best answers.