This video belongs to the openHPI course Introduction to Bayesian Data Analysis. Do you want to see more?
An error occurred while loading the video player, or it takes a long time to initialize. You can try clearing your browser cache. Please try again later and contact the helpdesk if the problem persists.
Scroll to current position
- 00:00Okay, so in this third lecture, I'm going to introduce a very important example of a continuous random variable, one involving
- 00:09the normal distribution.
- 00:11So, remember what I said earlier, what is a random variable, it's a function that maps has said X
- 00:18S.
- 00:18Which is the set of possible outcomes.
- 00:21You can get an experiment, maps it onto a real number and the real number that it gets mapped onto, that each event gets
- 00:29mapped onto is called the support of X,
- 00:31S of X.
- 00:32And in the discrete case we had a probability mass function associated with this particular uh set of outcomes.
- 00:40The support of X and each of those elements was mapped onto a probability.
- 00:45So that's this equation, one that I'm showing you here, right?
- 00:49And the cumulative distribution function is of course the the sum of all the possible values ranging from X downwards.
- 00:58So that's what I've written down here.
- 01:00So this was the whole story with discrete random variables,
- 01:03That I showed you earlier with the help of two examples, the Bernoulli and the Binomial.
- 01:08Now we are going to talk about continuous random variables, but we are going to build on what we've learned from the from
- 01:16the from the discrete random variable theory that I presented.
- 01:20So, if you remember in the Bernoulli and the Binomial, I showed you that these these classic dpqr families of functions
- 01:28in action with the Bernoulli, I only showed you rbern, dbern and sorry, this is a mistake here, it should have been
- 01:35pbern.
- 01:37And in the binomial, I showed you all the full range of possibilities.
- 01:43In this, in R we can use the r binom, dbinom, pbinom, and qbinom function which I call the D
- 01:49P Q R
- 01:50Family of functions.
- 01:51So these functions are now going to be available for every random variable that we might need in our data analysis, practically
- 02:01every random variable.
- 02:03So in the discrete case when we were talking about coin tosses, there were discrete outcomes.
- 02:09But you can have situations where the outcomes are no longer discreet, you can't get just a heads or tails.
- 02:16You get instead a continuum of possible values.
- 02:20So one example of that is reading data,
- 02:23we often do research on eye tracking.
- 02:26So we have people read sentences on the computer screen and we've got this sophisticated machine called an eye tracker which
- 02:32tracks where exactly your eyes fixating, which letter the you're fixating on when you're reading sentences on the screen
- 02:39so that's called an eye tracker.
- 02:40And you can record reading times using that kind of machine at the millisecond level.
- 02:45Now, these are continuous values,
- 02:48there might be some precision limitations on how precisely you can record the reading times.
- 02:54But in principle there's an infinity of possible values between 500 milliseconds and 501 milliseconds.
- 03:01In theory there's no limit to what you can have.
- 03:04So that's what's called a continuous random variable.
- 03:06And that's the kind of data that we can model using a continuous random variable.
- 03:12So, I'm gonna give you an example of that.
- 03:14So what's different between discrete and continuous random variables?
- 03:17One very big difference is that instead of having a probability mass function which associates with each discrete outcome
- 03:25of probability, as we saw in the binomial and bernoulli in the continuous case, we get a probability density function,
- 03:32not a probability mass function, but a probability density function.
- 03:36Okay, so this I will sometimes abbreviate as pdf,
- 03:41don't confuse it with pdf document.
- 03:44When I'm saying pdf, I'm actually referring to the probability density function in a continuous random variable.
- 03:52So, the way I will write a random variable from now on is that if I have a random variable X,
- 03:58and by the way I could use whatever variable I like.
- 04:00I could use X,
- 04:02I could use Y, I could use delta, I could use zeta,
- 04:05it doesn't matter what the variable name is.
- 04:07There is some random variable.
- 04:09I'm going to assume that random variable has associated with it, a particular probability density function in the continuous
- 04:17case and a probability mass function in the discrete case.
- 04:20So, I'm going to write all such cases with this little curly thing called a tilde.
- 04:25So, what I'm saying here is that the data are being produced from this probability mass or probability density function.
- 04:32That's what the statement means from now on.
- 04:36So, let's look at an example that you must have seen.
- 04:42You know, if you've done any data analysis in the past, I'm going to assume that data are being generated from a
- 04:48normal distribution with some mean mu and some standard deviation sigma.
- 04:54So these are called the location and scale parameters.
- 04:57And the way I would write the probability density function for the continuous random variable would
- 05:05be in this form here.
- 05:06So, this is the actual probability density function of the normal distribution.
- 05:12So what does this function do this I'm going to explain in a few minutes.
- 05:16But as input it takes a particular element in the support of X,
- 05:20So, some reading time that you might have observed and given some mu and sigma parameter values.
- 05:27Just like we had theta earlier.
- 05:28Now we have the parameters mu and sigma given some specific values of mu and sigma, you can get the result of this function
- 05:37you will get an actual numerical value that is the result of plugging in X into this function.
- 05:44So, it's just the standard functional approach.
- 05:48So this is the probability density function of the normal distribution.
- 05:52And our job now is to try to really understand what exactly this function means and what it's doing for us.
- 06:00Okay.
- 06:02You've probably heard about the normal distribution is sometimes called the Gaussian distribution right after Gauss who came
- 06:10up with it.
- 06:11And notice that in this distribution, in the canonical case, in the default case, we're going to assume that the support
- 06:18of X ranges from minus infinity all the way up to plus infinity.
- 06:23So there's no limit on the lower and upper bounds in principle,
- 06:27in this canonical case here, you can of course truncate a normal distribution,
- 06:32you can specify lower and upper bound and truncate it in this way.
- 06:36And in fact, that will be a critical thing that we'll be doing later on.
- 06:39But in the usual case, right, the support of X is from minus to plus infinity.
- 06:47As I said earlier mu and sigma of the mean and the standard deviation.
- 06:51And they're more generally called the location and scale parameters.
- 06:55You will read more about this in the textbook, but right now this is all we need to know to understand how this function is constructed.
- 07:02Okay, so I'm going to unpack this construction talk a bit more about how it works.
- 07:07Okay, so remember, in the discrete random variable case we could compute the probability of a particular outcome.
- 07:15So we could use the D band function for example, to compute the probability of getting exactly one.
- 07:23that is exactly a heads.
- 07:27In the binomial case, if I'm tossing a coin 10 times I can ask using the d binom function, I can find out what is
- 07:34the probability of getting exactly two
- 07:40as a possible outcome.
- 07:42So I can, in the discrete random variable I can actually ask questions about particular outcomes.
- 07:48The probabilities of particular outcomes
- 07:52in the continuous random variable.
- 07:54You can never do that in the continuous random variable.
- 07:58The probability of a particular point outcome outcome will always be zero.
- 08:08The way that you can compute probabilities in a continuous probability density function is by asking questions like what
- 08:15is the probability of observing a value between this number and this number?
- 08:20So you can have a different set of numbers X.
- 08:26Let's call it X two and X one.
- 08:28X two will be larger the next one.
- 08:30What I can ask from a continuous probability density function is what is the probability of observing a value between this
- 08:37range and this probability is calculated by computing the area under the curve of the normal distribution.
- 08:47So how does that work?
- 08:48So let's take a look at that.
- 08:55We are going to use the cumulative distribution function associated with the normal distribution to compute this
- 09:05area under the curve.
- 09:06And to compute the probability of observing a particular value between X two and X one or a value like X two or something
- 09:15less than that.
- 09:16That's what the cumulative distribution function is for.
- 09:19So let's do that.
- 09:20Okay, mathematically, how would we do this?
- 09:24We would ask a question like what is the probability of observing some number like u or something less than that in this
- 09:30random variable.
- 09:31And that of course has to be computed using the cumulative distribution function.
- 09:36So now what you're seeing here is the probability density function
- 09:41and what I'm computing in this integral is that I'm summing up the area under the curve going from u all the way to minus
- 09:50infinity.
- 09:51And that's why I specified an upper and lower bound in this integral.
- 09:54This integral is nothing else
- 09:57than the summation that we saw in the discrete case, if you remember we took the probability mass function and we summed
- 10:04up all the values going from X to downwards.
- 10:08That's exactly what we're doing here.
- 10:11We are computing the cumulative probability of
- 10:15u or something less than u.
- 10:18in this case.
- 10:20So nothing much has changed except that we have moved to a continuous space now.
- 10:27So what we have seen today is the first example of a continuous random variable normal distribution.
- 10:34And what I'm going to do now is I'm going to unpack some important properties of this distribution.
- 10:40This will happen in the next lecture.
To enable the transcript, please select a language in the video player settings menu.