 When we have to deal with certain models right it is not that all the time data is available to us somebody is already provided data sometimes we have to simulate data itself and you need to simulate the systems when you have to simulate the systems we need to you are going to make some models the models will assume certain distributions and that distributions will be characterized by certain CDFs and according to using those CDFs you need to generate data right. Now the question is how to generate data this is we briefly discussed last time suppose let us say some CDF is given to you our model has assumed some distribution which comes with a certain CDF and we want to simulate that. Now for that we are going to do that assuming uniform distribution ok let us say I have access to uniform distribution now for time being assume that your F is continuous we know that if your function your CDF function it is already monotone by definition or like it is by property and now it is continuous and if it is continuous and monotone its inward function is well defined it is also going to be one to one and that is what it looks like here the on the x axis x can take minus infinity to plus infinity here y axis is 0 1 but on the inverse map the axis this is between 0 1 and the y axis is between it can be minus infinity to plus infinity. Now what I will do is we discussed functions of random variables last time now what I will be looking is a function of this uniform random variable I will apply some g function on my uniform random variable and I am going to get a new random variable but I will not going to be using any arbitrary g function here I will be using particular g functions which is given by f inverse function you know that f is given to me and I will be able to find out its f inverse and I am going to use g function as that f inverse now the claim is if I define apply this transformation on my uniform function the new random variable I am going to get it has a cdf of f why is that let us say I want to find cdf of my random variable x that is probability that let it let x less than or equals to x but replace x by f inverse u that is by definition right that is what we have defined f equals to f inverse u g is f inverse u and now because f inverse is is a one to one map I can write it in this fashion probability that u is less than or equals to u and now you can go and compute we know that u is uniform right. So, it will have this nature this is between 0 1 and this is 1 this is my uniform function now if you compute what is the probability and f of x. So, maybe I made a little wrong here. So, this is like my uniform function between 0 1 and now if you are going to ask this uniform random variable is going to take value less than or equals to f of x somewhere f of x is here this is exactly equals to f of x because area under this curve is going to be 1 if you are going to look into area under this portion because the height is 1 f of x it is going to be exactly equals to f of x and now you see that the CDF of this has exactly f of x ok. Now how to this is nice property now the question is how to generate data as per my CDF f right suppose u is your uniform right and somehow assume that somebody generates data according to this uniform distribution. Let us call this data as u 1, u 2, u 3 up to let us say you have been generated 100 samples these are actual data, data generated as per uniform distribution. Now I know this f what I will do is on this data points I will apply f inverse u 1, f inverse u 2 and f inverse u 100. Let us call this point this is my x value now that is what we have said right now this is what we are calling it as x. Let us call this as x 1, let us call this as x 2 and let us call this as x 100. Now we have 100 data points. Now these data points are coming as per their following my CDF of f is that clear? Now you see that even though uniform distributions samples are coming from uniform distribution but whichever CDF f is given to you I have used that and now I have transferred this samples to new samples those new samples are now as per my required CDF. Now tomorrow like later you will see that if you are going to call a function in python let us say generate normal samples normal Gaussian distribution with certain mean and variance generate 100 samples how it is going to do that it is going to do like this it is going to generate certain uniform samples and once you say Gaussian it is not exactly what is the CDF of that Gaussian and it will find the inverse of that and then apply that inverse function on those uniform samples and whatever the values it gets it gives you as output take this as your Gaussian samples. So, last time we come to this stage where we are saying that now what if f is not continuous and we know that f need if f is not continuous always the case when it is a discrete random variable discrete random variable will have CDF like this and then there is a jump everywhere and jump everywhere there is a discrete point is there now how to handle that case. Now I have particularly put one example here look into this here there is a jump at this point if you look into its inverse it looks look into this but this function is not unique is this function is not well defined why is that for example let us say but I take one particular point here at this point you what is the value I should be assigning should I be assigning this value this value this value or which value there is an ambiguity here right I need to properly define this what is that f inverse function this things did not arise when it was a continuous function but the moment it is a discrete that question arises. So, we need to appropriately define so that is what we said last time we are going to define in such a way that f of f inverse u is we are going to take max of f of x less than equals to u. Now if you define like that now you can you have basically to this point u here you have uniquely given this particular value as the value to be assigned at this is what f inverse u if this is just a minute if this is u then f inverse u exactly this point not any of this intermediate points. So, because of that your f inverse becomes well defined and now you can check this we said this is x then you can check that if f inverse at u is less than or equals to this is only going to happen if u is less than or equals to f of x. So, with this because of this if and if only condition I can write it as if u is less than or equals to f of x and this already gives me f of x. So, and this is what probability that my x is less than or equals to x. So, now you see that even for the discontinuities this things works. Any question on this simulation of data as per given CDF? So, one obvious question that should come to your mind is who will give me uniform samples? This is all assuming under the assuming that somebody has provided uniform samples, but uniform is another distribution like how we are going to generate? If that is there we are saying everything every other distribution will be able to generate, but who will provide? So, for that there are many different methods which will not go into in this class something called these are based on some congruential generators called linear congruential generator, multiplicative generator, some Fibonacci generator and all these are based on making things very random within your machine like you take some observations and you iterate in such a way that things that becomes looking very random like see like uniform is one such things which is easy to generate uniform because in uniform everything is equally likely and there is no prior information they are putting right. So, when you mix certain things very iteratively right everything becomes kind of equally possible and that is why generating of an uniform is easier to some extent and that is why we use them and based on that we build other I mean generate sample for other distributions ok fine. Now, with this I want to switch to the next topic called as jointly distributed random variables. Now, we will quickly run through again this fast again this is a some bunch of definitions we need to go through often it is not that you have to deal with one random variable you may have to deal with bunch of random variables right. For example, take two coins coin 1 I am going to throw and coin 2 I am going to throw actually outcome of coin 1 is one random variable outcome of the second coin is another random variable there are two random variable I want to see jointly how they behave ok. So, now, let us say I have this bunch of random variables x 1, x 2, x 3 and all of them are defined on the same sample space omega and now we are going to define something called as joint cumulative density function sorry joint cumulative distribution function which is of this random variable x. Now, onwards notice that earlier x I was used to denote for one random variable now that x could be a vector because there that could involve more than one random variable. Now, I am going to take like I am it is now this CDF is now going to not single vary varied, but it is a depends on a multiple variables earlier it was simply f of x x now it is f of x x 1, x 2 up to x m m here is the number of random variables you have. Now, its definition is this joint probability probability that x 1 is less than or equals to x 1 and x 2 is less than or equals to x 2 like that all the way up to x m is less than or equals to small x m. Notice that this is a joint probability we are talking about now joint CDF is expressed in terms of joint probability. So, this example we said right suppose I toss a coin n times each outcome is like a one random variable and I may be interested in the joint probability what is the probability that the first throw give me value of 1 second throw give me a value of 0 like that and the last one give me a value of 1 this is like a joint probability I am asking and the use based on this you are going to define your cumulative density functions. Other things sometimes we have to deal with coupled things for example, right now we are not saying that dependent or independent we just want to understand the joint behavior we are not we have not a define what is independence here. So, far we have defined independence of events right if I we give you two events when we say they are independent probability of their intersection that is like both events happening together is nothing but probability of product of the probability of individual that is the independence. But what is the independence here they are not a defined it will define it right now this definition does not worry about things are dependent or independent it is simple at this point just take it as a joint probabilities we are defining and based on that we are defining joint cumulative density function distribution function. Now let us take for simplicity this let us I am going to take this n equals to 2 here let us say I have two random variables x 1 and x 2. Hypothetically assume that that is representing the amount you are going to put in some stock you are you have decided to put your money in two stocks stock one and stock two in stock one you are going to put your amount x 1 and you are going to put an amount x 2 in your stock. But you have a total budget of c the amount you are going to put x 1 plus x 2 has to be equals to c right now there is a constraint right if I increase x 1 x 2 has to come down similarly if x 2 goes up x 1 has to both cannot increase or both cannot decrease if there is some has to add up. So, there is a dependency now to capture this dependency we need to define joint probabilities ok. So, here we know that x 1 and x 2 if I have to plot it is not this entire first quarter quadrant here it has to be something like this the values can only lie on this line right. So, if this is like a c and this is also c only the values has to lie on this point. So, there is a kind of dependency of one on the other.